Changeset 4050 in josm for trunk/src/org
- Timestamp:
- 2011-04-20T18:42:29+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r3949 r4050 57 57 import org.openstreetmap.josm.data.osm.Tag; 58 58 import org.openstreetmap.josm.data.osm.Way; 59 import org.openstreetmap.josm.data.preferences.BooleanProperty; 59 60 import org.openstreetmap.josm.gui.ExtendedDialog; 60 61 import org.openstreetmap.josm.gui.MapView; … … 114 115 public final static String OPTIONAL_TOOLTIP_TEXT = "Optional tooltip text"; 115 116 private static File zipIcons = null; 117 private static final BooleanProperty PROP_FILL_DEFAULT = new BooleanProperty("taggingpreset.fill-default-for-tagged-primitives", false); 116 118 117 119 public static abstract class Item { … … 247 249 initAutoCompletionField(textField, key); 248 250 if (usage.unused()){ 249 if (use_last_as_default && lastValue.containsKey(key)) { 250 textField.setText(lastValue.get(key)); 251 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get()) { 252 // selected osm primitives are untagged or filling default values feature is enabled 253 if (use_last_as_default && lastValue.containsKey(key)) { 254 textField.setText(lastValue.get(key)); 255 } else { 256 textField.setText(default_); 257 } 251 258 } else { 252 textField.setText(default_); 259 // selected osm primitives are tagged and filling default values feature is disabled 260 textField.setText(""); 253 261 } 254 262 value = textField; … … 337 345 } 338 346 if (usage.values.size() < 2 && (oneValue == null || value_on.equals(oneValue) || value_off.equals(oneValue))) { 339 if (def)340 {347 if (def && !PROP_FILL_DEFAULT.get()) { 348 // default is set and filling default values feature is disabled - check if all primitives are untagged 341 349 for (OsmPrimitive s : sel) 342 350 if(s.hasKeys()) { … … 488 496 combo.setEditor(tf); 489 497 490 if (usage.hasUniqueValue() && !usage.unused()){ 498 if (usage.hasUniqueValue()) { 499 // all items have the same value (and there were no unset items) 491 500 originalValue=lhm.get(usage.getFirst()); 492 } 493 // use default only in case it is a totally new entry 494 else if(def != null && !usage.hadKeys()) { 501 combo.setSelectedItem(originalValue); 502 } 503 else if (def != null && usage.unused()) { 504 // default is set and all items were unset 505 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get()) { 506 // selected osm primitives are untagged or filling default feature is enabled 507 combo.setSelectedItem(def); 508 } else { 509 // selected osm primitives are tagged and filling default feature is disabled 510 combo.setSelectedItem(""); 511 } 495 512 originalValue=lhm.get(DIFFERENT); 496 513 } 497 else if(usage.unused()){ 514 else if (usage.unused()) { 515 // all items were unset (and so is default) 498 516 originalValue=lhm.get(""); 499 } 500 else{ 517 combo.setSelectedItem(originalValue); 518 } 519 else { 501 520 originalValue=lhm.get(DIFFERENT); 502 }503 combo.setSelectedItem(originalValue);521 combo.setSelectedItem(originalValue); 522 } 504 523 505 524 if(locale_text == null) {
Note:
See TracChangeset
for help on using the changeset viewer.