Class TaggingPresetReader
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader
-
public final class TaggingPresetReader extends Object
The tagging presets reader.- Since:
- 6068
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TaggingPresetReader.Chunk
Holds a reference to a chunk of items/objects.(package private) static class
TaggingPresetReader.HashSetWithLast<E>
static class
TaggingPresetReader.Reference
Holds a reference to an earlier item/object.
-
Field Summary
Fields Modifier and Type Field Description private static boolean
loadIcons
static String
NAMESPACE
The XML namespace for the tagging presetsstatic String
PRESET_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.static String
SCHEMA_SOURCE
The internal resource URL of the XML schema file to be used withCachedFile
private static File
zipIcons
-
Constructor Summary
Constructors Modifier Constructor Description private
TaggingPresetReader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static XmlObjectParser
buildParser()
static Set<String>
getPresetSources()
Returns the set of preset source URLs.static File
getZipIcons()
Returns the zip file where the icons are locatedstatic boolean
isLoadIcons()
Determines if icon images should be loaded.static Collection<TaggingPreset>
readAll(Reader in, boolean validate)
Reads all tagging presets from the input reader.(package private) static Collection<TaggingPreset>
readAll(Reader in, boolean validate, TaggingPresetReader.HashSetWithLast<TaggingPreset> all)
Reads all tagging presets from the input reader.static Collection<TaggingPreset>
readAll(String source, boolean validate)
Reads all tagging presets from the given source.(package private) static Collection<TaggingPreset>
readAll(String source, boolean validate, TaggingPresetReader.HashSetWithLast<TaggingPreset> all)
Reads all tagging presets from the given source.static Collection<TaggingPreset>
readAll(Collection<String> sources, boolean validate)
Reads all tagging presets from the given sources.static Collection<TaggingPreset>
readAll(Collection<String> sources, boolean validate, boolean displayErrMsg)
Reads all tagging presets from the given sources.static Collection<TaggingPreset>
readFromPreferences(boolean validate, boolean displayErrMsg)
Reads all tagging presets from sources stored in preferences.static void
setLoadIcons(boolean loadIcons)
Sets whether icon images should be loaded.
-
-
-
Field Detail
-
PRESET_MIME_TYPES
public static final String PRESET_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.- Since:
- 6867
- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
The XML namespace for the tagging presets- Since:
- 16640
-
SCHEMA_SOURCE
public static final String SCHEMA_SOURCE
The internal resource URL of the XML schema file to be used withCachedFile
- Since:
- 16640
- See Also:
- Constant Field Values
-
loadIcons
private static volatile boolean loadIcons
-
-
Constructor Detail
-
TaggingPresetReader
private TaggingPresetReader()
-
-
Method Detail
-
getPresetSources
public static Set<String> getPresetSources()
Returns the set of preset source URLs.- Returns:
- The set of preset source URLs.
-
buildParser
private static XmlObjectParser buildParser()
-
readAll
public static Collection<TaggingPreset> readAll(Reader in, boolean validate) throws SAXException
Reads all tagging presets from the input reader.- Parameters:
in
- The input readervalidate
- iftrue
, XML validation will be performed- Returns:
- collection of tagging presets
- Throws:
SAXException
- if any XML error occurs
-
readAll
static Collection<TaggingPreset> readAll(Reader in, boolean validate, TaggingPresetReader.HashSetWithLast<TaggingPreset> all) throws SAXException
Reads all tagging presets from the input reader.- Parameters:
in
- The input readervalidate
- iftrue
, XML validation will be performedall
- the accumulator for parsed tagging presets- Returns:
- the accumulator
- Throws:
SAXException
- if any XML error occurs
-
readAll
public static Collection<TaggingPreset> readAll(String source, boolean validate) throws SAXException, IOException
Reads all tagging presets from the given source.- Parameters:
source
- a given filename, URL or internal resourcevalidate
- iftrue
, XML validation will be performed- Returns:
- collection of tagging presets
- Throws:
SAXException
- if any XML error occursIOException
- if any I/O error occurs
-
readAll
static Collection<TaggingPreset> readAll(String source, boolean validate, TaggingPresetReader.HashSetWithLast<TaggingPreset> all) throws SAXException, IOException
Reads all tagging presets from the given source.- Parameters:
source
- a given filename, URL or internal resourcevalidate
- iftrue
, XML validation will be performedall
- the accumulator for parsed tagging presets- Returns:
- the accumulator
- Throws:
SAXException
- if any XML error occursIOException
- if any I/O error occurs
-
readAll
public static Collection<TaggingPreset> readAll(Collection<String> sources, boolean validate)
Reads all tagging presets from the given sources.- Parameters:
sources
- Collection of tagging presets sources.validate
- iftrue
, presets will be validated against XML schema- Returns:
- Collection of all presets successfully read
-
readAll
public static Collection<TaggingPreset> readAll(Collection<String> sources, boolean validate, boolean displayErrMsg)
Reads all tagging presets from the given sources.- Parameters:
sources
- Collection of tagging presets sources.validate
- iftrue
, presets will be validated against XML schemadisplayErrMsg
- iftrue
, a blocking error message is displayed in case of I/O exception.- Returns:
- Collection of all presets successfully read
-
readFromPreferences
public static Collection<TaggingPreset> readFromPreferences(boolean validate, boolean displayErrMsg)
Reads all tagging presets from sources stored in preferences.- Parameters:
validate
- iftrue
, presets will be validated against XML schemadisplayErrMsg
- iftrue
, a blocking error message is displayed in case of I/O exception.- Returns:
- Collection of all presets successfully read
-
getZipIcons
public static File getZipIcons()
Returns the zip file where the icons are located- Returns:
- the zip file where the icons are located
-
isLoadIcons
public static boolean isLoadIcons()
Determines if icon images should be loaded.- Returns:
true
if icon images should be loaded
-
setLoadIcons
public static void setLoadIcons(boolean loadIcons)
Sets whether icon images should be loaded.- Parameters:
loadIcons
-true
if icon images should be loaded
-
-