- Timestamp:
- 2006-07-23T20:21:05+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r119 r123 147 147 final Action annotationTesterAction = new AbstractAction(){ 148 148 public void actionPerformed(ActionEvent e) { 149 String[] args = pref.get("annotation.sources").split(";"); 149 String annotationSources = pref.get("annotation.sources"); 150 if (annotationSources.equals("")) { 151 JOptionPane.showMessageDialog(Main.parent, "You have to specify annotation sources in the preferences first."); 152 return; 153 } 154 String[] args = annotationSources.split(";"); 150 155 new AnnotationTester(args); 151 156 } -
src/org/openstreetmap/josm/gui/PreferenceDialog.java
r119 r123 132 132 */ 133 133 private JComboBox lafCombo = new JComboBox(UIManager.getInstalledLookAndFeels()); 134 private JComboBox languages = new JComboBox(new Locale[]{ Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH});134 private JComboBox languages = new JComboBox(new Locale[]{new Locale("en", "US"), new Locale("en", "GB"), Locale.GERMAN, Locale.FRENCH}); 135 135 /** 136 136 * The main tab panel. -
src/org/openstreetmap/josm/gui/dialogs/AnnotationPreset.java
r120 r123 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import static org.openstreetmap.josm.tools.I18n.trn; 4 5 5 6 import java.awt.GridBagLayout; … … 84 85 String label; 85 86 JComboBox combo; 87 private final String[] values; 86 88 87 89 public void addToPanel(JPanel p) { … … 89 91 p.add(combo, GBC.eol().fill(GBC.HORIZONTAL)); 90 92 } 91 public Combo(String key, String label, String def, String[] values, boolean editable) {93 public Combo(String key, String label, String def, String[] values, String[] displayedValues, boolean editable) { 92 94 this.key = key; 93 95 this.label = label; 94 combo = new JComboBox(values); 96 this.values = values; 97 combo = new JComboBox(displayedValues); 95 98 combo.setEditable(editable); 96 99 combo.setSelectedItem(def); 97 100 } 98 101 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 99 String str = combo.isEditable()?combo.getEditor().getItem().toString() : combo.getSelectedItem().toString(); 102 String v = combo.getSelectedIndex() == -1 ? null : values[combo.getSelectedIndex()]; 103 String str = combo.isEditable()?combo.getEditor().getItem().toString() : v; 100 104 cmds.add(new ChangePropertyCommand(sel, key, str)); 101 105 } … … 164 168 String[] values = a.getValue("values").split(","); 165 169 String s = a.getValue("readonly"); 166 boolean editable = s == null || s.equals("0") || s.startsWith("off") || s.startsWith("false") || s.startsWith("no"); 167 current.add(new Combo(a.getValue("key"), a.getValue("text"), a.getValue("default"), values, editable)); 170 String dvstr = a.getValue("display_values"); 171 boolean editable = s == null || s.equals("0") || s.startsWith("off") || s.startsWith("false") || s.startsWith("no"); 172 if (dvstr != null) { 173 if (editable && s != null) 174 throw new SAXException(tr("Cannot have a writable combobox with default values (line {0})", getLineNumber())); 175 editable = false; // for combos with display_value readonly default to false 176 } 177 String[] displayValues = dvstr == null ? values : dvstr.split(","); 178 if (displayValues.length != values.length) 179 throw new SAXException(tr("display_values ({0}) and values ({1}) must be of same number of elements.", 180 displayValues.length+" "+trn("element", "elements", displayValues.length), 181 values.length+" "+trn("element", "elements", values.length))); 182 current.add(new Combo(a.getValue("key"), a.getValue("text"), a.getValue("default"), values, displayValues, editable)); 168 183 } else if (qname.equals("key")) 169 184 current.add(new Key(a.getValue("key"), a.getValue("value"))); -
src/org/openstreetmap/josm/gui/dialogs/AnnotationTester.java
r120 r123 59 59 annotationPanel.removeAll(); 60 60 AnnotationPreset preset = (AnnotationPreset)annotationPresets.getSelectedItem(); 61 if (preset == null) 62 return; 61 63 JPanel p = preset.createPanel(); 62 64 p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
Note:
See TracChangeset
for help on using the changeset viewer.