+ String label = info.substring(0, index);
+ String field = info.substring(index + 1);
+
+ if (all) {
+ for (Data data : contact.getData(field)) {
+ if (data.isPreferred()) {
+ infoPanel.addComponent(el
+ .createLabel(StringUtils.padString(
+ label, labelSize)
+ + data.toString()));
+ } else {
+ infoPanel
+ .addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel(StringUtils
+ .padString(label,
+ labelSize)
+ + data.toString()));
+ }
+ }
+ } else {
+ String val = contact.getPreferredDataValue(field);
+ if (val == null)
+ val = "";
+ infoPanel.addComponent(el.createLabel(StringUtils
+ .padString(label, labelSize) + val));
+ }
+ } else {
+ String label = info;
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel(StringUtils
+ .padString(label, labelSize)));
+ }
+ }
+ // end of list
+
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel(""));
+
+ String notes = contact.getPreferredDataValue("NOTE");
+ if (notes == null)
+ notes = "";
+ note.setText(notes);
+
+ Data photo = contact.getPreferredData("PHOTO");
+ if (photo != null) {
+ TypeInfo encoding = null;
+ for (int index = 0; index < photo.size(); index++) {
+ TypeInfo info = photo.get(index);
+ if (info.getName() != null) {
+ if (info.getName().equalsIgnoreCase("ENCODING"))
+ encoding = info;
+ // We don't check for the "TYPE" anymore, we just defer
+ // it to ImageIcon
+ }
+ }
+
+ if (encoding != null && encoding.getValue() != null
+ && encoding.getValue().equalsIgnoreCase("b")) {
+
+ try {
+ image = ImageIO.read(new ByteArrayInputStream(
+ DatatypeConverter.parseBase64Binary(photo
+ .getValue())));
+ image.toString();
+ } catch (Exception e) {
+ System.err.println("Cannot parse image for contact: "
+ + contact.getPreferredDataValue("UID"));
+ }
+ }
+ }
+ }
+
+ setImage(image);