public abstract class ComboMultiSelect extends KeyedItem
Modifier and Type | Class and Description |
---|---|
protected static class |
ComboMultiSelect.ConcatenatingJList
Class that allows list values to be assigned and retrieved as a comma-delimited
string (extracted from TaggingPreset)
|
static class |
ComboMultiSelect.PresetListEntry
Preset list entry.
|
private static class |
ComboMultiSelect.Renderer |
KeyedItem.MatchType, KeyedItem.Usage
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JComponent |
component |
java.lang.String |
default_
The default value for the item.
|
java.lang.String |
delimiter
The character that separates values.
|
java.lang.String |
display_values
A list of entries that is displayed to the user.
|
private boolean |
initialized |
protected java.util.Map<java.lang.String,ComboMultiSelect.PresetListEntry> |
lhm |
java.lang.String |
locale_display_values
The localized version of
display_values . |
java.lang.String |
locale_short_descriptions
The localized version of
short_descriptions . |
java.lang.String |
locale_text
The localized version of
KeyedItem.text . |
protected java.lang.Object |
originalValue |
private static ComboMultiSelect.Renderer |
RENDERER |
java.lang.String |
short_descriptions
A delimiter-separated list of texts to be displayed below each
display_value . |
protected KeyedItem.Usage |
usage |
java.lang.String |
use_last_as_default
whether the last value is used as default.
|
java.lang.String |
values
A list of entries.
|
java.lang.String |
values_context
The context used for translating
values |
java.lang.String |
values_from
To use instead of
values if the list of values has to be obtained with a Java method of this form: |
boolean |
values_no_i18n
Disabled internationalisation for value to avoid mistakes, see #11696
|
java.lang.String |
values_searchable
whether to use values for search via
TaggingPresetSelector |
boolean |
values_sort
Whether to sort the values, defaults to true.
|
DIFFERENT, key, LAST_VALUES, match, PROP_FILL_DEFAULT, text, text_context
Constructor and Description |
---|
ComboMultiSelect() |
Modifier and Type | Method and Description |
---|---|
void |
addCommands(java.util.List<Tag> changedTags)
Adds the new tags to apply to selected OSM primitives when the preset holding this item is applied.
|
void |
addListEntries(java.util.Collection<ComboMultiSelect.PresetListEntry> e)
Adds a collection of preset list entries.
|
void |
addListEntry(ComboMultiSelect.PresetListEntry e)
Adds a preset list entry.
|
boolean |
addToPanel(javax.swing.JPanel p,
java.util.Collection<OsmPrimitive> sel,
boolean presetInitiallyMatches)
Called by
TaggingPreset.createPanel(java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive>) during tagging preset panel creation. |
protected abstract void |
addToPanelAnchor(javax.swing.JPanel p,
java.lang.String def,
boolean presetInitiallyMatches) |
KeyedItem.MatchType |
getDefaultMatch()
Returns the default match.
|
protected char |
getDelChar() |
protected java.lang.String |
getDisplayIfNull() |
java.util.Collection<java.lang.String> |
getDisplayValues()
Returns the values to display.
|
protected javax.swing.ListCellRenderer<ComboMultiSelect.PresetListEntry> |
getListCellRenderer() |
protected abstract java.lang.Object |
getSelectedItem() |
java.util.Collection<java.lang.String> |
getValues()
Returns the list of values.
|
private void |
initListEntries() |
private void |
initListEntriesFromAttributes() |
static java.lang.String[] |
splitEscaped(char delimiter,
java.lang.String s)
allow escaped comma in comma separated list:
"A\, B\, C,one\, two" --> ["A, B, C", "one, two"]
|
determineBooleanUsage, determineTextUsage, getKeyTooltipText, matches, toString
fixPresetString, getLocaleText, getType, initAutoCompletionField, initAutoCompletionField, loadImageIcon, matches, parseInteger
private static final ComboMultiSelect.Renderer RENDERER
public java.lang.String locale_text
KeyedItem.text
.public java.lang.String values
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.public java.lang.String values_from
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
.
public java.lang.String values_context
values
public boolean values_no_i18n
public boolean values_sort
public java.lang.String display_values
public java.lang.String locale_display_values
display_values
.public java.lang.String short_descriptions
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="" />
public java.lang.String locale_short_descriptions
short_descriptions
.public java.lang.String default_
public java.lang.String delimiter
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.public java.lang.String use_last_as_default
public java.lang.String values_searchable
TaggingPresetSelector
protected javax.swing.JComponent component
protected final java.util.Map<java.lang.String,ComboMultiSelect.PresetListEntry> lhm
private boolean initialized
protected KeyedItem.Usage usage
protected java.lang.Object originalValue
public ComboMultiSelect()
public static java.lang.String[] splitEscaped(char delimiter, java.lang.String s)
delimiter
- the delimiter, e.g. a comma. separates the entries and
must be escaped within one entrys
- the stringprotected abstract java.lang.Object getSelectedItem()
protected abstract void addToPanelAnchor(javax.swing.JPanel p, java.lang.String def, boolean presetInitiallyMatches)
protected char getDelChar()
public java.util.Collection<java.lang.String> getValues()
KeyedItem
public java.util.Collection<java.lang.String> getDisplayValues()
public boolean addToPanel(javax.swing.JPanel p, java.util.Collection<OsmPrimitive> sel, boolean presetInitiallyMatches)
TaggingPresetItem
TaggingPreset.createPanel(java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive>)
during tagging preset panel creation.
All components defining this tagging preset item must be added to given panel.addToPanel
in class TaggingPresetItem
p
- The panel where components must be addedsel
- The related selected OSM primitivespresetInitiallyMatches
- Whether this TaggingPreset
already matched before applying,
i.e. whether the map feature already existed on the primitive.true
if this item adds semantic tagging elements, false
otherwise.private void initListEntries()
private void initListEntriesFromAttributes()
protected java.lang.String getDisplayIfNull()
public void addCommands(java.util.List<Tag> changedTags)
TaggingPresetItem
addCommands
in class TaggingPresetItem
changedTags
- The list of changed tags to modify if neededpublic void addListEntry(ComboMultiSelect.PresetListEntry e)
e
- list entry to addpublic void addListEntries(java.util.Collection<ComboMultiSelect.PresetListEntry> e)
e
- list entries to addprotected javax.swing.ListCellRenderer<ComboMultiSelect.PresetListEntry> getListCellRenderer()
public KeyedItem.MatchType getDefaultMatch()
KeyedItem
getDefaultMatch
in class KeyedItem