- Timestamp:
- 2009-03-08T18:06:32+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r1427 r1474 190 190 private QuadStateCheckBox check; 191 191 private QuadStateCheckBox.State initialState; 192 private boolean def; 192 193 193 194 @Override public void addToPanel(JPanel p, Collection<OsmPrimitive> sel) { … … 195 196 // find out if our key is already used in the selection. 196 197 Usage usage = determineBooleanUsage(sel, key); 198 def = default_; 197 199 198 200 if(locale_text == null) … … 202 204 for (String s : usage.values) oneValue = s; 203 205 if (usage.values.size() < 2 && (oneValue == null || OsmUtils.trueval.equals(oneValue) || OsmUtils.falseval.equals(oneValue))) { 204 if(def ault_)206 if(def) 205 207 { 206 208 for (OsmPrimitive s : sel) 207 if(s.keys != null && s.keys.size() > 0) def ault_= false;209 if(s.keys != null && s.keys.size() > 0) def = false; 208 210 } 209 211 … … 214 216 OsmUtils.falseval.equals(oneValue) ? 215 217 QuadStateCheckBox.State.NOT_SELECTED : 216 def ault_? QuadStateCheckBox.State.SELECTED218 def ? QuadStateCheckBox.State.SELECTED 217 219 : QuadStateCheckBox.State.UNSET; 218 220 check = new QuadStateCheckBox(locale_text, initialState, … … 222 224 QuadStateCheckBox.State.UNSET }); 223 225 } else { 226 def = false; 224 227 // the objects have different values, or one or more objects have something 225 228 // else than true/false. we display a quad-state check box … … 238 241 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 239 242 // if the user hasn't changed anything, don't create a command. 240 if (check.getState() == initialState ) return;243 if (check.getState() == initialState && !def) return; 241 244 242 245 // otherwise change things according to the selected value. … … 590 593 if (p == null) 591 594 return; 592 595 593 596 int answer = 1; 594 597 if (p.getComponentCount() != 0) { … … 600 603 title = tr("Selection unsuitable!"); 601 604 } 602 605 603 606 class PresetDialog extends ExtendedDialog { 604 607 public PresetDialog(Component content, String title, boolean disableApply) { … … 614 617 } 615 618 } 616 619 617 620 answer = new PresetDialog(p, title, (sel.size() == 0)).getValue(); 618 621 } … … 624 627 Main.ds.setSelected(Main.ds.getSelected()); // force update 625 628 } 626 629 627 630 /** 628 631 * True whenever the original selection given into createSelection was empty 629 632 */ 630 633 private boolean originalSelectionEmpty = false; 631 634 632 635 /** 633 636 * Removes all unsuitable OsmPrimitives from the given list
Note:
See TracChangeset
for help on using the changeset viewer.