![JAR search and dependency download from the Maven repository](/logo.png)
com.guigarage.css.DefaultPropertyBasedCssMetaData Maven / Gradle / Ivy
package com.guigarage.css;
import javafx.beans.property.Property;
import javafx.css.StyleConverter;
import javafx.css.Styleable;
import javafx.css.StyleableProperty;
/**
* A CssMetaData class that is bound to a specific property that is part of a Styleable instance.
* @param Type of the Styleable instance
* @param Value type of the property
*/
public class DefaultPropertyBasedCssMetaData extends AbstractPropertyBasedCssMetaData {
/**
* Default Constructor
*
* @param property name of the CSS property
* @param converter the StyleConverter used to convert the CSS parsed value to a Java object.
* @param propertyName Name of the property field in the Styleable class
* @param defaultValue The default value of the corresponding StyleableProperty
*/
public DefaultPropertyBasedCssMetaData(String property, StyleConverter, V> converter, String propertyName, V defaultValue) {
super(property, converter, propertyName, defaultValue);
}
protected & StyleableProperty> T getProperty(S styleable) {
try {
return (T) styleable.getClass().getMethod(getPropertyName() + "Property").invoke(styleable);
} catch (Exception e) {
throw new RuntimeException("Can't get StyleableProperty", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy