Changeset 7118 in josm for trunk/src


Ignore:
Timestamp:
2014-05-13T13:39:24+02:00 (11 years ago)
Author:
simon04
Message:

fix #9901 - Presets: add support for alternative_autocomplete_keys, esp. auto-complete addr:street also from name

Location:
trunk/src/org/openstreetmap/josm/gui/tagging
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java

    r6795 r7118  
    22package org.openstreetmap.josm.gui.tagging;
    33
     4import java.util.Arrays;
    45import java.util.Collection;
    56import java.util.List;
     
    2122public abstract class TaggingPresetItem {
    2223
    23     protected void initAutoCompletionField(AutoCompletingTextField field, String key) {
     24    protected void initAutoCompletionField(AutoCompletingTextField field, String... key) {
     25        initAutoCompletionField(field, Arrays.asList(key));
     26    }
     27
     28    protected void initAutoCompletionField(AutoCompletingTextField field, List<String> keys) {
    2429        if (Main.main == null) return;
    2530        OsmDataLayer layer = Main.main.getEditLayer();
     
    2833        }
    2934        AutoCompletionList list = new AutoCompletionList();
    30         layer.data.getAutoCompletionManager().populateWithTagValues(list, key);
     35        layer.data.getAutoCompletionManager().populateWithTagValues(list, keys);
    3136        field.setAutoCompletionList(list);
    3237    }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r7100 r7118  
    577577        public String auto_increment;
    578578        public String length;
     579        public String alternative_autocomplete_keys;
    579580
    580581        private JComponent value;
     
    585586            Usage usage = determineTextUsage(sel, key);
    586587            AutoCompletingTextField textField = new AutoCompletingTextField();
    587             initAutoCompletionField(textField, key);
     588            if (alternative_autocomplete_keys != null) {
     589                initAutoCompletionField(textField, (key + "," + alternative_autocomplete_keys).split(","));
     590            } else {
     591                initAutoCompletionField(textField, key);
     592            }
    588593            if (length != null && !length.isEmpty()) {
    589594                textField.setMaxChars(Integer.valueOf(length));
Note: See TracChangeset for help on using the changeset viewer.