Changeset 6314 in josm for trunk/src/org
- Timestamp:
- 2013-10-07T16:23:05+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r6313 r6314 24 24 import java.awt.event.MouseListener; 25 25 import java.awt.event.MouseMotionListener; 26 import java.lang.reflect.InvocationTargetException; 26 27 import java.util.ArrayList; 27 28 import java.util.Collection; … … 341 342 } 342 343 }); 343 } catch (Exception e) { 344 } catch (InterruptedException e) { 345 // Occurs frequently during JOSM shutdown, log set to debug only 346 Main.debug("InterruptedException in "+MapStatus.class.getSimpleName()); 347 } catch (InvocationTargetException e) { 344 348 Main.warn(e); 345 349 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r6264 r6314 60 60 import org.openstreetmap.josm.command.ChangePropertyCommand; 61 61 import org.openstreetmap.josm.command.Command; 62 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 63 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 62 64 import org.openstreetmap.josm.data.SelectionChangedListener; 63 65 import org.openstreetmap.josm.data.osm.IRelation; … … 113 115 * @author imi 114 116 */ 115 public class PropertiesDialog extends ToggleDialog implements SelectionChangedListener, MapView.EditLayerChangeListener, DataSetListenerAdapter.Listener {117 public class PropertiesDialog extends ToggleDialog implements SelectionChangedListener, MapView.EditLayerChangeListener, DataSetListenerAdapter.Listener, PreferenceChangedListener { 116 118 117 119 /** … … 272 274 273 275 editHelper.loadTagsIfNeeded(); 276 277 Main.pref.addPreferenceChangeListener(this); 274 278 } 275 279 … … 281 285 propertyTable.getTableHeader().setReorderingAllowed(false); 282 286 283 propertyTable.getColumnModel().getColumn(1).setCellRenderer(new DefaultTableCellRenderer(){ 284 @Override public Component getTableCellRendererComponent(JTable table, Object value, 285 boolean isSelected, boolean hasFocus, int row, int column) { 286 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 287 if (value == null) 288 return this; 289 if (c instanceof JLabel) { 290 String str = null; 291 if (value instanceof String) { 292 str = (String) value; 293 } else if (value instanceof Map<?, ?>) { 294 Map<?, ?> v = (Map<?, ?>) value; 295 if (v.size() != 1) { 296 str=tr("<different>"); 297 c.setFont(c.getFont().deriveFont(Font.ITALIC)); 298 } else { 299 final Map.Entry<?, ?> entry = v.entrySet().iterator().next(); 300 str = (String) entry.getKey(); 301 } 302 } 303 ((JLabel)c).putClientProperty("html.disable", Boolean.TRUE); // Fix #8730 304 ((JLabel)c).setText(str); 305 } 306 return c; 307 } 308 }); 287 PropertiesCellRenderer cellRenderer = new PropertiesCellRenderer(); 288 propertyTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); 289 propertyTable.getColumnModel().getColumn(1).setCellRenderer(cellRenderer); 309 290 } 310 291 … … 562 543 public void destroy() { 563 544 super.destroy(); 545 Main.pref.removePreferenceChangeListener(this); 564 546 for (JosmAction action : josmActions) { 565 547 action.destroy(); … … 594 576 propertyData.setRowCount(0); 595 577 578 final boolean displayDiscardableKeys = Main.pref.getBoolean("display.discardable-keys", false); 596 579 final Map<String, Integer> keyCount = new HashMap<String, Integer>(); 597 580 final Map<String, String> tags = new HashMap<String, String>(); … … 601 584 types.add(TaggingPresetType.forPrimitive(osm)); 602 585 for (String key : osm.keySet()) { 603 String value = osm.get(key); 604 keyCount.put(key, keyCount.containsKey(key) ? keyCount.get(key) + 1 : 1); 605 if (valueCount.containsKey(key)) { 606 Map<String, Integer> v = valueCount.get(key); 607 v.put(value, v.containsKey(value) ? v.get(value) + 1 : 1); 608 } else { 609 TreeMap<String, Integer> v = new TreeMap<String, Integer>(); 610 v.put(value, 1); 611 valueCount.put(key, v); 586 if (displayDiscardableKeys || !OsmPrimitive.getDiscardableKeys().contains(key)) { 587 String value = osm.get(key); 588 keyCount.put(key, keyCount.containsKey(key) ? keyCount.get(key) + 1 : 1); 589 if (valueCount.containsKey(key)) { 590 Map<String, Integer> v = valueCount.get(key); 591 v.put(value, v.containsKey(value) ? v.get(value) + 1 : 1); 592 } else { 593 TreeMap<String, Integer> v = new TreeMap<String, Integer>(); 594 v.put(value, 1); 595 valueCount.put(key, v); 596 } 612 597 } 613 598 } … … 1254 1239 } 1255 1240 } 1241 1242 @Override 1243 public void preferenceChanged(PreferenceChangeEvent e) { 1244 if ("display.discardable-keys".equals(e.getKey())) { 1245 if (Main.main.getCurrentDataSet() != null) { 1246 // Re-load data when display preference change 1247 selectionChanged(Main.main.getCurrentDataSet().getSelected()); 1248 } 1249 } 1250 } 1256 1251 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r6296 r6314 41 41 private JCheckBox virtualNodes = new JCheckBox(tr("Draw virtual nodes in select mode")); 42 42 private JCheckBox inactive = new JCheckBox(tr("Draw inactive layers in other color")); 43 private JCheckBox discardableKeys = new JCheckBox(tr("Display discardable keys")); 43 44 44 45 // Options that affect performance … … 117 118 118 119 // outlineOnly 120 outlineOnly.setToolTipText(tr("This option suppresses the filling of areas, overriding anything specified in the selected style.")); 119 121 outlineOnly.setSelected(Main.pref.getBoolean("draw.data.area_outline_only", false)); 120 outlineOnly.setToolTipText(tr("This option suppresses the filling of areas, overriding anything specified in the selected style.")); 121 122 123 // discardable keys 124 discardableKeys.setToolTipText(tr("Display keys which have been deemed uninteresting to the point that they can be silently removed.")); 125 discardableKeys.setSelected(Main.pref.getBoolean("display.discardable-keys", false)); 126 122 127 JLabel performanceLabel = new JLabel(tr("Options that affect drawing performance")); 123 128 … … 144 149 panel.add(sourceBounds, GBC.eop().insets(20,0,0,0)); 145 150 panel.add(inactive, GBC.eop().insets(20,0,0,0)); 151 panel.add(discardableKeys, GBC.eop().insets(20,0,0,0)); 146 152 147 153 ExpertToggleAction.addVisibilitySwitcher(performanceLabel); … … 150 156 ExpertToggleAction.addVisibilitySwitcher(useHighlighting); 151 157 ExpertToggleAction.addVisibilitySwitcher(outlineOnly); 158 ExpertToggleAction.addVisibilitySwitcher(discardableKeys); 152 159 153 160 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); … … 171 178 Main.pref.put("draw.target-highlight", useHighlighting.isSelected()); 172 179 Main.pref.put("draw.helper-line", drawHelperLine.isSelected()); 180 Main.pref.put("display.discardable-keys", discardableKeys.isSelected()); 173 181 int vn = Main.pref.getInteger("mappaint.node.virtual-size", 8); 174 182 if (virtualNodes.isSelected()) {
Note:
See TracChangeset
for help on using the changeset viewer.