Package generic.theme

# Class FontValue

java.lang.Object
generic.theme.ThemeValue<Font>
generic.theme.FontValue

All Implemented Interfaces:
  `Comparable<ThemeValue<Font>>`

public class FontValue extends ThemeValue<Font>
A class for storing `Font` values that have a String id (e.g. font.foo.bar) and either a concrete font or a reference id which is the String id of another FontValue that it will inherit its font from. So if this class's font value is non-null, the refId will be null and if the class's refId is non-null, then the font value will be null.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `EXTERNAL_LAF_ID_PREFIX`
  `static final String`
  `LAF_ID_PREFIX`
  `static final Font`
  `LAST_RESORT_DEFAULT`

  ### Fields inherited from class generic.theme.ThemeValue

  `id, referenceId, value`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FontValue(String id, Font value)`
  Constructor used when the FontValue will have a direct `Font` value.
  `FontValue(String id, String refId)`
  Constructor used when the FontValue will inherit its `Font` from another FontValue.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `fontToString(Font font)`
  Converts a file to a string.
  `Font`
  `get(GThemeValueMap values)`
  Returns the T value for this instance, following references as needed.
  `FontModifier`
  `getModifier()`
  `protected FontValue`
  `getReferredValue(GThemeValueMap values, String refId)`
  Returns the ThemeValue referred to by this ThemeValue.
  `String`
  `getSerializationString()`
  Returns the "key = value" String for writing this ThemeValue to a file
  `static int`
  `getStyle(String styleString)`
  Returns the Font style int for the given style string
  `protected Font`
  `getUnresolvedReferenceValue(String primaryId, String unresolvedId)`
  Returns the T to be used if the indirect reference couldn't be resolved.
  `void`
  `installValue(ThemeManager themeManager)`
  Install this value as the current value for the application
  `boolean`
  `isExternal()`
  True if this value is one that is one that is defined outside of the application, such as a Java Look and Feel key.
  `static boolean`
  `isFontKey(String key)`
  Returns true if the given key string is a valid external key for a font value
  `static FontValue`
  `parse(String key, String value)`
  Parses the value string into a font or reference and creates a new FontValue using the given key and the parse results.

  ### Methods inherited from class generic.theme.ThemeValue

  `compareTo, equals, getId, getRawValue, getReferenceId, hashCode, hasResolvableValue, inheritsFrom, isIndirect, toString`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### LAF_ID_PREFIX

    public static final String LAF_ID_PREFIX
    See Also:
      - Constant Field Values

  - ### EXTERNAL_LAF_ID_PREFIX

    public static final String EXTERNAL_LAF_ID_PREFIX
    See Also:
      - Constant Field Values

  - ### LAST_RESORT_DEFAULT

    public static final Font LAST_RESORT_DEFAULT

- ## Constructor Details

  - ### FontValue

    public FontValue(String id, Font value)
    Constructor used when the FontValue will have a direct `Font` value. The refId will be null.
    Parameters:
      `id` - the id for this FontValue
      `value` - the `Font` to associate with the given id

  - ### FontValue

    public FontValue(String id, String refId)
    Constructor used when the FontValue will inherit its `Font` from another FontValue. The font value field will be null.
    Parameters:
      `id` - the id for this FontValue
      `refId` - the id of another FontValue that this FontValue will inherit from

- ## Method Details

  - ### getSerializationString

    public String getSerializationString()
    Description copied from class: `ThemeValue`
    Returns the "key = value" String for writing this ThemeValue to a file
    Specified by:
      `getSerializationString` in class `ThemeValue<Font>`
    Returns:
      the "key = value" String for writing this ThemeValue to a file

  - ### isExternal

    public boolean isExternal()
    Description copied from class: `ThemeValue`
    True if this value is one that is one that is defined outside of the application, such as a Java Look and Feel key.
    Specified by:
      `isExternal` in class `ThemeValue<Font>`
    Returns:
      true if external

  - ### get

    public Font get(GThemeValueMap values)
    Description copied from class: `ThemeValue`
    Returns the T value for this instance, following references as needed. Uses the given preferredValues map to resolve references. If the value can't be resolved by following reference chains, an error stack trace will be generated and the default T value will be returned. In rare situations where it is acceptable for the value to not be resolvable, use the `ThemeValue.hasResolvableValue(GThemeValueMap)` method first.
    Overrides:
      `get` in class `ThemeValue<Font>`
    Parameters:
      `values` - the `GThemeValueMap` used to resolve references if this instance doesn't have an actual value.
    Returns:
      the T value for this instance, following references as needed.

  - ### fontToString

    public static String fontToString(Font font)
    Converts a file to a string.
    Parameters:
      `font` - the font to convert to a String
    Returns:
      a String that represents the font

  - ### isFontKey

    public static boolean isFontKey(String key)
    Returns true if the given key string is a valid external key for a font value
    Parameters:
      `key` - the key string to test
    Returns:
      true if the given key string is a valid external key for a font value

  - ### parse

    public static FontValue parse(String key, String value) throws ParseException
    Parses the value string into a font or reference and creates a new FontValue using the given key and the parse results.
    Parameters:
      `key` - the key to associate the parsed value with
      `value` - the font value to parse
    Returns:
      a FontValue with the given key and the parsed value
    Throws:
      `ParseException` - if there is an exception parsing

  - ### getStyle

    public static int getStyle(String styleString)
    Returns the Font style int for the given style string
    Parameters:
      `styleString` - the string to convert to a Font style int
    Returns:
      the Font style int for the given style string

  - ### getReferredValue

    protected FontValue getReferredValue(GThemeValueMap values, String refId)
    Description copied from class: `ThemeValue`
    Returns the ThemeValue referred to by this ThemeValue. Needs to be overridden by concrete classes as they know the correct method to call on the preferredValues map.
    Specified by:
      `getReferredValue` in class `ThemeValue<Font>`
    Parameters:
      `values` - the `GThemeValueMap` to be used to resolve the reference id
      `refId` - the id of the reference ThemeValue
    Returns:
      the ThemeValue referred to by this ThemeValue.

  - ### getUnresolvedReferenceValue

    protected Font getUnresolvedReferenceValue(String primaryId, String unresolvedId)
    Description copied from class: `ThemeValue`
    Returns the T to be used if the indirect reference couldn't be resolved.
    Specified by:
      `getUnresolvedReferenceValue` in class `ThemeValue<Font>`
    Parameters:
      `primaryId` - the id we are trying to get a value for
      `unresolvedId` - the reference id that couldn't be resolved
    Returns:
      the default value to be used if the indirect reference couldn't be resolved.

  - ### getModifier

    public FontModifier getModifier()

  - ### installValue

    public void installValue(ThemeManager themeManager)
    Description copied from class: `ThemeValue`
    Install this value as the current value for the application
    Specified by:
      `installValue` in class `ThemeValue<Font>`
    Parameters:
      `themeManager` - the application ThemeManager