Changeset 126 in josm for src/org/openstreetmap
- Timestamp:
- 2006-07-25T18:53:18+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/dialogs/AnnotationPreset.java
r125 r126 202 202 203 203 private List<Item> data; 204 public finalString name;205 privateCollection<Class<?>> types;204 public String name; 205 Collection<Class<?>> types; 206 206 207 207 public AnnotationPreset(List<Item> data, String name, Collection<Class<?>> currentTypes) { … … 216 216 * Use this as default item for "do not select anything". 217 217 */ 218 public AnnotationPreset() { 219 name = ""; 220 } 218 public AnnotationPreset() {} 221 219 222 220 public static List<AnnotationPreset> readAll(InputStream inStream) throws IOException, SAXException { -
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r120 r126 28 28 29 29 import javax.swing.DefaultComboBoxModel; 30 import javax.swing.DefaultListCellRenderer; 30 31 import javax.swing.JButton; 31 32 import javax.swing.JComboBox; 33 import javax.swing.JComponent; 32 34 import javax.swing.JDialog; 33 35 import javax.swing.JLabel; 36 import javax.swing.JList; 34 37 import javax.swing.JOptionPane; 35 38 import javax.swing.JPanel; … … 261 264 } 262 265 }); 266 annotationPresets.setRenderer(new DefaultListCellRenderer(){ 267 @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 268 AnnotationPreset a = (AnnotationPreset)value; 269 if (a.name == null) 270 return super.getListCellRendererComponent(list, "", index, false, false); 271 JComponent c = (JComponent)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 272 JLabel l = new JLabel((a).name); 273 l.setForeground(c.getForeground()); 274 l.setBackground(c.getBackground()); 275 l.setFont(c.getFont()); 276 l.setBorder(c.getBorder()); 277 if (a.types == null) 278 l.setIcon(ImageProvider.get("data", "empty")); 279 else if (a.types.size() != 1) 280 l.setIcon(ImageProvider.get("data", "object")); 281 else 282 l.setIcon(ImageProvider.get("data", a.types.iterator().next().getSimpleName().toLowerCase())); 283 l.setOpaque(true); 284 return l; 285 } 286 }); 263 287 264 288 data.setColumnIdentifiers(new String[]{tr("Key"),tr("Value")});
Note:
See TracChangeset
for help on using the changeset viewer.