Class TaggingPresetItem
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem
-
- Direct Known Subclasses:
CheckGroup
,ItemSeparator
,Roles
,Space
,TextItem
public abstract class TaggingPresetItem extends Object
Class that represents single part of a preset - one field or text label that is shown to user- Since:
- 6068
-
-
Field Summary
Fields Modifier and Type Field Description protected static BooleanProperty
DISPLAY_KEYS_AS_HINT
Display OSM keys as hintprivate static Map<String,Set<TaggingPresetType>>
TYPE_CACHE
-
Constructor Summary
Constructors Constructor Description TaggingPresetItem()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addCommands(List<Tag> changedTags)
Adds the new tags to apply to selected OSM primitives when the preset holding this item is applied.protected abstract boolean
addToPanel(JPanel p, TaggingPresetItemGuiSupport support)
Called byTaggingPreset.createPanel(java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive>)
during tagging preset panel creation.protected static String
fixPresetString(String s)
protected List<AutoCompletionItem>
getAllForKeys(List<String> keys)
Returns all cachedAutoCompletionItem
s for given keys.protected static String
getLocaleText(String text, String textContext, String defaultText)
protected static Set<TaggingPresetType>
getType(String types)
protected void
initAutoCompletionField(AutoCompletingTextField field, String... key)
protected void
initAutoCompletionField(AutoCompletingTextField field, List<String> keys)
static ImageIcon
loadImageIcon(String iconName, File zipIcons, Integer maxSize)
Loads a tagging preset iconstatic boolean
matches(Iterable<? extends TaggingPresetItem> data, Map<String,String> tags)
Determine whether the given preset items match the tagsBoolean
matches(Map<String,String> tags)
Tests whether the tags match this item.protected static Integer
parseInteger(String str)
-
-
-
Field Detail
-
TYPE_CACHE
private static final Map<String,Set<TaggingPresetType>> TYPE_CACHE
-
DISPLAY_KEYS_AS_HINT
protected static final BooleanProperty DISPLAY_KEYS_AS_HINT
Display OSM keys as hint
-
-
Constructor Detail
-
TaggingPresetItem
public TaggingPresetItem()
-
-
Method Detail
-
initAutoCompletionField
protected void initAutoCompletionField(AutoCompletingTextField field, String... key)
-
initAutoCompletionField
protected void initAutoCompletionField(AutoCompletingTextField field, List<String> keys)
-
getAllForKeys
protected List<AutoCompletionItem> getAllForKeys(List<String> keys)
Returns all cachedAutoCompletionItem
s for given keys.- Parameters:
keys
- retrieve the items for these keys- Returns:
- the currently cached items, sorted by priority and alphabet
- Since:
- 18221
-
addToPanel
protected abstract boolean addToPanel(JPanel p, TaggingPresetItemGuiSupport support)
Called byTaggingPreset.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.- Parameters:
p
- The panel where components must be addedsupport
- supporting class for creating the GUI- Returns:
true
if this item adds semantic tagging elements,false
otherwise.
-
addCommands
protected abstract void addCommands(List<Tag> changedTags)
Adds the new tags to apply to selected OSM primitives when the preset holding this item is applied.- Parameters:
changedTags
- The list of changed tags to modify if needed
-
matches
public Boolean matches(Map<String,String> tags)
Tests whether the tags match this item. Note that for a match, at least one positive and no negative is required.- Parameters:
tags
- the tags of anOsmPrimitive
- Returns:
true
if matches (positive),null
if neutral,false
if mismatches (negative).
-
getType
protected static Set<TaggingPresetType> getType(String types) throws SAXException
- Throws:
SAXException
-
fixPresetString
protected static String fixPresetString(String s)
-
getLocaleText
protected static String getLocaleText(String text, String textContext, String defaultText)
-
parseInteger
protected static Integer parseInteger(String str)
-
loadImageIcon
public static ImageIcon loadImageIcon(String iconName, File zipIcons, Integer maxSize)
Loads a tagging preset icon- Parameters:
iconName
- the icon namezipIcons
- zip file where the image is locatedmaxSize
- maximum image size (or null)- Returns:
- the requested image or null if the request failed
-
-