Package generic.theme

Class GThemeValueMap

java.lang.Object
generic.theme.GThemeValueMap
Direct Known Subclasses:
GTheme

public class GThemeValueMap extends Object
Class for storing colors, fonts, and icons by id
  • Field Details

  • Constructor Details

    • GThemeValueMap

      public GThemeValueMap()
      Constructs a new empty map.
    • GThemeValueMap

      public GThemeValueMap(GThemeValueMap initial)
      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

      public ColorValue addColor(ColorValue value)
      Adds the ColorValue to the map. If a ColorValue already exists in the map with the same id, it will be replaced
      Parameters:
      value - the ColorValue to store in the map.
      Returns:
      the previous value for the color key or null if no previous value existed
    • addFont

      public FontValue addFont(FontValue value)
      Adds the FontValue to the map. If a FontValue already exists in the map with the same id, it will be replaced
      Parameters:
      value - the FontValue to store in the map.
      Returns:
      the previous value for the font key or null if no previous value existed
    • addIcon

      public IconValue addIcon(IconValue value)
      Adds the IconValue to the map. If a IconValue already exists in the map with the same id, it will be replaced
      Parameters:
      value - the IconValue to store in the map.
      Returns:
      the previous value for the icon key or null if no previous value existed
    • addProperty

      public JavaPropertyValue addProperty(JavaPropertyValue value)
      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 - the JavaPropertyValue to store in the map.
      Returns:
      the previous value for the icon key or null if no previous value existed.
    • getColor

      public ColorValue getColor(String id)
      Returns the current ColorValue 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

      public FontValue getFont(String id)
      Returns the current FontValue 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

      public IconValue getIcon(String id)
      Returns the current IconValue 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

      public JavaPropertyValue getProperty(String id)
      Returns the current JavaPropertyValue 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

      public void load(GThemeValueMap valueMap)
      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

      public List<ColorValue> getColors()
      Returns a list of all the ColorValues stored in this map.
      Returns:
      a list of all the ColorValues stored in this map.
    • getFonts

      public List<FontValue> getFonts()
      Returns a list of all the FontValues stored in this map.
      Returns:
      a list of all the FontValues stored in this map.
    • getIcons

      public List<IconValue> getIcons()
      Returns a list of all the IconValues stored in this map.
      Returns:
      a list of all the IconValues stored in this map.
    • getProperties

      public List<JavaPropertyValue> getProperties()
      Returns a list of all the JavaPropertyValues stored in this map.
      Returns:
      a list of all the JavaPropertyValues stored in this map.
    • containsColor

      public boolean containsColor(String id)
      Returns true if a ColorValue 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

      public boolean containsFont(String id)
      Returns true if a FontValue 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

      public boolean containsIcon(String id)
      Returns true if an IconValue 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

      public boolean containsProperty(String id)
      Returns true if an JavaPropertyValue 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

      public Object 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

      public void removeColor(String id)
      removes any ColorValue with the given id from this map.
      Parameters:
      id - the id to remove
    • removeFont

      public void removeFont(String id)
      removes any FontValue with the given id from this map.
      Parameters:
      id - the id to remove
    • removeIcon

      public void removeIcon(String id)
      removes any IconValue with the given id from this map.
      Parameters:
      id - the id to remove
    • removeProperty

      public void removeProperty(String id)
      removes any JavaPropertyValue with the given id from this map.
      Parameters:
      id - the id to remove
    • getChangedValues

      public GThemeValueMap getChangedValues(GThemeValueMap base)
      Returns a new GThemeValueMap 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

      public Set<File> 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()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • checkForUnresolvedReferences

      public void checkForUnresolvedReferences()
    • getColorIds

      public Set<String> getColorIds()
      Returns the set of all color ids in this map
      Returns:
      the set of all color ids in this map
    • getFontIds

      public Set<String> getFontIds()
      Returns the set of all font ids in this map
      Returns:
      the set of all font ids in this map
    • getIconIds

      public Set<String> getIconIds()
      Returns the set of all icon ids in this map
      Returns:
      the set of all icon ids in this map
    • getPropertyIds

      public Set<String> getPropertyIds()
      Returns the set of all Java property ids in this map
      Returns:
      the set of all Java property ids in this map
    • getResolvedColor

      public Color getResolvedColor(String id)
      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

      public Font getResolvedFont(String id)
      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

      public Icon getResolvedIcon(String id)
      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

      public Object getResolvedProperty(String id)
      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