Changeset 6437 in josm for trunk


Ignore:
Timestamp:
2013-12-04T22:20:16+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #9354 - Add source key to autocompletion box in add/edit tag dialog

Location:
trunk/src/org/openstreetmap/josm/gui/tagging
Files:
5 edited
1 moved

Legend:

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

    r6425 r6437  
    4949import org.openstreetmap.josm.data.preferences.BooleanProperty;
    5050import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    51 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPritority;
     51import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPriority;
    5252import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
    5353import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     
    11691169            AutoCompletionList acList = tf.getAutoCompletionList();
    11701170            if (acList != null) {
    1171                 acList.add(getDisplayValues(), AutoCompletionItemPritority.IS_IN_STANDARD);
     1171                acList.add(getDisplayValues(), AutoCompletionItemPriority.IS_IN_STANDARD);
    11721172            }
    11731173            combo.setEditor(tf);
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java

    r6380 r6437  
    230230                }
    231231            }
    232             super.setSelectedItem(new AutoCompletionListItem(s, AutoCompletionItemPritority.UNKNOWN));
     232            super.setSelectedItem(new AutoCompletionListItem(s, AutoCompletionItemPriority.UNKNOWN));
    233233        } else
    234234            throw new IllegalArgumentException();
     
    243243        model.removeAllElements();
    244244        for (String elem : elems) {
    245             model.addElement(new AutoCompletionListItem(elem, AutoCompletionItemPritority.UNKNOWN));
     245            model.addElement(new AutoCompletionListItem(elem, AutoCompletionItemPriority.UNKNOWN));
    246246        }
    247247        // disable autocomplete to prevent unnecessary actions in
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionItemPriority.java

    r6435 r6437  
    88 * Instances of this class are not modifiable.
    99 */
    10 public class AutoCompletionItemPritority implements Comparable<AutoCompletionItemPritority> {
     10public class AutoCompletionItemPriority implements Comparable<AutoCompletionItemPriority> {
    1111
    1212    /**
     
    1515     * usually not used by the user.
    1616     */
    17     public static final AutoCompletionItemPritority IS_IN_STANDARD_AND_IN_DATASET = new AutoCompletionItemPritority(true, true, false);
     17    public static final AutoCompletionItemPriority IS_IN_STANDARD_AND_IN_DATASET = new AutoCompletionItemPriority(true, true, false);
    1818
    1919    /**
     
    2121     * the value of a tag name=*.
    2222     */
    23     public static final AutoCompletionItemPritority IS_IN_DATASET = new AutoCompletionItemPritority(true, false, false);
     23    public static final AutoCompletionItemPriority IS_IN_DATASET = new AutoCompletionItemPriority(true, false, false);
    2424
    2525    /**
     
    2727     * or a standard value for a given tag name (from the presets).
    2828     */
    29     public static final AutoCompletionItemPritority IS_IN_STANDARD = new AutoCompletionItemPritority(false, true, false);
     29    public static final AutoCompletionItemPriority IS_IN_STANDARD = new AutoCompletionItemPriority(false, true, false);
    3030
    3131    /**
    3232     * Indicates that this is a value from a selected object.
    3333     */
    34     public static final AutoCompletionItemPritority  IS_IN_SELECTION  = new AutoCompletionItemPritority(false, false, true);
     34    public static final AutoCompletionItemPriority  IS_IN_SELECTION  = new AutoCompletionItemPriority(false, false, true);
    3535
    3636    /** Unknown priority. This is the lowest priority. */
    37     public static final AutoCompletionItemPritority UNKNOWN = new AutoCompletionItemPritority(false, false, false);
     37    public static final AutoCompletionItemPriority UNKNOWN = new AutoCompletionItemPriority(false, false, false);
    3838
    3939    private final boolean inDataSet;
     
    4141    private final boolean selected;
    4242
    43     public AutoCompletionItemPritority(boolean inDataSet, boolean inStandard, boolean selected) {
     43    public AutoCompletionItemPriority(boolean inDataSet, boolean inStandard, boolean selected) {
    4444        this.inDataSet = inDataSet;
    4545        this.inStandard = inStandard;
     
    6464     */
    6565    @Override
    66     public int compareTo(AutoCompletionItemPritority other) {
     66    public int compareTo(AutoCompletionItemPriority other) {
    6767        int sel = Boolean.valueOf(selected).compareTo(other.selected);
    6868        if (sel != 0) return sel;
     
    8181     * The resulting priority is always >= the original ones.
    8282     */
    83     public AutoCompletionItemPritority mergeWith(AutoCompletionItemPritority other) {
    84         return new AutoCompletionItemPritority(
     83    public AutoCompletionItemPriority mergeWith(AutoCompletionItemPriority other) {
     84        return new AutoCompletionItemPriority(
    8585                inDataSet || other.inDataSet,
    8686                inStandard || other.inStandard,
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java

    r6317 r6437  
    135135     * @param priority the priority to use
    136136     */
    137     public void add(Collection<String> values, AutoCompletionItemPritority priority) {
     137    public void add(Collection<String> values, AutoCompletionItemPriority priority) {
    138138        if (values == null) return;
    139139        for (String value: values) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java

    r6084 r6437  
    1010 *  in an auto completion list for tag names, standard tag names would be assigned a higher
    1111 *  priority than arbitrary tag names present in the current data set. There are three priority levels,
    12  *  {@link AutoCompletionItemPritority}.
     12 *  {@link AutoCompletionItemPriority}.
    1313 *
    1414 * The value is a string which will be displayed in the auto completion list.
     
    1818
    1919    /** the pritority of this item */
    20     private  AutoCompletionItemPritority priority;
     20    private  AutoCompletionItemPriority priority;
    2121    /** the value of this item */
    2222    private String value;
    2323
    2424    /**
    25      * constructor
     25     * Constructs a new {@code AutoCompletionListItem} with the given value and priority.
     26     * @param value The value
     27     * @param priority The priority
    2628     */
    27     public AutoCompletionListItem(String value, AutoCompletionItemPritority priority) {
     29    public AutoCompletionListItem(String value, AutoCompletionItemPriority priority) {
    2830        this.value = value;
    2931        this.priority = priority;
    3032    }
    3133
     34    /**
     35     * Constructs a new {@code AutoCompletionListItem} with the given value and unknown priority.
     36     * @param value The value
     37     */
    3238    public AutoCompletionListItem(String value) {
    3339        this.value = value;
    34         priority = AutoCompletionItemPritority.UNKNOWN;
     40        priority = AutoCompletionItemPriority.UNKNOWN;
    3541    }
    3642
     43    /**
     44     * Constructs a new {@code AutoCompletionListItem}.
     45     */
    3746    public AutoCompletionListItem() {
    3847        value = "";
    39         priority = AutoCompletionItemPritority.UNKNOWN;
     48        priority = AutoCompletionItemPriority.UNKNOWN;
    4049    }
    4150
    42 
    4351    /**
    44      *
     52     * Returns the priority.
    4553     * @return the priority
    4654     */
    47     public AutoCompletionItemPritority getPriority() {
     55    public AutoCompletionItemPriority getPriority() {
    4856        return priority;
    4957    }
    5058
    5159    /**
    52      * sets the priority
     60     * Sets the priority.
    5361     * @param priority  the priority
    5462     */
    55     public void setPriority(AutoCompletionItemPritority priority) {
     63    public void setPriority(AutoCompletionItemPriority priority) {
    5664        this.priority = priority;
    5765    }
    5866
    5967    /**
    60      *
     68     * Returns the value.
    6169     * @return the value
    6270     */
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r6248 r6437  
    216216     */
    217217    public void populateWithMemberRoles(AutoCompletionList list) {
    218         list.add(presetRoleCache, AutoCompletionItemPritority.IS_IN_STANDARD);
    219         list.add(getRoleCache(), AutoCompletionItemPritority.IS_IN_DATASET);
    220     }
    221 
    222     /**
    223      * Populates the an {@link AutoCompletionList} with the currently cached
    224      * tag keys
     218        list.add(presetRoleCache, AutoCompletionItemPriority.IS_IN_STANDARD);
     219        list.add(getRoleCache(), AutoCompletionItemPriority.IS_IN_DATASET);
     220    }
     221
     222    /**
     223     * Populates the an {@link AutoCompletionList} with the currently cached tag keys
    225224     *
    226225     * @param list the list to populate
    227226     */
    228227    public void populateWithKeys(AutoCompletionList list) {
    229         list.add(getPresetKeys(), AutoCompletionItemPritority.IS_IN_STANDARD);
    230         list.add(getDataKeys(), AutoCompletionItemPritority.IS_IN_DATASET);
     228        list.add(getPresetKeys(), AutoCompletionItemPriority.IS_IN_STANDARD);
     229        list.add(new AutoCompletionListItem("source", AutoCompletionItemPriority.IS_IN_STANDARD));
     230        list.add(getDataKeys(), AutoCompletionItemPriority.IS_IN_DATASET);
    231231    }
    232232
     
    251251    public void populateWithTagValues(AutoCompletionList list, List<String> keys) {
    252252        for (String key : keys) {
    253             list.add(getPresetValues(key), AutoCompletionItemPritority.IS_IN_STANDARD);
    254             list.add(getDataValues(key), AutoCompletionItemPritority.IS_IN_DATASET);
     253            list.add(getPresetValues(key), AutoCompletionItemPriority.IS_IN_STANDARD);
     254            list.add(getDataValues(key), AutoCompletionItemPriority.IS_IN_DATASET);
    255255        }
    256256    }
Note: See TracChangeset for help on using the changeset viewer.