- Timestamp:
- 2009-01-11T12:27:49+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r1241 r1242 18 18 import java.util.List; 19 19 import java.util.Map; 20 import java.util.Map.Entry; 20 21 import java.util.TreeMap; 21 22 import java.util.Vector; … … 68 69 } 69 70 // fill model with colors: 70 List<String> colorKeyList = new ArrayList<String>();71 List<String> colorKeyList_mappaint = new ArrayList<String>();71 Map<String, String> colorKeyList = new TreeMap<String, String>(); 72 Map<String, String> colorKeyList_mappaint = new TreeMap<String, String>(); 72 73 for(String key : colorMap.keySet()) { 73 74 if(key.startsWith("mappaint.")) 74 colorKeyList_mappaint. add(key);75 colorKeyList_mappaint.put(getName(key), key); 75 76 else 76 colorKeyList. add(key);77 colorKeyList.put(getName(key), key); 77 78 } 78 Collections.sort(colorKeyList); 79 Collections.sort(colorKeyList_mappaint); 80 colorKeyList.addAll(colorKeyList_mappaint); 81 for (String key : colorKeyList) { 79 for (Entry k : colorKeyList.entrySet()) { 82 80 Vector<Object> row = new Vector<Object>(2); 83 row.add(key); 84 row.add(ColorHelper.html2color(colorMap.get(key))); 81 row.add(k.getValue()); 82 row.add(ColorHelper.html2color(colorMap.get(k.getValue()))); 83 tableModel.addRow(row); 84 } 85 for (Entry k : colorKeyList_mappaint.entrySet()) { 86 Vector<Object> row = new Vector<Object>(2); 87 row.add(k.getValue()); 88 row.add(ColorHelper.html2color(colorMap.get(k.getValue()))); 85 89 tableModel.addRow(row); 86 90 } … … 106 110 } 107 111 112 private String getName(String o) 113 { 114 try 115 { 116 Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o); 117 m.matches(); 118 return tr("Paint style {0}: {1}", tr(m.group(1)), tr(m.group(2))); 119 } 120 catch (Exception e) {} 121 return tr(o); 122 } 123 108 124 public void addGui(final PreferenceDialog gui) { 109 125 fixColorPrefixes(); … … 126 142 } 127 143 return oldColorsRenderer.getTableCellRendererComponent(t,getName(o.toString()),selected,focus,row,column); 128 }129 private String getName(String o)130 {131 try132 {133 Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);134 m.matches();135 return tr("Paint style {0}: {1}", m.group(1), m.group(2));136 }137 catch (Exception e) {}138 return tr(o);139 144 } 140 145 });
Note:
See TracChangeset
for help on using the changeset viewer.