Class NamedColorProperty
java.lang.Object
org.openstreetmap.josm.data.preferences.AbstractProperty<T>
org.openstreetmap.josm.data.preferences.AbstractToStringProperty<Color>
org.openstreetmap.josm.data.preferences.NamedColorProperty
A property containing a
Color value with additional information associated to it.
The additional information is used to describe the color in the
ColorPreference, so it can be recognized
and customized by the user.- Since:
- 12987
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractToStringProperty
AbstractToStringProperty.ChildProperty<T>Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringstatic final Stringstatic final Stringprivate final Stringstatic final Stringprivate final StringFields inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
defaultValue, key, preferences -
Constructor Summary
ConstructorsConstructorDescriptionNamedColorProperty(String name, Color defaultValue) Construct a newNamedColorProperty.NamedColorProperty(String category, String source, String name, Color defaultValue) Construct a newNamedColorProperty. -
Method Summary
Modifier and TypeMethodDescriptionprotected ColorfromString(String string) Converts the string to an object of the given type.get()Replies the value of this property.Get the category for this color.getChildColor(String name) Return a more specialized color, that will fall back to this color, if not set explicitly.getChildColor(String category, String source, String name) Return a more specialized color, that will fall back to this color, if not set explicitly.private static StringgetName()Get the color name (a short description of the color).Get the source, i.e. a filename or layer name associated with the color.private static ColorgetUIColor(String uiKey, Color defaultValue) getValuePref(Color color, String category, String source, String name) booleanisSet()Determines if this property is currently set in JOSM preferences.booleanSets this property to the specified value.protected voidStore the default value to the preferences.protected StringConverts the string to an object of the given type.Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractToStringProperty
getAsString, getChildProperty, getSpecializedMethods inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
addListener, addListenerImpl, addWeakListener, cached, equals, getDefaultValue, getKey, getPreferences, hashCode, remove, removeListener, removeListenerImpl
-
Field Details
-
NAMED_COLOR_PREFIX
- See Also:
-
COLOR_CATEGORY_GENERAL
- See Also:
-
COLOR_CATEGORY_MAPPAINT
- See Also:
-
category
-
source
-
name
-
-
Constructor Details
-
NamedColorProperty
Construct a newNamedColorProperty. The priority for getting the color is: 1. a set property, 2.UIManager.getColor(java.lang.Object), 3. the givendefaultValue- Parameters:
category- a category, can be any identifier, but the following values are recognized by the GUI preferences:COLOR_CATEGORY_GENERALandCOLOR_CATEGORY_MAPPAINTsource- a filename or similar associated with the color, can be null if not applicablename- a short description of the colordefaultValue- the default value, can be null
-
NamedColorProperty
Construct a newNamedColorProperty.- Parameters:
name- a short description of the colordefaultValue- the default value, can be null
-
-
Method Details
-
getKey
-
getUIColor
-
getDefaultValuePref
-
storeDefaultValue
Description copied from class:AbstractPropertyStore the default value to the preferences.- Overrides:
storeDefaultValuein classAbstractProperty<Color>
-
get
Description copied from class:AbstractPropertyReplies the value of this property.- Overrides:
getin classAbstractToStringProperty<Color>- Returns:
- the value of this property
-
isSet
Description copied from class:AbstractPropertyDetermines if this property is currently set in JOSM preferences.- Overrides:
isSetin classAbstractProperty<Color>- Returns:
- true if
getPreferences()contains this property.
-
getCategory
Get the category for this color.- Returns:
- the category
-
getSource
Get the source, i.e. a filename or layer name associated with the color. May return null if not applicable.- Returns:
- the source
-
getName
Get the color name (a short description of the color).- Returns:
- the color name
-
getValuePref
-
put
Description copied from class:AbstractPropertySets this property to the specified value.- Overrides:
putin classAbstractToStringProperty<Color>- Parameters:
value- The new value of this property- Returns:
- true if something has changed (i.e. value is different than before)
-
getChildColor
Return a more specialized color, that will fall back to this color, if not set explicitly.- Parameters:
category- the category of the specialized colorsource- the source of the specialized colorname- the name of the specialized color- Returns:
- a
FallbackPropertythat will the return the specialized color, if set, but fall back to this property as default value
-
getChildColor
Return a more specialized color, that will fall back to this color, if not set explicitly.- Parameters:
name- the name of the specialized color- Returns:
- a
FallbackPropertythat will the return the specialized color, if set, but fall back to this property as default value
-
fromString
Description copied from class:AbstractToStringPropertyConverts the string to an object of the given type.- Specified by:
fromStringin classAbstractToStringProperty<Color>- Parameters:
string- The string- Returns:
- The object.
-
toString
Description copied from class:AbstractToStringPropertyConverts the string to an object of the given type.- Specified by:
toStringin classAbstractToStringProperty<Color>- Parameters:
color- The object.- Returns:
- The string representing the object
-