X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Ftui%2Fpanes%2FContactDetails.java;h=aa838cb6d9339cc8d57a6e91dbefe743d827ae22;hp=5756c7cb1a25cd7aa6d8bde5ba379823f5455a13;hb=30a4aa17f2141ad80a23447ee2e6303f6c9ef995;hpb=f29274a79cd091262b65411ce81127b9de47f9b6 diff --git a/src/be/nikiroo/jvcard/tui/panes/ContactDetails.java b/src/be/nikiroo/jvcard/tui/panes/ContactDetails.java index 5756c7c..aa838cb 100644 --- a/src/be/nikiroo/jvcard/tui/panes/ContactDetails.java +++ b/src/be/nikiroo/jvcard/tui/panes/ContactDetails.java @@ -35,10 +35,33 @@ public class ContactDetails extends MainContent { private boolean fullscreenImage; private Panel infoPanel; private Label note; - ResourceBundle map; + + // from .properties file: + private int labelSize = -1; + private String infoFormat = ""; + // public ContactDetails(Contact contact) { - map = Bundles.getBundle("display"); + // Get the .properties info: + ResourceBundle map = Bundles.getBundle("display"); + + try { + labelSize = Integer.parseInt(map + .getString("CONTACT_DETAILS_LABEL_WIDTH")); + + } catch (NumberFormatException e) { + e.printStackTrace(); + labelSize = -1; + } catch (MissingResourceException e) { + labelSize = -1; + } + + try { + infoFormat = map.getString("CONTACT_DETAILS_INFO"); + } catch (MissingResourceException e) { + e.printStackTrace(); + } + // BorderLayout blayout = new BorderLayout(); setLayoutManager(blayout); @@ -82,36 +105,12 @@ public class ContactDetails extends MainContent { infoPanel.removeAllComponents(); String name = contact.getPreferredDataValue("FN"); - if (name == null || name.length() == 0) { - // TODO format it ourself - name = contact.getPreferredDataValue("N"); - } - infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NAME .createLabel(name)); infoPanel.addComponent(UiColors.Element.VIEW_CONTACT_NORMAL .createLabel("")); // List of infos: - int labelSize = -1; - try { - labelSize = Integer.parseInt(map - .getString("CONTACT_DETAILS_LABEL_WIDTH")); - - } catch (NumberFormatException e) { - e.printStackTrace(); - labelSize = -1; - } catch (MissingResourceException e) { - labelSize = -1; - } - - String infoFormat = ""; - try { - infoFormat = map.getString("CONTACT_DETAILS_INFO"); - } catch (MissingResourceException e) { - e.printStackTrace(); - } - String[] infos = infoFormat.split("\\|"); for (String info : infos) { // # - "=FIELD" will take the preferred value for this field