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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 theColorValueto the map.Adds theFontValueto the map.Adds theIconValueto the map.addProperty(JavaPropertyValue value) Adds the given property value to this map.voidvoidclear()Clears all color, font, and icon values from this mapbooleancontainsColor(String id) Returns true if aColorValueexists in this map for the given id.booleancontainsFont(String id) Returns true if aFontValueexists in this map for the given id.booleancontainsIcon(String id) Returns true if anIconValueexists in this map for the given id.booleanReturns true if anJavaPropertyValueexists in this map for the given id.booleanReturns a newGThemeValueMapthat is only populated by values that don't exist in the give map.Returns the currentColorValuefor the given id or null if none exists.Returns the set of all color ids in this mapReturns a list of all theColorValues 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 currentFontValuefor the given id or null if none exists.Returns the set of all font ids in this mapgetFonts()Returns a list of all theFontValues stored in this map.Returns the currentIconValuefor the given id or null if none exists.Returns the set of all icon ids in this mapgetIcons()Returns a list of all theIconValues stored in this map.Returns a list of all theJavaPropertyValues stored in this map.getProperty(String id) Returns the currentJavaPropertyValuefor 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.inthashCode()booleanisEmpty()Returns true if there are not color, font, icon or property values in this mapvoidload(GThemeValueMap valueMap) Loads all the values from the given map into this map, replacing values with the same ids.voidremoveColor(String id) removes anyColorValuewith the given id from this map.voidremoveFont(String id) removes anyFontValuewith the given id from this map.voidremoveIcon(String id) removes anyIconValuewith the given id from this map.voidremoveProperty(String id) removes anyJavaPropertyValuewith 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 theColorValueto the map. If a ColorValue already exists in the map with the same id, it will be replaced- Parameters:
value- theColorValueto store in the map.- Returns:
- the previous value for the color key or null if no previous value existed
-
addFont
Adds theFontValueto the map. If a FontValue already exists in the map with the same id, it will be replaced- Parameters:
value- theFontValueto store in the map.- Returns:
- the previous value for the font key or null if no previous value existed
-
addIcon
Adds theIconValueto the map. If a IconValue already exists in the map with the same id, it will be replaced- Parameters:
value- theIconValueto 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- theJavaPropertyValueto store in the map.- Returns:
- the previous value for the icon key or null if no previous value existed.
-
getColor
Returns the currentColorValuefor the given id or null if none exists.- Parameters:
id- the id to look up a color for- Returns:
- the current
ColorValuefor the given id or null if none exists.
-
getFont
Returns the currentFontValuefor the given id or null if none exists.- Parameters:
id- the id to look up a font for- Returns:
- the current
FontValuefor the given id or null if none exists.
-
getIcon
Returns the currentIconValuefor the given id or null if none exists.- Parameters:
id- the id to look up a icon for- Returns:
- the current
IconValuefor the given id or null if none exists.
-
getProperty
Returns the currentJavaPropertyValuefor the given id or null if none exists.- Parameters:
id- the id to look up a icon for- Returns:
- the current
JavaPropertyValuefor 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 theColorValues stored in this map.- Returns:
- a list of all the
ColorValues stored in this map.
-
getFonts
Returns a list of all theFontValues stored in this map.- Returns:
- a list of all the
FontValues stored in this map.
-
getIcons
Returns a list of all theIconValues stored in this map.- Returns:
- a list of all the
IconValues stored in this map.
-
getProperties
Returns a list of all theJavaPropertyValues stored in this map.- Returns:
- a list of all the
JavaPropertyValues stored in this map.
-
containsColor
Returns true if aColorValueexists in this map for the given id.- Parameters:
id- the id to check- Returns:
- true if a
ColorValueexists in this map for the given id
-
containsFont
Returns true if aFontValueexists in this map for the given id.- Parameters:
id- the id to check- Returns:
- true if a
FontValueexists in this map for the given id
-
containsIcon
Returns true if anIconValueexists in this map for the given id.- Parameters:
id- the id to check- Returns:
- true if an
IconValueexists in this map for the given id
-
containsProperty
Returns true if anJavaPropertyValueexists in this map for the given id.- Parameters:
id- the id to check- Returns:
- true if an
JavaPropertyValueexists 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 anyColorValuewith the given id from this map.- Parameters:
id- the id to remove
-
removeFont
removes anyFontValuewith the given id from this map.- Parameters:
id- the id to remove
-
removeIcon
removes anyIconValuewith the given id from this map.- Parameters:
id- the id to remove
-
removeProperty
removes anyJavaPropertyValuewith the given id from this map.- Parameters:
id- the id to remove
-
getChangedValues
Returns a newGThemeValueMapthat 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
GThemeValueMapthat 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
-