Class KeyedItem
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem
-
- org.openstreetmap.josm.gui.tagging.presets.items.TextItem
-
- org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
KeyedItem.MatchType
Enum denoting how a match (seeTaggingPresetItem.matches(java.util.Map<java.lang.String, java.lang.String>)
) is performed.static class
KeyedItem.Usage
Usage information on a key TODO merge withTagCollection
-
Field Summary
Fields Modifier and Type Field Description protected static String
DIFFERENT
The constant value"<different>"
.protected static String
DIFFERENT_I18N
Translation of"<different>"
.String
key
This specifies the property key that will be modified by the item.(package private) static Map<String,String>
LAST_VALUES
Last value of each key used in presets, used for prefilling corresponding fieldsString
match
Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset.protected static BooleanProperty
PROP_FILL_DEFAULT
True if the default value should also be set on primitives that already have tags.-
Fields inherited from class org.openstreetmap.josm.gui.tagging.presets.items.TextItem
icon, icon_size, locale_text, text, text_context
-
Fields inherited from class org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem
DISPLAY_KEYS_AS_HINT
-
-
Constructor Summary
Constructors Constructor Description KeyedItem()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static KeyedItem.Usage
determineBooleanUsage(Collection<OsmPrimitive> sel, String key)
static KeyedItem.Usage
determineTextUsage(Collection<OsmPrimitive> sel, String key)
Computes the tag usage for the given key from the given primitivesabstract KeyedItem.MatchType
getDefaultMatch()
Returns the default match.protected String
getKeyTooltipText()
protected JPopupMenu
getPopupMenu()
abstract Collection<String>
getValues()
Returns the list of values.boolean
isKeyRequired()
Determines whether key or key+value are required.Boolean
matches(Map<String,String> tags)
Tests whether the tags match this item.String
toString()
-
Methods inherited from class org.openstreetmap.josm.gui.tagging.presets.items.TextItem
addCommands, addIcon, fieldsToString, getIcon, initializeLocaleText
-
Methods inherited from class org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem
addToPanel, fixPresetString, getAllForKeys, getLocaleText, getType, initAutoCompletionField, initAutoCompletionField, loadImageIcon, matches, parseInteger
-
-
-
-
Field Detail
-
DIFFERENT
protected static final String DIFFERENT
The constant value"<different>"
.- See Also:
- Constant Field Values
-
DIFFERENT_I18N
protected static final String DIFFERENT_I18N
Translation of"<different>"
.
-
PROP_FILL_DEFAULT
protected static final BooleanProperty PROP_FILL_DEFAULT
True if the default value should also be set on primitives that already have tags.
-
LAST_VALUES
static final Map<String,String> LAST_VALUES
Last value of each key used in presets, used for prefilling corresponding fields
-
match
public String match
Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the Tags/Membership dialog.- none: neutral, i.e., do not consider this item for matching
- key: positive if key matches, neutral otherwise
- key!: positive if key matches, negative otherwise
- keyvalue: positive if key and value matches, neutral otherwise
- keyvalue!: positive if key and value matches, negative otherwise
Key
and "none" forText
,Combo
,MultiSelect
andCheck
.
-
-
Constructor Detail
-
KeyedItem
public KeyedItem()
-
-
Method Detail
-
determineTextUsage
public static KeyedItem.Usage determineTextUsage(Collection<OsmPrimitive> sel, String key)
Computes the tag usage for the given key from the given primitives- Parameters:
sel
- the primitiveskey
- the key- Returns:
- the tag usage
-
determineBooleanUsage
protected static KeyedItem.Usage determineBooleanUsage(Collection<OsmPrimitive> sel, String key)
-
isKeyRequired
public boolean isKeyRequired()
Determines whether key or key+value are required.- Returns:
- whether key or key+value are required
-
getDefaultMatch
public abstract KeyedItem.MatchType getDefaultMatch()
Returns the default match.- Returns:
- the default match
-
getValues
public abstract Collection<String> getValues()
Returns the list of values.- Returns:
- the list of values
-
getKeyTooltipText
protected String getKeyTooltipText()
-
matches
public Boolean matches(Map<String,String> tags)
Description copied from class:TaggingPresetItem
Tests whether the tags match this item. Note that for a match, at least one positive and no negative is required.- Overrides:
matches
in classTaggingPresetItem
- Parameters:
tags
- the tags of anOsmPrimitive
- Returns:
true
if matches (positive),null
if neutral,false
if mismatches (negative).
-
getPopupMenu
protected JPopupMenu getPopupMenu()
-
-