public class NamedColorProperty extends AbstractProperty<java.awt.Color>
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.AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T>| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
category |
static java.lang.String |
COLOR_CATEGORY_GENERAL |
static java.lang.String |
COLOR_CATEGORY_LAYER |
static java.lang.String |
COLOR_CATEGORY_MAPPAINT |
private java.lang.String |
name |
static java.lang.String |
NAMED_COLOR_PREFIX |
private java.lang.String |
source |
defaultValue, key, preferences| Constructor and Description |
|---|
NamedColorProperty(java.lang.String name,
java.awt.Color defaultValue)
Construct a new
NamedColorProperty. |
NamedColorProperty(java.lang.String category,
java.lang.String source,
java.lang.String name,
java.awt.Color defaultValue)
Construct a new
NamedColorProperty. |
| Modifier and Type | Method and Description |
|---|---|
java.awt.Color |
get()
Replies the value of this property.
|
java.lang.String |
getCategory()
Get the category for this color.
|
FallbackProperty<java.awt.Color> |
getChildColor(java.lang.String name)
Return a more specialized color, that will fall back to this color, if not set explicitly.
|
FallbackProperty<java.awt.Color> |
getChildColor(java.lang.String category,
java.lang.String source,
java.lang.String name)
Return a more specialized color, that will fall back to this color, if not set explicitly.
|
private java.util.List<java.lang.String> |
getDefaultValuePref() |
private static java.lang.String |
getKey(java.lang.String category,
java.lang.String source,
java.lang.String name) |
java.lang.String |
getName()
Get the color name (a short description of the color).
|
java.lang.String |
getSource()
Get the source, i.e. a filename or layer name associated with the color.
|
private static java.util.List<java.lang.String> |
getValuePref(java.awt.Color color,
java.lang.String category,
java.lang.String source,
java.lang.String name) |
boolean |
isSet()
Determines if this property is currently set in JOSM preferences.
|
boolean |
put(java.awt.Color value)
Sets this property to the specified value.
|
addListener, addListenerImpl, addWeakListener, cached, equals, getDefaultValue, getKey, getPreferences, hashCode, remove, removeListener, removeListenerImpl, storeDefaultValuepublic static final java.lang.String NAMED_COLOR_PREFIX
public static final java.lang.String COLOR_CATEGORY_GENERAL
public static final java.lang.String COLOR_CATEGORY_MAPPAINT
public static final java.lang.String COLOR_CATEGORY_LAYER
private final java.lang.String category
private final java.lang.String source
private final java.lang.String name
public NamedColorProperty(java.lang.String category, java.lang.String source, java.lang.String name, java.awt.Color defaultValue)
NamedColorProperty.category - a category, can be any identifier, but the following values are recognized by
the GUI preferences: COLOR_CATEGORY_GENERAL, COLOR_CATEGORY_MAPPAINT and
COLOR_CATEGORY_LAYERsource - 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 nullpublic NamedColorProperty(java.lang.String name, java.awt.Color defaultValue)
NamedColorProperty.name - a short description of the colordefaultValue - the default value, can be nullprivate static java.lang.String getKey(java.lang.String category, java.lang.String source, java.lang.String name)
private java.util.List<java.lang.String> getDefaultValuePref()
public java.awt.Color get()
AbstractPropertyget in class AbstractProperty<java.awt.Color>public boolean isSet()
AbstractPropertyisSet in class AbstractProperty<java.awt.Color>getPreferences() contains this property.public java.lang.String getCategory()
public java.lang.String getSource()
public java.lang.String getName()
private static java.util.List<java.lang.String> getValuePref(java.awt.Color color, java.lang.String category, java.lang.String source, java.lang.String name)
public boolean put(java.awt.Color value)
AbstractPropertyput in class AbstractProperty<java.awt.Color>value - The new value of this propertypublic FallbackProperty<java.awt.Color> getChildColor(java.lang.String category, java.lang.String source, java.lang.String name)
category - the category of the specialized colorsource - the source of the specialized colorname - the name of the specialized colorFallbackProperty that will the return the specialized color, if set, but
fall back to this property as default valuepublic FallbackProperty<java.awt.Color> getChildColor(java.lang.String name)
name - the name of the specialized colorFallbackProperty that will the return the specialized color, if set, but
fall back to this property as default value