Skip navigation links
JavaFX 8
javafx.css

Class CssMetaData<S extends Styleable,V>

    • Constructor Detail

      • CssMetaData

        protected CssMetaData(String property,
                              StyleConverter<?,V> converter,
                              V initialValue,
                              boolean inherits,
                              List<CssMetaData<? extends Styleable,?>> subProperties)
        Construct a CssMetaData with the given parameters and no sub-properties.
        Parameters:
        property - the CSS property
        converter - the StyleConverter used to convert the CSS parsed value to a Java object.
        initialValue - The initial or default value of the corresponding StyleableProperty
        inherits - true if this property uses CSS inheritance
        subProperties - the sub-properties of this property. For example, the -fx-font property has the sub-properties -fx-font-family, -fx-font-size, -fx-font-weight, and -fx-font-style.
      • CssMetaData

        protected CssMetaData(String property,
                              StyleConverter<?,V> converter,
                              V initialValue,
                              boolean inherits)
        Construct a CssMetaData with the given parameters and no sub-properties.
        Parameters:
        property - the CSS property
        converter - the StyleConverter used to convert the CSS parsed value to a Java object.
        initialValue - The initial or default value of the corresponding StyleableProperty
        inherits - true if this property uses CSS inheritance
      • CssMetaData

        protected CssMetaData(String property,
                              StyleConverter<?,V> converter,
                              V initialValue)
        Construct a CssMetaData with the given parameters, inherit set to false and no sub-properties.
        Parameters:
        property - the CSS property
        converter - the StyleConverter used to convert the CSS parsed value to a Java object.
        initialValue - The initial or default value of the corresponding StyleableProperty
      • CssMetaData

        protected CssMetaData(String property,
                              StyleConverter<?,V> converter)
        Construct a CssMetaData with the given parameters, initialValue is null, inherit is set to false, and no sub-properties.
        Parameters:
        property - the CSS property
        converter - the StyleConverter used to convert the CSS parsed value to a Java object.
    • Method Detail

      • isSettable

        public abstract boolean isSettable(S styleable)
        Check to see if the corresponding property on the given Node is settable. This method is called before any styles are looked up for the given property. It is abstract so that the code can check if the property is settable without expanding the property. Generally, the property is settable if it is not null or is not bound.
        Parameters:
        styleable - The Styleable on which the property value is being set
        Returns:
        true if the property can be set.
      • getStyleableProperty

        public abstract StyleableProperty<V> getStyleableProperty(S styleable)
        Return the corresponding StyleableProperty for the given Node. Note that calling this method will cause the property to be expanded.
        Parameters:
        styleable - The Styleable for which the property is returned
        Returns:
        The StyleableProperty corresponding to this CssMetaData for the given Styleable
      • getProperty

        public final String getProperty()
        Returns:
        the CSS property name
      • getConverter

        public final StyleConverter<?,V> getConverter()
        Returns:
        The CSS converter that handles conversion from a CSS value to a Java Object
      • getInitialValue

        public V getInitialValue(S styleable)
        The initial value of a CssMetaData corresponds to the default value of the StyleableProperty in code. For example, the default value of Shape.fill is Color.BLACK and the initialValue of Shape.StyleableProperties.FILL is also Color.BLACK.

        There may be exceptions to this, however. The initialValue may depend on the state of the Node. A ScrollBar has a default orientation of horizontal. If the ScrollBar is vertical, however, this method should return Orientation.VERTICAL. Otherwise, a vertical ScrollBar would be incorrectly set to a horizontal ScrollBar when the initial value is applied.

        Returns:
        The initial value of the property, possibly null
      • getSubProperties

        public final List<CssMetaData<? extends Styleable,?>> getSubProperties()
        The sub-properties refers to the constituent properties of this property, if any. For example, "-fx-font-weight" is sub-property of "-fx-font".
      • isInherits

        public final boolean isInherits()
        If true, the value of this property is the same as the parent's computed value of this property.
        See Also:
        CSS Inheritance
      • equals

        public boolean equals(Object obj)
        Two CssMetaData objects are considered to be equal if their property values are equal.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.