Changeset 8493 in josm
- Timestamp:
- 2015-06-19T17:26:18+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r8415 r8493 65 65 import org.openstreetmap.josm.gui.widgets.QuadStateCheckBox; 66 66 import org.openstreetmap.josm.gui.widgets.UrlLabel; 67 import org.openstreetmap.josm.tools.AlphanumComparator; 67 68 import org.openstreetmap.josm.tools.GBC; 68 69 import org.openstreetmap.josm.tools.ImageProvider; … … 93 94 private static final Map<String,String> LAST_VALUES = new HashMap<>(); 94 95 95 public static class PresetListEntry {96 public static class PresetListEntry implements Comparable<PresetListEntry> { 96 97 public String value; 97 98 /** The context used for translating {@link #value} */ … … 168 169 return DIFFERENT; 169 170 return getDisplayValue(true).replaceAll("<.*>", ""); // remove additional markup, e.g. <br> 171 } 172 173 @Override 174 public int compareTo(PresetListEntry o) { 175 return AlphanumComparator.getInstance().compare(this.getDisplayValue(true), o.getDisplayValue(true)); 170 176 } 171 177 } … … 1064 1070 } 1065 1071 1066 private String[]initListEntriesFromAttributes() {1072 private void initListEntriesFromAttributes() { 1067 1073 char delChar = getDelChar(); 1068 1074 … … 1110 1116 } 1111 1117 1118 final List<PresetListEntry> entries = new ArrayList<>(value_array.length); 1112 1119 for (int i = 0; i < value_array.length; i++) { 1113 1120 final PresetListEntry e = new PresetListEntry(value_array[i]); 1114 1121 e.locale_display_value = locale_display_values != null 1115 1122 ? display_array[i] 1116 : trc(values_context, fixPresetString(display_array[i])); 1117 if (short_descriptions_array != null) { 1118 e.locale_short_description = locale_short_descriptions != null 1119 ? short_descriptions_array[i] 1120 : tr(fixPresetString(short_descriptions_array[i])); 1121 } 1122 lhm.put(value_array[i], e); 1123 display_array[i] = e.getDisplayValue(true); 1124 } 1125 1126 return display_array; 1123 : trc(values_context, fixPresetString(display_array[i])); 1124 if (short_descriptions_array != null) { 1125 e.locale_short_description = locale_short_descriptions != null 1126 ? short_descriptions_array[i] 1127 : tr(fixPresetString(short_descriptions_array[i])); 1128 } 1129 1130 entries.add(e); 1131 } 1132 1133 if (Main.pref.getBoolean("taggingpreset.sortvalues", true)) { 1134 Collections.sort(entries); 1135 } 1136 1137 for (PresetListEntry i : entries) { 1138 lhm.put(i.value, i); 1139 } 1140 1127 1141 } 1128 1142
Note:
See TracChangeset
for help on using the changeset viewer.