Changeset 8828 in josm
- Timestamp:
- 2015-10-05T22:34:08+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r8811 r8828 886 886 /** whether the off value is disabled in the dialog, i.e., only unset or yes are provided */ 887 887 public boolean disable_off = false; 888 /** ticked on/off (default is "off") */889 public boolean default_ = false; // only used for tagless objects888 /** "on" or "off" or unset (default is unset) */ 889 public String default_ = null; // only used for tagless objects 890 890 891 891 private QuadStateCheckBox check; 892 892 private QuadStateCheckBox.State initialState; 893 private boolean def;893 private Boolean def; 894 894 895 895 @Override … … 899 899 final Usage usage = determineBooleanUsage(sel, key); 900 900 final String oneValue = usage.values.isEmpty() ? null : usage.values.last(); 901 def = default_;901 def = "on".equals(default_) ? Boolean.TRUE : "off".equals(default_) ? Boolean.FALSE : null; 902 902 903 903 if (locale_text == null) { … … 906 906 907 907 if (usage.values.size() < 2 && (oneValue == null || value_on.equals(oneValue) || value_off.equals(oneValue))) { 908 if (def && !PROP_FILL_DEFAULT.get()) {908 if (def != null && !PROP_FILL_DEFAULT.get()) { 909 909 // default is set and filling default values feature is disabled - check if all primitives are untagged 910 910 for (OsmPrimitive s : sel) { 911 911 if (s.hasKeys()) { 912 def = false;912 def = null; 913 913 } 914 914 } … … 917 917 // all selected objects share the same value which is either true or false or unset, 918 918 // we can display a standard check box. 919 initialState = value_on.equals(oneValue) 919 initialState = value_on.equals(oneValue) || Boolean.TRUE.equals(def) 920 920 ? QuadStateCheckBox.State.SELECTED 921 : value_off.equals(oneValue) 921 : value_off.equals(oneValue) || Boolean.FALSE.equals(def) 922 922 ? QuadStateCheckBox.State.NOT_SELECTED 923 : def924 ? QuadStateCheckBox.State.SELECTED925 923 : QuadStateCheckBox.State.UNSET; 924 926 925 } else { 927 def = false;926 def = null; 928 927 // the objects have different values, or one or more objects have something 929 928 // else than true/false. we display a quad-state check box … … 949 948 public void addCommands(List<Tag> changedTags) { 950 949 // if the user hasn't changed anything, don't create a command. 951 if (check.getState() == initialState && !def) return;950 if (check.getState() == initialState && def == null) return; 952 951 953 952 // otherwise change things according to the selected value.
Note:
See TracChangeset
for help on using the changeset viewer.