- Timestamp:
- 2011-07-09T21:54:22+02:00 (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/defaultpresets.xml
r4210 r4218 31 31 default: default string to display 32 32 delete_if_empty: true/false 33 use_last_as_default: true/false 33 use_last_as_default: true/false/force 34 34 35 35 combo: combo box, with multiple choices and possible to enter free form text … … 48 48 default: default string to display 49 49 delete_if_empty: true/false 50 use_last_as_default: true/false 50 use_last_as_default: true/false/force 51 51 52 52 multiselect: list of values from which zero or more can be selected … … 68 68 default: default string to display 69 69 delete_if_empty: true/false 70 use_last_as_default: true/false 70 use_last_as_default: true/false/force 71 71 72 72 check: checkbox … … 4068 4068 <optional> 4069 4069 <text key="addr:housename" text="House name" default="" delete_if_empty="true" /> 4070 <text key="addr:street" text="Street name" use_last_as_default=" true" delete_if_empty="true" />4071 <text key="addr:city" text="City name" use_last_as_default=" true" delete_if_empty="true" />4072 <text key="addr:postcode" text="Post code" use_last_as_default=" true" delete_if_empty="true" />4073 <combo key="addr:country" text="Country code" values="AT,CH,DE,FR,GB,IT,US" use_last_as_default=" true" delete_if_empty="true" />4070 <text key="addr:street" text="Street name" use_last_as_default="force" delete_if_empty="true" /> 4071 <text key="addr:city" text="City name" use_last_as_default="force" delete_if_empty="true" /> 4072 <text key="addr:postcode" text="Post code" use_last_as_default="force" delete_if_empty="true" /> 4073 <combo key="addr:country" text="Country code" values="AT,CH,DE,FR,GB,IT,US" use_last_as_default="force" delete_if_empty="true" /> 4074 4074 </optional> 4075 4075 </item> -
trunk/data/tagging-preset.xsd
r3839 r4218 114 114 <attribute name="default" type="string" /> 115 115 <attribute name="delete_if_empty" type="boolean" /> 116 <attribute name="use_last_as_default" type=" boolean" />116 <attribute name="use_last_as_default" type="tns:last_default" /> 117 117 <attribute name="required" type="boolean" /> 118 118 … … 136 136 <attribute name="display_values" type="string" /> 137 137 <attribute name="default" type="string" /> 138 <attribute name="use_last_as_default" type="tns:last_default" /> 138 139 <attribute name="editable" type="boolean" /> 139 140 <attribute name="delete_if_empty" type="boolean" /> … … 156 157 <attribute name="display_values" type="string" /> 157 158 <attribute name="default" type="string" /> 159 <attribute name="use_last_as_default" type="tns:last_default" /> 158 160 <attribute name="delimiter" type="string" /> 159 161 <attribute name="delete_if_empty" type="boolean" /> … … 173 175 <attribute name="text_context" type="string" /> 174 176 <attribute name="default" type="tns:check_default" /> 175 <attribute name="use_last_as_default" type="boolean" />176 177 <attribute name="required" type="boolean" /> 177 178 <attribute name="value_on" type="string" /> … … 191 192 </simpleType> 192 193 194 <simpleType name="last_default"> 195 <restriction base="string"> 196 <enumeration value="true" /> 197 <enumeration value="false" /> 198 <enumeration value="force" /> 199 </restriction> 200 </simpleType> 201 193 202 <complexType name="roles"> 194 203 <sequence> -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r4185 r4218 236 236 public String default_; 237 237 public String originalValue; 238 public boolean use_last_as_default = false;238 public String use_last_as_default = "false"; 239 239 public boolean delete_if_empty = false; 240 240 public boolean required = false; … … 249 249 initAutoCompletionField(textField, key); 250 250 if (usage.unused()){ 251 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() ) {251 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) { 252 252 // selected osm primitives are untagged or filling default values feature is enabled 253 if ( use_last_as_default&& lastValue.containsKey(key)) {253 if (!"false".equals(use_last_as_default) && lastValue.containsKey(key)) { 254 254 textField.setText(lastValue.get(key)); 255 255 } else { … … 297 297 ((JTextField)value).getText(); 298 298 299 if ( use_last_as_default) {299 if (!"false".equals(use_last_as_default)) { 300 300 lastValue.put(key, v); 301 301 } … … 319 319 public String value_off = OsmUtils.falseval; 320 320 public boolean default_ = false; // only used for tagless objects 321 public boolean use_last_as_default = false;322 321 public boolean required = false; 323 322 … … 411 410 public boolean delete_if_empty = false; 412 411 public boolean editable = true; 413 public boolean use_last_as_default = false;412 public String use_last_as_default = "false"; 414 413 public boolean required = false; 415 414 … … 446 445 } 447 446 448 if ( use_last_as_default&& def == null && lastValue.containsKey(key)) {447 if (!"false".equals(use_last_as_default) && def == null && lastValue.containsKey(key)) { 449 448 def = lastValue.get(key); 450 449 } … … 503 502 else if (def != null && usage.unused()) { 504 503 // default is set and all items were unset 505 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() ) {504 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) { 506 505 // selected osm primitives are untagged or filling default feature is enabled 507 506 combo.setSelectedItem(def); … … 605 604 value = null; 606 605 } 607 if ( use_last_as_default) {606 if (!"false".equals(use_last_as_default)) { 608 607 lastValue.put(key, value); 609 608 } … … 681 680 public String delimiter = ";"; 682 681 public boolean delete_if_empty = false; 683 public boolean use_last_as_default = false;682 public String use_last_as_default = "false"; 684 683 public boolean required = false; 685 684 public long rows = -1; … … 722 721 } 723 722 724 if ( use_last_as_default&& def == null && lastValue.containsKey(key)) {723 if (!"false".equals(use_last_as_default) && def == null && lastValue.containsKey(key)) { 725 724 def = lastValue.get(key); 726 725 } … … 758 757 if (usage.hasUniqueValue() && !usage.unused()) { 759 758 originalValue=usage.getFirst(); 760 } 761 else if (def != null && !usage.hadKeys()) { 762 originalValue=def; 759 list.setSelectedItem(originalValue); 760 } 761 else if (def != null && !usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) { 762 originalValue=DIFFERENT; 763 list.setSelectedItem(def); 763 764 } 764 765 else if (usage.unused()) { 765 766 originalValue=null; 767 list.setSelectedItem(originalValue); 766 768 } 767 769 else { 768 770 originalValue=DIFFERENT; 769 }770 list.setSelectedItem(originalValue);771 list.setSelectedItem(originalValue); 772 } 771 773 772 774 if (locale_text == null) { … … 859 861 value = null; 860 862 } 861 if ( use_last_as_default) {863 if (!"false".equals(use_last_as_default)) { 862 864 lastValue.put(key, value); 863 865 }
Note:
See TracChangeset
for help on using the changeset viewer.