- Timestamp:
- 2019-10-07T00:45:30+02:00 (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/defaultpresets.xml
r15434 r15437 2498 2498 <space /> 2499 2499 <checkgroup columns="2"> 2500 <check key="bus" text="Bus" />2501 <check key="highway" value_on="bus_stop" value_off="" text="Bus stop (legacy)" />2502 <check key="tram" text="Tram" />2503 <check key="railway" value_on="tram_stop" value_off="" text="Tram stop (legacy)" />2504 <check key="train" text="Train" />2505 <check key="railway" value_on="halt" value_off="" text="Railway halt (legacy)" />2500 <check key="bus" text="Bus" icon="presets/transport/bus.svg" /> 2501 <check key="highway" value_on="bus_stop" value_off="" text="Bus stop (legacy)" icon="presets/transport/bus.svg" /> 2502 <check key="tram" text="Tram" icon="presets/transport/railway/tram.svg" /> 2503 <check key="railway" value_on="tram_stop" value_off="" text="Tram stop (legacy)" icon="presets/transport/railway/tram.svg" /> 2504 <check key="train" text="Train" icon="presets/transport/train.svg" /> 2505 <check key="railway" value_on="halt" value_off="" text="Railway halt (legacy)" icon="presets/transport/train.svg" /> 2506 2506 </checkgroup> 2507 <check key="trolleybus" text="Trolleybus" />2508 <check key="share_taxi" text="Share taxi" />2509 <check key="subway" text="Subway" />2510 <check key="light_rail" text="Light Rail" />2511 <check key="monorail" text="Monorail" />2512 <check key="funicular" text="Funicular" />2513 <check key="aerialway" text="Aerialway" />2514 <check key="ferry" text="Ferry" />2507 <check key="trolleybus" text="Trolleybus" icon="presets/transport/trolleybus.svg" /> 2508 <check key="share_taxi" text="Share taxi" icon="presets/transport/share_taxi.svg" /> 2509 <check key="subway" text="Subway" icon="presets/transport/railway/subway.svg" /> 2510 <check key="light_rail" text="Light Rail" icon="presets/transport/railway/light_rail.svg" /> 2511 <check key="monorail" text="Monorail" icon="presets/transport/railway/monorail.svg" /> 2512 <check key="funicular" text="Funicular" icon="presets/transport/railway/funicular.svg" /> 2513 <check key="aerialway" text="Aerialway" icon="presets/transport/aerialway/station.svg" /> 2514 <check key="ferry" text="Ferry" icon="presets/nautical/ferry.svg" /> 2515 2515 </item> <!-- Stop Position --> 2516 2516 <item name="Platform" type="node,way,closedway,multipolygon" icon="presets/transport/platform.svg" preset_name_label="true"> -
trunk/data/tagging-preset.xsd
r14646 r15437 270 270 <attribute name="disable_off" type="boolean" /> 271 271 <attribute name="match" type="tns:match" /> 272 <attribute name="icon" type="string" /> 273 <attribute name="icon_size" type="integer" /> 272 274 273 275 <attribute name="name" use="prohibited" /> -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java
r15072 r15437 2 2 package org.openstreetmap.josm.gui.tagging.presets.items; 3 3 4 import java.awt.GridBagLayout; 5 import java.awt.event.MouseAdapter; 6 import java.awt.event.MouseEvent; 4 7 import java.util.ArrayList; 5 8 import java.util.Arrays; … … 7 10 import java.util.List; 8 11 12 import javax.swing.ImageIcon; 13 import javax.swing.JLabel; 9 14 import javax.swing.JPanel; 15 import javax.swing.SwingConstants; 10 16 11 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 18 import org.openstreetmap.josm.data.osm.OsmUtils; 13 19 import org.openstreetmap.josm.data.osm.Tag; 20 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 14 21 import org.openstreetmap.josm.gui.widgets.QuadStateCheckBox; 15 22 import org.openstreetmap.josm.tools.GBC; … … 30 37 /** "on" or "off" or unset (default is unset) */ 31 38 public String default_; // only used for tagless objects // NOSONAR 39 /** The location of icon file to display */ 40 public String icon; // NOSONAR 41 /** The size of displayed icon. If not set, default is 16px */ 42 public String icon_size; // NOSONAR 32 43 33 44 private QuadStateCheckBox check; … … 80 91 allowedStates.add(QuadStateCheckBox.State.NOT_SELECTED); 81 92 allowedStates.add(QuadStateCheckBox.State.UNSET); 82 check = new QuadStateCheckBox( locale_text, initialState,93 check = new QuadStateCheckBox(icon == null ? locale_text : null, initialState, 83 94 allowedStates.toArray(new QuadStateCheckBox.State[0])); 84 95 check.setPropertyText(key); 85 96 check.setState(check.getState()); // to update the tooltip text 86 97 87 p.add(check, GBC.eol()); // Do not fill, see #15104 98 JPanel checkPanel = new JPanel(new GridBagLayout()); 99 checkPanel.add(check, GBC.std()); 100 if (icon != null) { 101 JLabel label = new JLabel(locale_text, getIcon(), SwingConstants.LEFT); 102 label.addMouseListener(new MouseAdapter() { 103 @Override 104 public void mousePressed(MouseEvent e) { 105 check.getMouseAdapter().mousePressed(e); 106 } 107 }); 108 checkPanel.add(label); 109 checkPanel.add(new JLabel(), GBC.eol().fill()); 110 } 111 p.add(checkPanel, GBC.eol()); // Do not fill, see #15104 88 112 return true; 89 113 } … … 106 130 } 107 131 132 /** 133 * Returns the entry icon, if any. 134 * @return the entry icon, or {@code null} 135 * @since 15437 136 */ 137 public ImageIcon getIcon() { 138 Integer size = parseInteger(icon_size); 139 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), size != null ? size : 16); 140 } 141 108 142 @Override 109 143 public Collection<String> getValues() { -
trunk/src/org/openstreetmap/josm/gui/widgets/QuadStateCheckBox.java
r15287 r15437 45 45 private final transient QuadStateDecorator cbModel; 46 46 private State[] allowed; 47 private final MouseListener mouseAdapter = new MouseAdapter() { 48 @Override 49 public void mousePressed(MouseEvent e) { 50 grabFocus(); 51 cbModel.nextState(); 52 } 53 }; 47 54 48 55 /** … … 57 64 this.allowed = Utils.copyArray(allowed); 58 65 // Add a listener for when the mouse is pressed 59 super.addMouseListener(new MouseAdapter() { 60 @Override public void mousePressed(MouseEvent e) { 61 grabFocus(); 62 cbModel.nextState(); 63 } 64 }); 66 super.addMouseListener(mouseAdapter); 65 67 // Reset the keyboard action map 66 68 ActionMap map = new ActionMapUIResource(); … … 94 96 public synchronized void addMouseListener(MouseListener l) { 95 97 // Do nothing 98 } 99 100 /** 101 * Returns the internal mouse listener. 102 * @return the internal mouse listener 103 * @since 15437 104 */ 105 public MouseListener getMouseAdapter() { 106 return mouseAdapter; 96 107 } 97 108
Note:
See TracChangeset
for help on using the changeset viewer.