Changeset 702 in josm for trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
- Timestamp:
- 2008-07-11T20:49:51+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r700 r702 39 39 import org.openstreetmap.josm.command.SequenceCommand; 40 40 import org.openstreetmap.josm.data.osm.OsmPrimitive; 41 import org.openstreetmap.josm.data.osm.OsmUtils; 41 42 import org.openstreetmap.josm.gui.QuadStateCheckBox; 42 43 import org.openstreetmap.josm.tools.GBC; … … 82 83 returnValue.values = new HashSet<String>(); 83 84 for (OsmPrimitive s : sel) { 84 String v = s.get(key); 85 if ("true".equalsIgnoreCase(v)) v = "true"; 86 else if ("yes".equalsIgnoreCase(v)) v = "true"; 87 else if ("1".equals(v)) v = "true"; 88 else if ("false".equalsIgnoreCase(v)) v = "false"; 89 else if ("no".equalsIgnoreCase(v)) v = "false"; 90 else if ("0".equals(v)) v = "false"; 91 returnValue.values.add(v); 85 returnValue.values.add(OsmUtils.getNamedOsmBoolean(s.get(key))); 92 86 } 93 87 return returnValue; … … 173 167 String oneValue = null; 174 168 for (String s : usage.values) oneValue = s; 175 if (usage.values.size() < 2 && (oneValue == null || "true".equals(oneValue) || "false".equals(oneValue))) {169 if (usage.values.size() < 2 && (oneValue == null || OsmUtils.trueval.equals(oneValue) || OsmUtils.falseval.equals(oneValue))) { 176 170 // all selected objects share the same value which is either true or false or unset, 177 171 // we can display a standard check box. 178 initialState = "true".equals(oneValue) ?172 initialState = OsmUtils.trueval.equals(oneValue) ? 179 173 QuadStateCheckBox.State.SELECTED : 180 "false".equals(oneValue) ?174 OsmUtils.falseval.equals(oneValue) ? 181 175 QuadStateCheckBox.State.NOT_SELECTED : 182 176 QuadStateCheckBox.State.UNSET; … … 207 201 // otherwise change things according to the selected value. 208 202 cmds.add(new ChangePropertyCommand(sel, key, 209 check.getState() == QuadStateCheckBox.State.SELECTED ? "true":210 check.getState() == QuadStateCheckBox.State.NOT_SELECTED ? "false":203 check.getState() == QuadStateCheckBox.State.SELECTED ? OsmUtils.trueval : 204 check.getState() == QuadStateCheckBox.State.NOT_SELECTED ? OsmUtils.falseval : 211 205 null)); 212 206 } … … 355 349 public void setDisplayName(String name) { 356 350 putValue(Action.NAME, tr(name)); 351 String tooltip = tr("Use presets ''{0}''", tr(name)); 352 putValue(SHORT_DESCRIPTION, "<html>"+tooltip+"</html>"); 357 353 } 358 354
Note:
See TracChangeset
for help on using the changeset viewer.