+ top = new Panel();
+ blayout = new BorderLayout();
+ top.setLayoutManager(blayout);
+
+ infoPanel = new Panel();
+ infoPanel.setLayoutManager(new LinearLayout(Direction.VERTICAL));
+ top.addComponent(infoPanel, BorderLayout.Location.CENTER);
+
+ Panel notePanel = new Panel();
+ notePanel.setLayoutManager(new LinearLayout(Direction.HORIZONTAL));
+
+ notePanel.addComponent(UiColors.Element.VIEW_CONTACT_NOTES_TITLE
+ .createLabel("Notes:"));
+ note = UiColors.Element.VIEW_CONTACT_NORMAL.createLabel("");
+ notePanel.addComponent(note);
+
+ setContact(contact);
+
+ addComponent(top, BorderLayout.Location.TOP);
+ addComponent(notePanel, BorderLayout.Location.CENTER);
+ }
+
+ /**
+ * Change the enclosed {@link Contact} from this {@link ContactDetails}.
+ *
+ * @param contact
+ * the new {@link Contact}
+ */
+ public void setContact(Contact contact) {
+ if (this.contact == contact)
+ return;
+
+ this.contact = contact;
+
+ if (contact == null) {
+ image = null;
+ } else {
+ infoPanel.removeAllComponents();
+
+ String name = contact.getPreferredDataValue("FN");
+ if (name == null || name.length() == 0) {
+ // TODO format it ourself
+ name = contact.getPreferredDataValue("N");
+ }
+
+ // TODO: i18n + do it properly
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NAME
+ .createLabel(name));
+
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel(""));
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel("Phone: "
+ + contact.getPreferredDataValue("TEL")));
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel("eMail: "
+ + contact.getPreferredDataValue("EMAIL")));
+ infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL
+ .createLabel(""));
+
+ String notes = contact.getPreferredDataValue("NOTE");
+ if (notes == null)
+ notes = "";
+ note.setText(notes.replaceAll("\\\\n", "\n"));
+