Class TaggingPresets
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.TaggingPresets
-
public final class TaggingPresets extends java.lang.Object
Class holding Tagging Presets and allowing to manage them.- Since:
- 7100
-
-
Field Summary
Fields Modifier and Type Field Description static ListProperty
ICON_SOURCES
Custom icon sourcesprivate static java.util.Collection<TaggingPresetListener>
listeners
The collection of listenersprivate static IntegerProperty
MIN_ELEMENTS_FOR_SCROLLER
private static java.util.Set<java.lang.String>
PRESET_ROLE_CACHE
cache for roles found in the presetprivate static MultiMap<java.lang.String,java.lang.String>
PRESET_TAG_CACHE
cache for key/value pairs found in the presetstatic BooleanProperty
SORT_MENU
Sort presets menu alphabeticallyprivate static java.util.List<TaggingPreset>
TAGGING_PRESETS
The collection of tagging presets
-
Constructor Summary
Constructors Modifier Constructor Description private
TaggingPresets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addListener(TaggingPresetListener listener)
Adds a tagging preset listener.static void
addTaggingPresets(java.util.Collection<TaggingPreset> presets)
Adds a list of tagging presets to the current list.private static void
cachePresetItem(TaggingPreset p, TaggingPresetItem item)
static void
cachePresets(java.util.Collection<TaggingPreset> presets)
Initialize the cache for presets.static void
destroy()
Call to deconstruct the TaggingPresets menus and other information so that it can be rebuilt later.static java.util.Collection<TaggingPreset>
getMatchingPresets(java.util.Collection<TaggingPresetType> t, java.util.Map<java.lang.String,java.lang.String> tags, boolean onlyShowable)
Replies a new collection of all presets matching the parameters.static java.util.Collection<TaggingPreset>
getMatchingPresets(IPrimitive primitive)
Replies a new collection of all presets matching the given preset.static java.util.Set<java.lang.String>
getPresetKeys()
Replies a set of all keys in the tagging presets.static java.util.Set<java.lang.String>
getPresetRoles()
Replies a set of all roles in the tagging presets.static java.util.Set<java.lang.String>
getPresetValues(java.lang.String key)
Return set of values for a key in the tagging presetsstatic java.util.Collection<TaggingPreset>
getTaggingPresets()
Replies a new collection containing all tagging presets.static void
initialize()
Initialize the tagging presets (load and may display error)static boolean
isKeyInPresets(java.lang.String key)
Determines if the given key is in the loaded presets.static void
readFromPreferences()
Initializes tagging presets from preferences.static void
removeListener(TaggingPresetListener listener)
Removes a tagging preset listener.
-
-
-
Field Detail
-
TAGGING_PRESETS
private static final java.util.List<TaggingPreset> TAGGING_PRESETS
The collection of tagging presets
-
PRESET_TAG_CACHE
private static final MultiMap<java.lang.String,java.lang.String> PRESET_TAG_CACHE
cache for key/value pairs found in the preset
-
PRESET_ROLE_CACHE
private static final java.util.Set<java.lang.String> PRESET_ROLE_CACHE
cache for roles found in the preset
-
listeners
private static final java.util.Collection<TaggingPresetListener> listeners
The collection of listeners
-
SORT_MENU
public static final BooleanProperty SORT_MENU
Sort presets menu alphabetically
-
ICON_SOURCES
public static final ListProperty ICON_SOURCES
Custom icon sources
-
MIN_ELEMENTS_FOR_SCROLLER
private static final IntegerProperty MIN_ELEMENTS_FOR_SCROLLER
-
-
Constructor Detail
-
TaggingPresets
private TaggingPresets()
-
-
Method Detail
-
readFromPreferences
public static void readFromPreferences()
Initializes tagging presets from preferences.
-
initialize
public static void initialize()
Initialize the tagging presets (load and may display error)
-
destroy
public static void destroy()
Call to deconstruct the TaggingPresets menus and other information so that it can be rebuilt later.- Since:
- 15582
-
cachePresets
public static void cachePresets(java.util.Collection<TaggingPreset> presets)
Initialize the cache for presets. This is done only once.- Parameters:
presets
- Tagging presets to cache
-
cachePresetItem
private static void cachePresetItem(TaggingPreset p, TaggingPresetItem item)
-
getTaggingPresets
public static java.util.Collection<TaggingPreset> getTaggingPresets()
Replies a new collection containing all tagging presets.- Returns:
- a new collection containing all tagging presets. Empty if presets are not initialized (never null)
-
getPresetRoles
public static java.util.Set<java.lang.String> getPresetRoles()
Replies a set of all roles in the tagging presets.- Returns:
- a set of all roles in the tagging presets.
-
getPresetKeys
public static java.util.Set<java.lang.String> getPresetKeys()
Replies a set of all keys in the tagging presets.- Returns:
- a set of all keys in the tagging presets.
-
getPresetValues
public static java.util.Set<java.lang.String> getPresetValues(java.lang.String key)
Return set of values for a key in the tagging presets- Parameters:
key
- the key- Returns:
- set of values for a key in the tagging presets
-
isKeyInPresets
public static boolean isKeyInPresets(java.lang.String key)
Determines if the given key is in the loaded presets.- Parameters:
key
- key- Returns:
true
if the given key in the loaded presets- Since:
- 18281
-
getMatchingPresets
public static java.util.Collection<TaggingPreset> getMatchingPresets(java.util.Collection<TaggingPresetType> t, java.util.Map<java.lang.String,java.lang.String> tags, boolean onlyShowable)
Replies a new collection of all presets matching the parameters.- Parameters:
t
- the preset types to includetags
- the tags to perform matching on, seeTaggingPresetItem.matches(Map)
onlyShowable
- whether onlyshowable
presets should be returned- Returns:
- a new collection of all presets matching the parameters.
- Since:
- 9266
- See Also:
TaggingPreset.matches(Collection, Map, boolean)
-
getMatchingPresets
public static java.util.Collection<TaggingPreset> getMatchingPresets(IPrimitive primitive)
Replies a new collection of all presets matching the given preset.- Parameters:
primitive
- the primitive- Returns:
- a new collection of all presets matching the given preset.
- Since:
- 13623 (signature)
- See Also:
TaggingPreset.test(IPrimitive)
-
addTaggingPresets
public static void addTaggingPresets(java.util.Collection<TaggingPreset> presets)
Adds a list of tagging presets to the current list.- Parameters:
presets
- The tagging presets to add
-
addListener
public static void addListener(TaggingPresetListener listener)
Adds a tagging preset listener.- Parameters:
listener
- The listener to add
-
removeListener
public static void removeListener(TaggingPresetListener listener)
Removes a tagging preset listener.- Parameters:
listener
- The listener to remove
-
-