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 Link icon

  • Constructor Details Link icon

    • GThemeValueMap Link icon

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

      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 Link icon

    • addColor Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public void clear()
      Clears all color, font, and icon values from this map
    • isEmpty Link icon

      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 Link icon

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

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

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

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

      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 Link icon

      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 Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals Link icon

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

      public void checkForUnresolvedReferences()
    • getColorIds Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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