- Timestamp:
- 2007-05-22T22:36:21+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r205 r244 178 178 p.add(new JLabel("<html>"+trn("This will change {0} object.","This will change {0} objects.", sel.size(),sel.size())+"<br><br>"+tr("Please select a key")), 179 179 BorderLayout.NORTH); 180 TreeSet<String> allKeys = new TreeSet<String>(); 181 for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) 182 allKeys.addAll(osm.keySet()); 180 final TreeMap<String,TreeSet<String>> allData = new TreeMap<String,TreeSet<String>>(); 181 for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) { 182 for (String key : osm.keySet()) { 183 TreeSet<String> values = null; 184 if (allData.containsKey(key)) 185 values = allData.get(key); 186 else { 187 values = new TreeSet<String>(); 188 allData.put(key, values); 189 } 190 values.add(osm.get(key)); 191 } 192 } 183 193 for (int i = 0; i < data.getRowCount(); ++i) 184 all Keys.remove(data.getValueAt(i, 0));185 final JComboBox keys = new JComboBox(new Vector<String>(all Keys));194 allData.remove(data.getValueAt(i, 0)); 195 final JComboBox keys = new JComboBox(new Vector<String>(allData.keySet())); 186 196 keys.setEditable(true); 187 197 p.add(keys, BorderLayout.CENTER); … … 190 200 p.add(p2, BorderLayout.SOUTH); 191 201 p2.add(new JLabel(tr("Please select a value")), BorderLayout.NORTH); 192 final JTextField values = new JTextField(); 202 final JComboBox values = new JComboBox(); 203 values.setEditable(true); 193 204 p2.add(values, BorderLayout.CENTER); 205 206 ActionListener link = new ActionListener() { 207 208 public void actionPerformed(ActionEvent e) { 209 String key = keys.getEditor().getItem().toString(); 210 Vector<String> newValues = new Vector<String>(allData.get(key)); 211 values.setModel(new DefaultComboBoxModel(newValues)); 212 213 } 214 215 }; 216 keys.addActionListener(link); 217 194 218 JOptionPane pane = new JOptionPane(p, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ 195 219 @Override public void selectInitialValue() { … … 202 226 return; 203 227 String key = keys.getEditor().getItem().toString(); 204 String value = values.get Text();228 String value = values.getEditor().getItem().toString(); 205 229 if (value.equals("")) 206 230 return;
Note:
See TracChangeset
for help on using the changeset viewer.