Package generic.theme
Class GThemeValueMap
java.lang.Object
generic.theme.GThemeValueMap
- Direct Known Subclasses:
GTheme
Class for storing colors, fonts, and icons by id
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new empty map.GThemeValueMap
(GThemeValueMap initial) Constructs a new value map, populated by all the values in the given map. -
Method Summary
Modifier and TypeMethodDescriptionaddColor
(ColorValue value) Adds theColorValue
to the map.Adds theFontValue
to the map.Adds theIconValue
to the map.addProperty
(JavaPropertyValue value) Adds the given property value to this map.void
void
clear()
Clears all color, font, and icon values from this mapboolean
containsColor
(String id) Returns true if aColorValue
exists in this map for the given id.boolean
containsFont
(String id) Returns true if aFontValue
exists in this map for the given id.boolean
containsIcon
(String id) Returns true if anIconValue
exists in this map for the given id.boolean
Returns true if anJavaPropertyValue
exists in this map for the given id.boolean
Returns a newGThemeValueMap
that is only populated by values that don't exist in the give map.Returns the currentColorValue
for the given id or null if none exists.Returns the set of all color ids in this mapReturns a list of all theColorValue
s stored in this map.Gets the set of icon (.png, .gif) files that are used by IconValues that came from files versus resources in the classpath.Returns the currentFontValue
for the given id or null if none exists.Returns the set of all font ids in this mapgetFonts()
Returns a list of all theFontValue
s stored in this map.Returns the currentIconValue
for the given id or null if none exists.Returns the set of all icon ids in this mapgetIcons()
Returns a list of all theIconValue
s stored in this map.Returns a list of all theJavaPropertyValue
s stored in this map.getProperty
(String id) Returns the currentJavaPropertyValue
for the given id or null if none exists.Returns the set of all Java property ids in this mapReturns the resolved color, following indirections as needed to get the color ultimately assigned to the given id.Returns the resolved font, following indirections as needed to get the font ultimately assigned to the given id.Returns the resolved icon, following indirections as needed to get the icon ultimately assigned to the given id.Returns the resolved property, following indirections as needed to get the property ultimately assigned to the given id.int
hashCode()
boolean
isEmpty()
Returns true if there are not color, font, icon or property values in this mapvoid
load
(GThemeValueMap valueMap) Loads all the values from the given map into this map, replacing values with the same ids.void
removeColor
(String id) removes anyColorValue
with the given id from this map.void
removeFont
(String id) removes anyFontValue
with the given id from this map.void
removeIcon
(String id) removes anyIconValue
with the given id from this map.void
removeProperty
(String id) removes anyJavaPropertyValue
with the given id from this map.size()
Returns the total number of color, font, icon and property values stored in this map
-
Field Details
-
colorMap
-
fontMap
-
iconMap
-
propertyMap
-
-
Constructor Details
-
GThemeValueMap
public GThemeValueMap()Constructs a new empty map. -
GThemeValueMap
Constructs a new value map, populated by all the values in the given map. Essentially clones the given map.- Parameters:
initial
- the set of values to initialize to
-
-
Method Details
-
addColor
Adds theColorValue
to the map. If a ColorValue already exists in the map with the same id, it will be replaced- Parameters:
value
- theColorValue
to store in the map.- Returns:
- the previous value for the color key or null if no previous value existed
-
addFont
Adds theFontValue
to the map. If a FontValue already exists in the map with the same id, it will be replaced- Parameters:
value
- theFontValue
to store in the map.- Returns:
- the previous value for the font key or null if no previous value existed
-
addIcon
Adds theIconValue
to the map. If a IconValue already exists in the map with the same id, it will be replaced- Parameters:
value
- theIconValue
to store in the map.- Returns:
- the previous value for the icon key or null if no previous value existed
-
addProperty
Adds the given property value to this map. If a property value already exists in the map with the same id, it will be replaced.- Parameters:
value
- theJavaPropertyValue
to store in the map.- Returns:
- the previous value for the icon key or null if no previous value existed.
-
getColor
Returns the currentColorValue
for the given id or null if none exists.- Parameters:
id
- the id to look up a color for- Returns:
- the current
ColorValue
for the given id or null if none exists.
-
getFont
Returns the currentFontValue
for the given id or null if none exists.- Parameters:
id
- the id to look up a font for- Returns:
- the current
FontValue
for the given id or null if none exists.
-
getIcon
Returns the currentIconValue
for the given id or null if none exists.- Parameters:
id
- the id to look up a icon for- Returns:
- the current
IconValue
for the given id or null if none exists.
-
getProperty
Returns the currentJavaPropertyValue
for the given id or null if none exists.- Parameters:
id
- the id to look up a icon for- Returns:
- the current
JavaPropertyValue
for the given id or null if none exists.
-
load
Loads all the values from the given map into this map, replacing values with the same ids.- Parameters:
valueMap
- the map whose values are to be loaded into this map
-
getColors
Returns a list of all theColorValue
s stored in this map.- Returns:
- a list of all the
ColorValue
s stored in this map.
-
getFonts
Returns a list of all theFontValue
s stored in this map.- Returns:
- a list of all the
FontValue
s stored in this map.
-
getIcons
Returns a list of all theIconValue
s stored in this map.- Returns:
- a list of all the
IconValue
s stored in this map.
-
getProperties
Returns a list of all theJavaPropertyValue
s stored in this map.- Returns:
- a list of all the
JavaPropertyValue
s stored in this map.
-
containsColor
Returns true if aColorValue
exists in this map for the given id.- Parameters:
id
- the id to check- Returns:
- true if a
ColorValue
exists in this map for the given id
-
containsFont
Returns true if aFontValue
exists in this map for the given id.- Parameters:
id
- the id to check- Returns:
- true if a
FontValue
exists in this map for the given id
-
containsIcon
Returns true if anIconValue
exists in this map for the given id.- Parameters:
id
- the id to check- Returns:
- true if an
IconValue
exists in this map for the given id
-
containsProperty
Returns true if anJavaPropertyValue
exists in this map for the given id.- Parameters:
id
- the id to check- Returns:
- true if an
JavaPropertyValue
exists in this map for the given id
-
size
Returns the total number of color, font, icon and property values stored in this map- Returns:
- the total number of color, font, icon and property values stored in this map
-
clear
public void clear()Clears all color, font, and icon values from this map -
isEmpty
public boolean isEmpty()Returns true if there are not color, font, icon or property values in this map- Returns:
- true if there are not color, font, icon or property values in this map
-
removeColor
removes anyColorValue
with the given id from this map.- Parameters:
id
- the id to remove
-
removeFont
removes anyFontValue
with the given id from this map.- Parameters:
id
- the id to remove
-
removeIcon
removes anyIconValue
with the given id from this map.- Parameters:
id
- the id to remove
-
removeProperty
removes anyJavaPropertyValue
with the given id from this map.- Parameters:
id
- the id to remove
-
getChangedValues
Returns a newGThemeValueMap
that is only populated by values that don't exist in the give map.- Parameters:
base
- the set of values (usually the default set) to compare against to determine what values are changed.- Returns:
- a new
GThemeValueMap
that is only populated by values that don't exist in the give map
-
getExternalIconFiles
Gets the set of icon (.png, .gif) files that are used by IconValues that came from files versus resources in the classpath. These are the icon files that need to be included when exporting this set of values to a zip file.- Returns:
- the set of icon (.png, .gif) files that are used by IconValues that came from files versus resources in the classpath
-
hashCode
public int hashCode() -
equals
-
checkForUnresolvedReferences
public void checkForUnresolvedReferences() -
getColorIds
Returns the set of all color ids in this map- Returns:
- the set of all color ids in this map
-
getFontIds
Returns the set of all font ids in this map- Returns:
- the set of all font ids in this map
-
getIconIds
Returns the set of all icon ids in this map- Returns:
- the set of all icon ids in this map
-
getPropertyIds
Returns the set of all Java property ids in this map- Returns:
- the set of all Java property ids in this map
-
getResolvedColor
Returns the resolved color, following indirections as needed to get the color ultimately assigned to the given id.- Parameters:
id
- the id for which to get a color- Returns:
- the resolved color, following indirections as needed to get the color ultimately assigned to the given id.
-
getResolvedFont
Returns the resolved font, following indirections as needed to get the font ultimately assigned to the given id.- Parameters:
id
- the id for which to get a font- Returns:
- the resolved font, following indirections as needed to get the font ultimately assigned to the given id
-
getResolvedIcon
Returns the resolved icon, following indirections as needed to get the icon ultimately assigned to the given id.- Parameters:
id
- the id for which to get an icon- Returns:
- the resolved icon, following indirections as needed to get the icon ultimately assigned to the given id
-
getResolvedProperty
Returns the resolved property, following indirections as needed to get the property ultimately assigned to the given id.- Parameters:
id
- the id for which to get an property- Returns:
- the resolved property, following indirections as needed to get the property ultimately assigned to the given id
-