Class DefaultableStyleableKey<T>

Type Parameters:
T - the value type
All Implemented Interfaces:
Serializable, DefaultableStyleableMapAccessor<T>, ReadOnlyStyleableMapAccessor<@NonNull CssDefaultableValue<T>>, WritableStyleableMapAccessor<@NonNull CssDefaultableValue<T>>, Key<CssDefaultableValue<T>>, MapAccessor<@NonNull CssDefaultableValue<T>>, NonNullKey<CssDefaultableValue<T>>, NonNullMapAccessor<CssDefaultableValue<T>>

DefaultableStyleableKey.
Author:
Werner Randelshofer
See Also:
  • Constructor Details

    • DefaultableStyleableKey

      public DefaultableStyleableKey(@NonNull String name, @NonNull Type type, @NonNull CssConverter<T> converter, @NonNull CssDefaultableValue<T> initialDefaultingValue, @Nullable T initialValue)
      Creates a new instance with the specified name, mask and default value.
      Parameters:
      name - The name of the key.
      type - The full type
      converter - String converter for a list element
      initialDefaultingValue - The default value.
  • Method Details

    • getCssConverter

      public @NonNull org.jhotdraw8.base.converter.Converter<CssDefaultableValue<T>> getCssConverter()
      Specified by:
      getCssConverter in interface ReadOnlyStyleableMapAccessor<T>
    • getInitialValue

      public T getInitialValue()
      Returns the initial value of the attribute.

      We use the definition from CSS initial value:

      "Each property has an initial value, defined in the property's definition table. If the property is not an inherited property, and the cascade does not result in a value, then the specified value of the property is its initial value."

      We intentionally do not use the definition from SVG initial value:

      "The initial value of an attribute or property is the value used when that attribute or property is not specified, or when it has an invalid value."

      References:

      CSS Cascading and Inheritance Level 4, Chapter 7.1 Initial Values>
      w3.org
      SVG, Chapter 4: Basic Data Types and Interfaces, 4.1 Definitions, Initial Value
      w3.org
      Specified by:
      getInitialValue in interface DefaultableStyleableMapAccessor<T>
      Returns:
      the initial value.