org.fxmisc.richtext.CustomCssMetaData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
Rich-text area for JavaFX
package org.fxmisc.richtext;
import javafx.css.CssMetaData;
import javafx.css.StyleConverter;
import javafx.css.Styleable;
import javafx.css.StyleableObjectProperty;
import javafx.css.StyleableProperty;
import java.util.function.Function;
/**
* Reduces boilerplate when creating a custom {@link CssMetaData} object
*/
public class CustomCssMetaData extends CssMetaData {
private final Function> property;
CustomCssMetaData(String property, StyleConverter, V> converter, V initialValue,
Function> getStyleableProperty) {
super(property, converter, initialValue);
this.property = getStyleableProperty;
}
@Override
public boolean isSettable(S styleable) {
return !property.apply(styleable).isBound();
}
@Override
public StyleableProperty getStyleableProperty(S styleable) {
return property.apply(styleable);
}
}