Class StyleablePropertyFactory<S extends Styleable>
- Type Parameters:
-
S- The type of Styleable
public class StyleablePropertyFactory<S extends Styleable> extends Object
StyleablePropertyFactory as a static member, as shown below, is recommended.
public final class MyButton extends Button {
private static final StyleablePropertyFactory<MyButton> FACTORY = new StyleablePropertyFactory<>(Button.getClassCssMetaData());
MyButton(String labelText) {
super(labelText);
getStyleClass().add("my-button");
}
// Typical JavaFX property implementation
public ObservableValue<Boolean> selectedProperty() { return (ObservableValue<Boolean>)selected; }
public final boolean isSelected() { return selected.getValue(); }
public final void setSelected(boolean isSelected) { selected.setValue(isSelected); }
// StyleableProperty implementation reduced to one line
private final StyleableProperty<Boolean> selected =
FACTORY.createStyleableBooleanProperty(this, "selected", "-my-selected", s -> s.selected);
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return FACTORY.getCssMetaData();
}
}
The example above is the simplest use of StyleablePropertyFactory. But, this use does not provide the static CssMetaData that is useful for getClassCssMetaData(), which is described in the javadoc for CssMetaData. Static CssMetaData can, however, be created via StyleablePropertyFactory methods and will be returned by the methods which create StyleableProperty instances, as the example below illustrates. Note that the static method getClassCssMetaData() is a convention used throughout the JavaFX code base but the getClassCssMetaData() method itself is not used at runtime.
public final class MyButton extends Button {
private static final StyleablePropertyFactory<MyButton> FACTORY =
new StyleablePropertyFactory<>(Button.getClassCssMetaData());
private static final CssMetaData<MyButton, Boolean> SELECTED =
FACTORY.createBooleanCssMetaData("-my-selected", s -> s.selected, false, false);
MyButton(String labelText) {
super(labelText);
getStyleClass().add("my-button");
}
// Typical JavaFX property implementation
public ObservableValue<Boolean> selectedProperty() { return (ObservableValue<Boolean>)selected; }
public final boolean isSelected() { return selected.getValue(); }
public final void setSelected(boolean isSelected) { selected.setValue(isSelected); }
// StyleableProperty implementation reduced to one line
private final StyleableProperty<Boolean> selected =
new SimpleStyleableBooleanProperty(SELECTED, this, "selected");
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
return FACTORY.getCssMetaData();
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return FACTORY.getCssMetaData();
}
}
The same can be accomplished with an inner-class. The previous example called new SimpleStyleableBooleanProperty to create the selected property. This example uses the factory to access the CssMetaData that was created along with the anonymous inner-class. For all intents and purposes, the two examples are the same.
public final class MyButton extends Button {
private static CssMetaData<MyButton, Boolean> SELECTED;
private static final StyleablePropertyFactory<MyButton> FACTORY =
new StyleablePropertyFactory<>(Button.getClassCssMetaData()) {
{
SELECTED = createBooleanCssMetaData("-my-selected", s -> s.selected, false, false);
}
};
MyButton(String labelText) {
super(labelText);
getStyleClass().add("my-button");
}
// Typical JavaFX property implementation
public ObservableValue<Boolean> selectedProperty() { return (ObservableValue<Boolean>)selected; }
public final boolean isSelected() { return selected.getValue(); }
public final void setSelected(boolean isSelected) { selected.setValue(isSelected); }
// StyleableProperty implementation reduced to one line
private final StyleableProperty<Boolean> selected =
new SimpleStyleableBooleanProperty(SELECTED, "selected", "my-selected");
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
return FACTORY.getCssMetaData();
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return FACTORY.getCssMetaData();
}
}
Caveats:
The only option for creating a StyleableProperty with a number value is to create a StyleableProperty<Number>. The return value from thegetValue() method of the StyleableProperty is a Number. Therefore, the get method of the JavaFX property needs to call the correct value method for the return type. For example,
public ObservableValue<Double> offsetProperty() { return (ObservableValue<Double>)offset; }
public Double getOffset() { return offset.getValue().doubleValue(); }
public void setOffset(Double value) { offset.setValue(value); }
private final StyleableProperty<Number> offset = FACTORY.createStyleableNumberProperty(this, "offset", "-my-offset", s -> ((MyButton)s).offset);
- Since:
- JavaFX 8u40
Constructor Summary
| Constructor | Description |
|---|---|
StyleablePropertyFactory |
The constructor is passed the CssMetaData of the parent class of <S>, typically by calling the static getClassCssMetaData() method of the parent. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final CssMetaData |
createBooleanCssMetaData |
Create a CssMetaData<S, Boolean> with initial value and inherit flag both defaulting to false. |
final CssMetaData |
createBooleanCssMetaData |
Create a CssMetaData<S, Boolean> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createBooleanCssMetaData |
Create a CssMetaData<S, Boolean> with initial value, and inherit flag. |
final CssMetaData |
createColorCssMetaData |
Create a CssMetaData<S, Color> with initial value of Color.BLACK, and inherit flag defaulting to false. |
final CssMetaData |
createColorCssMetaData |
Create a CssMetaData<S, Color> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createColorCssMetaData |
Create a CssMetaData<S, Color> with initial value, and inherit flag. |
final CssMetaData |
createDurationCssMetaData |
Create a CssMetaData<S, Duration> with initial value of Duration.BLACK, and inherit flag defaulting to false. |
final CssMetaData |
createDurationCssMetaData |
Create a CssMetaData<S, Duration> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createDurationCssMetaData |
Create a CssMetaData<S, Duration> with initial value, and inherit flag. |
final <E extends Effect> |
createEffectCssMetaData |
Create a CssMetaData<S, Effect> with initial value of null, and inherit flag defaulting to false. |
final <E extends Effect> |
createEffectCssMetaData |
Create a CssMetaData<S, Effect> with initial value, and inherit flag defaulting to false. |
final <E extends Effect> |
createEffectCssMetaData |
Create a CssMetaData<S, Effect> with initial value, and inherit flag. |
final <E extends Enum<E>> |
createEnumCssMetaData |
Create a CssMetaData<S, Enum> with initial value of null, and inherit flag defaulting to false. |
final <E extends Enum<E>> |
createEnumCssMetaData |
Create a CssMetaData<S, Enum> with initial value, and inherit flag defaulting to false. |
final <E extends Enum<E>> |
createEnumCssMetaData |
Create a CssMetaData<S, Enum> with initial value, and inherit flag. |
final CssMetaData |
createFontCssMetaData |
Create a CssMetaData<S, Font> with initial value of Font.getDefault(), and inherit flag defaulting to true. |
final CssMetaData |
createFontCssMetaData |
Create a CssMetaData<S, Font> with initial value, and inherit flag defaulting to true. |
final CssMetaData |
createFontCssMetaData |
Create a CssMetaData<S, Font> with initial value, and inherit flag. |
final CssMetaData |
createInsetsCssMetaData |
Create a CssMetaData<S, Insets> with initial value of Insets.EMPTY, and inherit flag defaulting to false. |
final CssMetaData |
createInsetsCssMetaData |
Create a CssMetaData<S, Insets> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createInsetsCssMetaData |
Create a CssMetaData<S, Insets> with initial value, and inherit flag. |
final CssMetaData |
createPaintCssMetaData |
Create a CssMetaData<S, Paint> with initial value of Color.BLACK, and inherit flag defaulting to false. |
final CssMetaData |
createPaintCssMetaData |
Create a CssMetaData<S, Paint> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createPaintCssMetaData |
Create a CssMetaData<S, Paint> with initial value, and inherit flag. |
final CssMetaData |
createSizeCssMetaData |
Create a CssMetaData<S, Number> with initial value of 0d, and inherit flag defaulting to false. |
final CssMetaData |
createSizeCssMetaData |
Create a CssMetaData<S, Number> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createSizeCssMetaData |
Create a CssMetaData<S, Number> with initial value, and inherit flag. |
final CssMetaData |
createStringCssMetaData |
Create a CssMetaData<S, String> with initial value of null, and inherit flag defaulting to false. |
final CssMetaData |
createStringCssMetaData |
Create a CssMetaData<S, String> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createStringCssMetaData |
Create a CssMetaData<S, String> with initial value, and inherit flag. |
final StyleableProperty |
createStyleableBooleanProperty |
Create a StyleableProperty<Boolean> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableBooleanProperty |
Create a StyleableProperty<Boolean>. |
final StyleableProperty |
createStyleableBooleanProperty |
Create a StyleableProperty<Boolean> with initial value. |
final StyleableProperty |
createStyleableBooleanProperty |
Create a StyleableProperty<Boolean> with initial value and inherit flag. |
final StyleableProperty |
createStyleableColorProperty |
Create a StyleableProperty<Color> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableColorProperty |
Create a StyleableProperty<Color>. |
final StyleableProperty |
createStyleableColorProperty |
Create a StyleableProperty<Color> with initial value. |
final StyleableProperty |
createStyleableColorProperty |
Create a StyleableProperty<Color> with initial value and inherit flag. |
final StyleableProperty |
createStyleableDurationProperty |
Create a StyleableProperty<Duration> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableDurationProperty |
Create a StyleableProperty<Duration>. |
final StyleableProperty |
createStyleableDurationProperty |
Create a StyleableProperty<Duration> with initial value. |
final StyleableProperty |
createStyleableDurationProperty |
Create a StyleableProperty<Duration> with initial value and inherit flag. |
final StyleableProperty |
createStyleableEffectProperty |
Create a StyleableProperty<Effect> using previously created CssMetaData for the given cssProperty. |
final <E extends Enum<E>> |
createStyleableEffectProperty |
Create a StyleableProperty<E extends Enum<E>> using previously created CssMetaData for the given cssProperty. |
final <E extends Effect> |
createStyleableEffectProperty |
Create a StyleableProperty<Effect>. |
final <E extends Effect> |
createStyleableEffectProperty |
Create a StyleableProperty<Effect> with initial value. |
final <E extends Effect> |
createStyleableEffectProperty |
Create a StyleableProperty<Effect> with initial value and inherit flag. |
final <E extends Enum<E>> |
createStyleableEnumProperty |
Create a StyleableProperty<E extends Enum<E>>. |
final <E extends Enum<E>> |
createStyleableEnumProperty |
Create a StyleableProperty<E extends Enum<E>> with initial value. |
final <E extends Enum<E>> |
createStyleableEnumProperty |
Create a StyleableProperty<E extends Enum<E>> with initial value and inherit flag. |
final StyleableProperty |
createStyleableFontProperty |
Create a StyleableProperty<Font> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableFontProperty |
Create a StyleableProperty<Font>. |
final StyleableProperty |
createStyleableFontProperty |
Create a StyleableProperty<Font> with initial value. |
final StyleableProperty |
createStyleableFontProperty |
Create a StyleableProperty<Font> with initial value and inherit flag. |
final StyleableProperty |
createStyleableInsetsProperty |
Create a StyleableProperty<Insets> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableInsetsProperty |
Create a StyleableProperty<Inset>. |
final StyleableProperty |
createStyleableInsetsProperty |
Create a StyleableProperty<Inset> with initial value. |
final StyleableProperty |
createStyleableInsetsProperty |
Create a StyleableProperty<Inset> with initial value and inherit flag. |
final StyleableProperty |
createStyleableNumberProperty |
Create a StyleableProperty<Number> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableNumberProperty |
Create a StyleableProperty<Number>. |
final StyleableProperty |
createStyleableNumberProperty |
Create a StyleableProperty<Number> with initial value. |
final StyleableProperty |
createStyleableNumberProperty |
Create a StyleableProperty<Number> with initial value and inherit flag. |
final StyleableProperty |
createStyleablePaintProperty |
Create a StyleableProperty<Paint> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleablePaintProperty |
Create a StyleableProperty<Paint>. |
final StyleableProperty |
createStyleablePaintProperty |
Create a StyleableProperty<Paint> with initial value. |
final StyleableProperty |
createStyleablePaintProperty |
Create a StyleableProperty<Paint> with initial value and inherit flag. |
final StyleableProperty |
createStyleableStringProperty |
Create a StyleableProperty<String> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableStringProperty |
Create a StyleableProperty<String>. |
final StyleableProperty |
createStyleableStringProperty |
Create a StyleableProperty<String> with initial value. |
final StyleableProperty |
createStyleableStringProperty |
Create a StyleableProperty<String> with initial value and inherit flag. |
final StyleableProperty |
createStyleableUrlProperty |
Create a StyleableProperty<String> using previously created CssMetaData for the given cssProperty. |
final StyleableProperty |
createStyleableUrlProperty |
Create a StyleableProperty<String> with initial value. |
final StyleableProperty |
createStyleableUrlProperty |
Create a StyleableProperty<String> with initial value. |
final StyleableProperty |
createStyleableUrlProperty |
Create a StyleableProperty<String> with initial value and inherit flag. |
final CssMetaData |
createUrlCssMetaData |
Create a CssMetaData<S, String> with initial value of null, and inherit flag defaulting to false. |
final CssMetaData |
createUrlCssMetaData |
Create a CssMetaData<S, String> with initial value, and inherit flag defaulting to false. |
final CssMetaData |
createUrlCssMetaData |
Create a CssMetaData<S, String> with initial value, and inherit flag. |
final List |
getCssMetaData() |
Get the CssMetaData for the given Styleable. |
Constructor Details
StyleablePropertyFactory
public StyleablePropertyFactory(List<CssMetaData<? extends Styleable,?>> parentCssMetaData)
getClassCssMetaData() method of the parent.- Parameters:
-
parentCssMetaData- The CssMetaData of the parent class of <S>, or null.
Method Details
getCssMetaData
public final List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Styleable.getCssMetaData() method. For a Control, this method should be called from the Control.getControlCssMetaData() method.- Returns:
- the CssMetaData for the given Styleable
createStyleableBooleanProperty
public final StyleableProperty<Boolean> createStyleableBooleanProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Boolean>> function, boolean initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Boolean> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Boolean> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableBooleanProperty
public final StyleableProperty<Boolean> createStyleableBooleanProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Boolean>> function, boolean initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Boolean> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Boolean> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value
createStyleableBooleanProperty
public final StyleableProperty<Boolean> createStyleableBooleanProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Boolean>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Boolean> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Boolean> that was created by this method call. - Returns:
- a StyleableProperty created with default initialValue and inherit flag
createStyleableBooleanProperty
public final StyleableProperty<Boolean> createStyleableBooleanProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Boolean> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableColorProperty
public final StyleableProperty<Color> createStyleableColorProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Color>> function, Color initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Color> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Color> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableColorProperty
public final StyleableProperty<Color> createStyleableColorProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Color>> function, Color initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Color> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Color> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value
createStyleableColorProperty
public final StyleableProperty<Color> createStyleableColorProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Color>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Color> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Color> that was created by this method call. - Returns:
- a StyleableProperty created with default initial value and inherit flag
createStyleableColorProperty
public final StyleableProperty<Color> createStyleableColorProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Color> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableDurationProperty
public final StyleableProperty<Duration> createStyleableDurationProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Duration>> function, Duration initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Duration> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Duration> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableDurationProperty
public final StyleableProperty<Duration> createStyleableDurationProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Duration>> function, Duration initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Duration> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Duration> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableDurationProperty
public final StyleableProperty<Duration> createStyleableDurationProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Duration>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Duration> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Duration> that was created by this method call. - Returns:
- a StyleableProperty created with default initial value and false inherit flag
createStyleableDurationProperty
public final StyleableProperty<Duration> createStyleableDurationProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Duration> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableEffectProperty
public final <E extends Effect> StyleableProperty<E> createStyleableEffectProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<E>> function, E initialValue, boolean inherits)
- Type Parameters:
-
E- The type of StyleableProperty - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Effect> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Effect> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableEffectProperty
public final <E extends Effect> StyleableProperty<E> createStyleableEffectProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<E>> function, E initialValue)
- Type Parameters:
-
E- The StyleableProperty created with initial value and false inherit flag - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Effect> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Effect> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableEffectProperty
public final <E extends Effect> StyleableProperty<E> createStyleableEffectProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<E>> function)
- Type Parameters:
-
E- The StyleableProperty created with null initial value and false inherit flag - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Effect> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Effect> that was created by this method call. - Returns:
- a StyleableProperty created with null initial value and false inherit flag
createStyleableEffectProperty
public final StyleableProperty<Effect> createStyleableEffectProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Effect> -
cssProperty- The CSS property name - Returns:
- StyleableProperty created using previously created CssMetaData for the given
cssProperty - Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableEnumProperty
public final <E extends Enum<E>> StyleableProperty<E> createStyleableEnumProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<E>> function, Class<E> enumClass, E initialValue, boolean inherits)
enumClass parameter is the Class of the Enum that is the value of the property. For example,
private static final StyleablePropertyFactory<MyControl> FACTORY = new StyleablePropertyFactory<>();
StyleableProperty<Orientation> orientation =
FACTORY.createStyleableEnumProperty(
this,
"orientation",
"-my-orientation",
s -> ((MyControl)s).orientation,
Orientation.class,
Orientation.HORIZONTAL,
false);
- Type Parameters:
-
E- The StyleableProperty created with initial value and inherit flag - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<E extends Enum<E>> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<E extends Enum<E>> that was created by this method call. -
enumClass- The Enum class that is the type of the StyleableProperty<E extends Enum<E>>. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableEnumProperty
public final <E extends Enum<E>> StyleableProperty<E> createStyleableEnumProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<E>> function, Class<E> enumClass, E initialValue)
enumClass parameter is the Class of the Enum that is the value of the property. For example,
private static final StyleablePropertyFactory<MyControl> FACTORY = new StyleablePropertyFactory<>();
StyleableProperty<Orientation> orientation =
FACTORY.createStyleableEnumProperty(
this,
"orientation",
"-my-orientation",
s -> ((MyControl)s).orientation,
Orientation.class,
Orientation.HORIZONTAL);
- Type Parameters:
-
E- The StyleableProperty created with initial value and false inherit flag - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<E extends Enum<E>> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<E extends Enum<E>> that was created by this method call. -
enumClass- The Enum class that is the type of the StyleableProperty<E extends Enum<E>>. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableEnumProperty
public final <E extends Enum<E>> StyleableProperty<E> createStyleableEnumProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<E>> function, Class<E> enumClass)
enumClass parameter is the Class of the Enum that is the value of the property. For example,
private static final StyleablePropertyFactory<MyControl> FACTORY = new StyleablePropertyFactory<>();
StyleableProperty<Orientation> orientation =
FACTORY.createStyleableEnumProperty(
this,
"orientation",
"-my-orientation",
s -> ((MyControl)s).orientation,
Orientation.class);
- Type Parameters:
-
E- The StyleableProperty created with null initial value and false inherit flag - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<E extends Enum<E>> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<E extends Enum<E>> that was created by this method call. -
enumClass- The Enum class that is the type of the StyleableProperty<E extends Enum<E>>. - Returns:
- a StyleableProperty created with null initial value and false inherit flag
createStyleableEffectProperty
public final <E extends Enum<E>> StyleableProperty<E> createStyleableEffectProperty(S styleable, String propertyName, String cssProperty, Class<E> enumClass)
cssProperty.- Type Parameters:
-
E- The StyleableProperty created using previously created CssMetaData - Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<E extends Enum<E>> -
cssProperty- The CSS property name -
enumClass- The Enum class that is the type of the StyleableProperty<E extends Enum<E>>. - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableFontProperty
public final StyleableProperty<Font> createStyleableFontProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Font>> function, Font initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Font> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Font> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableFontProperty
public final StyleableProperty<Font> createStyleableFontProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Font>> function, Font initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Font> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Font> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and true inherit flag
createStyleableFontProperty
public final StyleableProperty<Font> createStyleableFontProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Font>> function)
Font.getDefault() and the inherit flag defaults to true.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Font> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Font> that was created by this method call. - Returns:
- a StyleableProperty created with default font initial value and true inherit flag
createStyleableFontProperty
public final StyleableProperty<Font> createStyleableFontProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Font> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableInsetsProperty
public final StyleableProperty<Insets> createStyleableInsetsProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Insets>> function, Insets initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Inset> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Inset> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableInsetsProperty
public final StyleableProperty<Insets> createStyleableInsetsProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Insets>> function, Insets initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Inset> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Inset> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableInsetsProperty
public final StyleableProperty<Insets> createStyleableInsetsProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Insets>> function)
Insets.EMPTY and the inherit flag defaults to false.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Inset> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Inset> that was created by this method call. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableInsetsProperty
public final StyleableProperty<Insets> createStyleableInsetsProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Insets> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleablePaintProperty
public final StyleableProperty<Paint> createStyleablePaintProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Paint>> function, Paint initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Paint> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Paint> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleablePaintProperty
public final StyleableProperty<Paint> createStyleablePaintProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Paint>> function, Paint initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Paint> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Paint> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleablePaintProperty
public final StyleableProperty<Paint> createStyleablePaintProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Paint>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Paint> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Paint> that was created by this method call. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleablePaintProperty
public final StyleableProperty<Paint> createStyleablePaintProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Paint> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableNumberProperty
public final StyleableProperty<Number> createStyleableNumberProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Number>> function, Number initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Number> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Number> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableNumberProperty
public final StyleableProperty<Number> createStyleableNumberProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Number>> function, Number initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Number> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Number> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableNumberProperty
public final StyleableProperty<Number> createStyleableNumberProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<Number>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Number> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<Number> that was created by this method call. - Returns:
- a StyleableProperty created with zero initial value and false inherit flag
createStyleableNumberProperty
public final StyleableProperty<Number> createStyleableNumberProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<Number> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableStringProperty
public final StyleableProperty<String> createStyleableStringProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<String>> function, String initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<String> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableStringProperty
public final StyleableProperty<String> createStyleableStringProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<String>> function, String initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<String> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableStringProperty
public final StyleableProperty<String> createStyleableStringProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<String>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<String> that was created by this method call. - Returns:
- a StyleableProperty created with null initial value and false inherit flag
createStyleableStringProperty
public final StyleableProperty<String> createStyleableStringProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createStyleableUrlProperty
public final StyleableProperty<String> createStyleableUrlProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<String>> function, String initialValue, boolean inherits)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<String> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a StyleableProperty created with initial value and inherit flag
createStyleableUrlProperty
public final StyleableProperty<String> createStyleableUrlProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<String>> function, String initialValue)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<String> that was created by this method call. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableUrlProperty
public final StyleableProperty<String> createStyleableUrlProperty(S styleable, String propertyName, String cssProperty, Function<S,StyleableProperty<String>> function)
- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name -
function- A function that returns the StyleableProperty<String> that was created by this method call. - Returns:
- a StyleableProperty created with initial value and false inherit flag
createStyleableUrlProperty
public final StyleableProperty<String> createStyleableUrlProperty(S styleable, String propertyName, String cssProperty)
cssProperty.- Parameters:
-
styleable- Thethisreference of the returned property. This is also the property bean. -
propertyName- The field name of the StyleableProperty<String> -
cssProperty- The CSS property name - Returns:
- a StyleableProperty created using previously created CssMetaData
- Throws:
-
IllegalArgumentException- ifcssPropertyis null or empty -
NoSuchElementException- if the CssMetaData forcssPropertywas not created prior to this method invocation
createBooleanCssMetaData
public final CssMetaData<S,Boolean> createBooleanCssMetaData(String property, Function<S,StyleableProperty<Boolean>> function, boolean initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Boolean> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createBooleanCssMetaData
public final CssMetaData<S,Boolean> createBooleanCssMetaData(String property, Function<S,StyleableProperty<Boolean>> function, boolean initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Boolean> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createBooleanCssMetaData
public final CssMetaData<S,Boolean> createBooleanCssMetaData(String property, Function<S,StyleableProperty<Boolean>> function)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Boolean> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with false initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createColorCssMetaData
public final CssMetaData<S,Color> createColorCssMetaData(String property, Function<S,StyleableProperty<Color>> function, Color initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Color> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createColorCssMetaData
public final CssMetaData<S,Color> createColorCssMetaData(String property, Function<S,StyleableProperty<Color>> function, Color initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Color> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createColorCssMetaData
public final CssMetaData<S,Color> createColorCssMetaData(String property, Function<S,StyleableProperty<Color>> function)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Color> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createDurationCssMetaData
public final CssMetaData<S,Duration> createDurationCssMetaData(String property, Function<S,StyleableProperty<Duration>> function, Duration initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Duration> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createDurationCssMetaData
public final CssMetaData<S,Duration> createDurationCssMetaData(String property, Function<S,StyleableProperty<Duration>> function, Duration initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Duration> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createDurationCssMetaData
public final CssMetaData<S,Duration> createDurationCssMetaData(String property, Function<S,StyleableProperty<Duration>> function)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Duration> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createEffectCssMetaData
public final <E extends Effect> CssMetaData<S,E> createEffectCssMetaData(String property, Function<S,StyleableProperty<E>> function, E initialValue, boolean inherits)
- Type Parameters:
-
E- The CssMetaData created with initial value and inherit flag - Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Effect> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createEffectCssMetaData
public final <E extends Effect> CssMetaData<S,E> createEffectCssMetaData(String property, Function<S,StyleableProperty<E>> function, E initialValue)
- Type Parameters:
-
E- The CssMetaData created with initial value and false inherit flag - Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Effect> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createEffectCssMetaData
public final <E extends Effect> CssMetaData<S,E> createEffectCssMetaData(String property, Function<S,StyleableProperty<E>> function)
- Type Parameters:
-
E- The CssMetaData created with null initial value and false inherit flag - Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Effect> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with null initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createEnumCssMetaData
public final <E extends Enum<E>> CssMetaData<S,E> createEnumCssMetaData(Class<? extends Enum> enumClass, String property, Function<S,StyleableProperty<E>> function, E initialValue, boolean inherits)
- Type Parameters:
-
E- The CssMetaData created with initial value and inherit flag - Parameters:
-
enumClass- The Enum class that is the type of the CssMetaData<E extends Enum<E>>. -
property- The CSS property name. -
function- A function that returns the StyleableProperty<Enum> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createEnumCssMetaData
public final <E extends Enum<E>> CssMetaData<S,E> createEnumCssMetaData(Class<? extends Enum> enumClass, String property, Function<S,StyleableProperty<E>> function, E initialValue)
- Type Parameters:
-
E- The CssMetaData created with initial value and false inherit flag - Parameters:
-
enumClass- The Enum class that is the type of the CssMetaData<E extends Enum<E>>. -
property- The CSS property name. -
function- A function that returns the StyleableProperty<Enum> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createEnumCssMetaData
public final <E extends Enum<E>> CssMetaData<S,E> createEnumCssMetaData(Class<? extends Enum> enumClass, String property, Function<S,StyleableProperty<E>> function)
- Type Parameters:
-
E- The CssMetaData created with null initial value and false inherit flag - Parameters:
-
enumClass- The Enum class that is the type of the CssMetaData<E extends Enum<E>>. -
property- The CSS property name. -
function- A function that returns the StyleableProperty<Enum> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with null initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createFontCssMetaData
public final CssMetaData<S,Font> createFontCssMetaData(String property, Function<S,StyleableProperty<Font>> function, Font initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Font> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createFontCssMetaData
public final CssMetaData<S,Font> createFontCssMetaData(String property, Function<S,StyleableProperty<Font>> function, Font initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Font> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and true inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createFontCssMetaData
public final CssMetaData<S,Font> createFontCssMetaData(String property, Function<S,StyleableProperty<Font>> function)
Font.getDefault(), and inherit flag defaulting to true.- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Font> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with initial value, and true inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createInsetsCssMetaData
public final CssMetaData<S,Insets> createInsetsCssMetaData(String property, Function<S,StyleableProperty<Insets>> function, Insets initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Insets> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createInsetsCssMetaData
public final CssMetaData<S,Insets> createInsetsCssMetaData(String property, Function<S,StyleableProperty<Insets>> function, Insets initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Insets> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createInsetsCssMetaData
public final CssMetaData<S,Insets> createInsetsCssMetaData(String property, Function<S,StyleableProperty<Insets>> function)
Insets.EMPTY, and inherit flag defaulting to false.- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Insets> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createPaintCssMetaData
public final CssMetaData<S,Paint> createPaintCssMetaData(String property, Function<S,StyleableProperty<Paint>> function, Paint initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Paint> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createPaintCssMetaData
public final CssMetaData<S,Paint> createPaintCssMetaData(String property, Function<S,StyleableProperty<Paint>> function, Paint initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Paint> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createPaintCssMetaData
public final CssMetaData<S,Paint> createPaintCssMetaData(String property, Function<S,StyleableProperty<Paint>> function)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Paint> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createSizeCssMetaData
public final CssMetaData<S,Number> createSizeCssMetaData(String property, Function<S,StyleableProperty<Number>> function, Number initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Number> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createSizeCssMetaData
public final CssMetaData<S,Number> createSizeCssMetaData(String property, Function<S,StyleableProperty<Number>> function, Number initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Number> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createSizeCssMetaData
public final CssMetaData<S,Number> createSizeCssMetaData(String property, Function<S,StyleableProperty<Number>> function)
0d, and inherit flag defaulting to false.- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<Number> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createStringCssMetaData
public final CssMetaData<S,String> createStringCssMetaData(String property, Function<S,StyleableProperty<String>> function, String initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<String> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createStringCssMetaData
public final CssMetaData<S,String> createStringCssMetaData(String property, Function<S,StyleableProperty<String>> function, String initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<String> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createStringCssMetaData
public final CssMetaData<S,String> createStringCssMetaData(String property, Function<S,StyleableProperty<String>> function)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<String> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with null initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createUrlCssMetaData
public final CssMetaData<S,String> createUrlCssMetaData(String property, Function<S,StyleableProperty<String>> function, String initialValue, boolean inherits)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<String> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. -
inherits- Whether or not the CSS style can be inherited by child nodes - Returns:
- a CssMetaData created with initial value, and inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createUrlCssMetaData
public final CssMetaData<S,String> createUrlCssMetaData(String property, Function<S,StyleableProperty<String>> function, String initialValue)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<String> that corresponds to this CssMetaData. -
initialValue- The initial value of the property. CSS may reset the property to this value. - Returns:
- a CssMetaData created with initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
createUrlCssMetaData
public final CssMetaData<S,String> createUrlCssMetaData(String property, Function<S,StyleableProperty<String>> function)
- Parameters:
-
property- The CSS property name. -
function- A function that returns the StyleableProperty<String> that corresponds to this CssMetaData. - Returns:
- a CssMetaData created with null initial value, and false inherit flag
- Throws:
-
IllegalArgumentException- ifpropertyis null or an empty string, orfunctionis null.
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.