Class ComboMultiSelect

    • Field Detail

      • values

        public String values
        A list of entries. The list has to be separated by commas (for the Combo box) or by the specified delimiter (for the MultiSelect). If a value contains the delimiter, the delimiter may be escaped with a backslash. If a value contains a backslash, it must also be escaped with a backslash.
      • values_from

        public String values_from
        To use instead of values if the list of values has to be obtained with a Java method of this form:

        public static String[] getValues();

        The value must be: full.package.name.ClassName#methodName.

      • values_no_i18n

        public boolean values_no_i18n
        Disabled internationalisation for value to avoid mistakes, see #11696
      • values_sort

        public boolean values_sort
        Whether to sort the values, defaults to true.
      • display_values

        public String display_values
        A list of entries that is displayed to the user. Must be the same number and order of entries as values and editable must be false or not specified. For the delimiter character and escaping, see the remarks at values.
      • short_descriptions

        public String short_descriptions
        A delimiter-separated list of texts to be displayed below each display_value. (Only if it is not possible to describe the entry in 2-3 words.) Instead of comma separated list instead using values, display_values and short_descriptions, the following form is also supported:

        <list_entry value="" display_value="" short_description="" icon="" icon_size="" />

      • default_

        public String default_
        The default value for the item. If not specified, the current value of the key is chosen as default (if applicable).
      • delimiter

        public char delimiter
        The character that separates values. In case of Combo the default is comma. In case of MultiSelect the default is semicolon and this will also be used to separate selected values in the tag.
      • use_last_as_default

        public byte use_last_as_default
        whether the last value is used as default. Using "force" (2) enforces this behaviour also for already tagged objects. Default is "false" (0).
      • presetListEntries

        protected final List<PresetListEntry> presetListEntries
        The standard entries in the combobox dropdown or multiselect list. These entries are defined in defaultpresets.xml (or in other custom preset files).
    • Method Detail

      • splitEscaped

        public static List<StringsplitEscaped​(char delimiter,
                                                String s)
        allow escaped comma in comma separated list: "A\, B\, C,one\, two" --> ["A, B, C", "one, two"]
        Parameters:
        delimiter - the delimiter, e.g. a comma. separates the entries and must be escaped within one entry
        s - the string
        Returns:
        splitted items
      • getSelectedItem

        protected abstract PresetListEntry getSelectedItem()
        Returns the value selected in the combobox or a synthetic value if a multiselect.
        Returns:
        the value
      • addLabel

        protected JLabel addLabel​(JPanel p)
        Adds the label to the panel
        Parameters:
        p - the panel
        Returns:
        the label
      • checkListsSameLength

        private List<StringcheckListsSameLength​(List<String> a,
                                                  List<String> b,
                                                  String name)
        Checks if list a is either null or the same length as list b.
        Parameters:
        a - The list to check
        b - The other list
        name - The name of the list for error reporting
        Returns:
        a if both lists have the same length or null
      • getInitialValue

        protected String getInitialValue​(KeyedItem.Usage usage,
                                         TaggingPresetItemGuiSupport support)
        Returns the initial value to use for this preset.

        The initial value is the value shown in the control when the preset dialog opens. For a discussion of all the options see the enclosed tickets.

        Parameters:
        usage - The key Usage
        support - The support
        Returns:
        The initial value to use.
        See Also:
        "https://josm.openstreetmap.de/ticket/5564", "https://josm.openstreetmap.de/ticket/12733", "https://josm.openstreetmap.de/ticket/17324"
      • addCommands

        public void addCommands​(List<Tag> changedTags)
        Description copied from class: TaggingPresetItem
        Adds the new tags to apply to selected OSM primitives when the preset holding this item is applied.
        Overrides:
        addCommands in class TextItem
        Parameters:
        changedTags - The list of changed tags to modify if needed
      • setUse_last_as_default

        public void setUse_last_as_default​(String v)
        Sets whether the last value is used as default.
        Parameters:
        v - Using "force" (2) enforces this behaviour also for already tagged objects. Default is "false" (0).
      • isUseLastAsDefault

        protected boolean isUseLastAsDefault()
        Returns true if the last entered value should be used as default.

        Note: never used in defaultpresets.xml.

        Returns:
        true if the last entered value should be used as default.
      • isForceUseLastAsDefault

        protected boolean isForceUseLastAsDefault()
        Returns true if the last entered value should be used as default also on primitives that already have tags.

        Note: used for addr:* tags in defaultpresets.xml.

        Returns:
        true if see above