Class SourceEntry
java.lang.Object
org.openstreetmap.josm.data.preferences.sources.SourceEntry
- Direct Known Subclasses:
ExtendedSourceEntry,StyleSource
A source entry primarily used to save the user's selection of mappaint styles,
but also for preset sources or validator rules.
- Since:
- 12649 (moved from gui.preferences package), 3796
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanactive is a boolean flag that can be used to turn the source on or off at runtime.booleanIndicates, thaturlis a zip file and the resource is inside the zip file.Name is used as a namespace for color preferences and (currently) only one file with a name can be loaded at a time.A title that can be used as menu entry.final SourceTypeThe type of source entry.A URL can be anything that CachedFile understands, i.e.IfisZipis true, denotes the path inside the zip file. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newSourceEntry.SourceEntry(SourceType type, String url, boolean isZip, String zipEntryPath, String name, String title, boolean active) Constructs a newSourceEntry.SourceEntry(SourceType type, String url, String name, String title, boolean active) Constructs a newSourceEntry. -
Method Summary
Modifier and TypeMethodDescriptionbooleanString to show in menus and error messages.Extracts file part from url, e.g.:http://www.test.com/file.xml?format=text → file.xmlReturn the source directory, only for local files.the name / identifier that should be used to save custom color values and similar stuff to the preference fileReturns the parent directory of the resource inside the zip file.inthashCode()booleanisLocal()Determines if this source denotes a file on a local filesystem.toString()
-
Field Details
-
type
The type of source entry.- Since:
- 12825
-
url
A URL can be anything that CachedFile understands, i.e. a local file, http://, or a file from the current jar -
isZip
Indicates, thaturlis a zip file and the resource is inside the zip file. -
zipEntryPath
IfisZipis true, denotes the path inside the zip file. -
name
Name is used as a namespace for color preferences and (currently) only one file with a name can be loaded at a time. Additional styles must either have the same name as the main style or no name at all. If no name is provided, it will be set to the default value "standard". The name can also be given in the xml file as attribute for the rules tag. (This overrides the name given in the preferences, otherwise both methods are equivalent.) -
title
A title that can be used as menu entry. -
active
active is a boolean flag that can be used to turn the source on or off at runtime.
-
-
Constructor Details
-
SourceEntry
public SourceEntry(SourceType type, String url, boolean isZip, String zipEntryPath, String name, String title, boolean active) Constructs a newSourceEntry.- Parameters:
type- type of source entryurl- URL thatCachedFileunderstandsisZip- if url is a zip file and the resource is inside the zip filezipEntryPath- IfisZipistrue, denotes the path inside the zip filename- Source nametitle- title that can be used as menu entryactive- boolean flag that can be used to turn the source on or off at runtime- Since:
- 12825
- See Also:
-
SourceEntry
Constructs a newSourceEntry.- Parameters:
type- type of source entryurl- URL thatCachedFileunderstandsname- Source nametitle- title that can be used as menu entryactive- boolean flag that can be used to turn the source on or off at runtime- Since:
- 12825
- See Also:
-
SourceEntry
Constructs a newSourceEntry.- Parameters:
e- existing source entry to copy
-
-
Method Details
-
equals
-
hashCode
-
toString
-
getDisplayString
String to show in menus and error messages.- Returns:
- Usually the shortdescription, but can be the file name if no shortdescription is available.
-
getFileNamePart
Extracts file part from url, e.g.:http://www.test.com/file.xml?format=text → file.xml- Returns:
- The filename part of the URL
-
getPrefName
the name / identifier that should be used to save custom color values and similar stuff to the preference file- Returns:
- the identifier; never null. Usually the result is "standard"
-
isLocal
Determines if this source denotes a file on a local filesystem.- Returns:
trueif the source is a local file
-
getLocalSourceDir
Return the source directory, only for local files.- Returns:
- The source directory, or
nullif this file isn't local, or does not have a parent - Since:
- 7276
-
getZipEntryDirName
Returns the parent directory of the resource inside the zip file.- Returns:
- the parent directory of the resource inside the zip file, "." if zipEntryPath is a top level file; null, if zipEntryPath is null
-