X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Ftui%2Fpanes%2FContactList.java;h=dc89fcd7fa278037fdb81875e6ce4438746cf07c;hb=f06c81000632cfb5f525ca458f719338f55f9f66;hp=600f90ca9931bfc8b108b99c00ee88e5cff92023;hpb=26d254a3ac6cddbd3583cbbcbf8d43aa15c6a32e;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/tui/panes/ContactList.java b/src/be/nikiroo/jvcard/tui/panes/ContactList.java index 600f90c..dc89fcd 100644 --- a/src/be/nikiroo/jvcard/tui/panes/ContactList.java +++ b/src/be/nikiroo/jvcard/tui/panes/ContactList.java @@ -8,12 +8,13 @@ import be.nikiroo.jvcard.Card; import be.nikiroo.jvcard.Contact; import be.nikiroo.jvcard.Data; import be.nikiroo.jvcard.launcher.Main; -import be.nikiroo.jvcard.resources.Bundles; -import be.nikiroo.jvcard.resources.Trans; +import be.nikiroo.jvcard.resources.ColorOption; +import be.nikiroo.jvcard.resources.DisplayBundle; +import be.nikiroo.jvcard.resources.DisplayOption; +import be.nikiroo.jvcard.resources.StringId; import be.nikiroo.jvcard.tui.KeyAction; import be.nikiroo.jvcard.tui.KeyAction.DataType; import be.nikiroo.jvcard.tui.KeyAction.Mode; -import be.nikiroo.jvcard.tui.UiColors.Element; import com.googlecode.lanterna.input.KeyType; @@ -27,9 +28,10 @@ public class ContactList extends MainContentList { private String format; public ContactList(Card card) { + DisplayBundle map = new DisplayBundle(); formats = new LinkedList(); - for (String format : Bundles.getBundle("display") - .getString("CONTACT_LIST_FORMAT").split(",")) { + for (String format : map.getString(DisplayOption.CONTACT_LIST_FORMAT) + .split(",")) { formats.add(format); } @@ -93,7 +95,7 @@ public class ContactList extends MainContentList { // TODO ui actions.add(new KeyAction(Mode.ASK_USER, 'a', - Trans.StringId.KEY_ACTION_ADD) { + StringId.KEY_ACTION_ADD) { @Override public Object getObject() { return card; @@ -101,7 +103,7 @@ public class ContactList extends MainContentList { @Override public String getQuestion() { - return Main.trans(Trans.StringId.ASK_USER_CONTACT_NAME); + return Main.trans(StringId.ASK_USER_CONTACT_NAME); } @Override @@ -117,7 +119,7 @@ public class ContactList extends MainContentList { } }); actions.add(new KeyAction(Mode.ASK_USER_KEY, 'd', - Trans.StringId.KEY_ACTION_DELETE_CONTACT) { + StringId.KEY_ACTION_DELETE) { @Override public Object getObject() { return getSelectedContact(); @@ -130,7 +132,8 @@ public class ContactList extends MainContentList { if (contact != null) contactName = "" + contact.getPreferredDataValue("FN"); - return Main.trans(Trans.StringId.CONFIRM_USER_DELETE_CONTACT, + return Main.trans( + StringId.CONFIRM_USER_DELETE_CONTACT, contactName); } @@ -147,7 +150,8 @@ public class ContactList extends MainContentList { if (contact != null) contactName = "" + contact.getPreferredDataValue("FN"); - return Main.trans(Trans.StringId.ERR_CANNOT_DELETE_CONTACT, + return Main.trans( + StringId.ERR_CANNOT_DELETE_CONTACT, contactName); } @@ -155,7 +159,7 @@ public class ContactList extends MainContentList { } }); actions.add(new KeyAction(Mode.ASK_USER_KEY, 's', - Trans.StringId.KEY_ACTION_SAVE_CARD) { + StringId.KEY_ACTION_SAVE_CARD) { @Override public Object getObject() { return card; @@ -187,14 +191,14 @@ public class ContactList extends MainContentList { }); actions.add(new KeyAction(Mode.CONTACT_DETAILS, KeyType.Enter, - Trans.StringId.KEY_ACTION_VIEW_CONTACT) { + StringId.KEY_ACTION_VIEW_CONTACT) { @Override public Object getObject() { return getSelectedContact(); } }); actions.add(new KeyAction(Mode.NONE, KeyType.Tab, - Trans.StringId.KEY_ACTION_SWITCH_FORMAT) { + StringId.KEY_ACTION_SWITCH_FORMAT) { @Override public boolean onAction() { switchFormat(); @@ -202,7 +206,7 @@ public class ContactList extends MainContentList { } }); actions.add(new KeyAction(Mode.ASK_USER, 'w', - Trans.StringId.KEY_ACTION_SEARCH) { + StringId.KEY_ACTION_SEARCH) { @Override public String getQuestion() { @@ -253,18 +257,18 @@ public class ContactList extends MainContentList { if (contact == null) return parts; - Element el = (focused && selected) ? Element.CONTACT_LINE_SELECTED - : Element.CONTACT_LINE; - Element elSep = (focused && selected) ? Element.CONTACT_LINE_SEPARATOR_SELECTED - : Element.CONTACT_LINE_SEPARATOR; - Element elDirty = (focused && selected) ? Element.CONTACT_LINE_DIRTY_SELECTED - : Element.CONTACT_LINE_DIRTY; + ColorOption el = (focused && selected) ? ColorOption.CONTACT_LINE_SELECTED + : ColorOption.CONTACT_LINE; + ColorOption elSep = (focused && selected) ? ColorOption.CONTACT_LINE_SEPARATOR_SELECTED + : ColorOption.CONTACT_LINE_SEPARATOR; + ColorOption elDirty = (focused && selected) ? ColorOption.CONTACT_LINE_DIRTY_SELECTED + : ColorOption.CONTACT_LINE_DIRTY; width -= 2; // dirty mark space String[] array = contact.toStringArray(format, getSeparator(), " ", width, Main.isUnicode()); - + if (contact.isDirty()) { parts.add(new TextPart(" ", el)); parts.add(new TextPart("*", elDirty));