本文整理匯總了Java中javafx.beans.property.Property.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Property.getValue方法的具體用法?Java Property.getValue怎麽用?Java Property.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.beans.property.Property
的用法示例。
在下文中一共展示了Property.getValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bindBidirectional
import javafx.beans.property.Property; //導入方法依賴的package包/類
/**
* Binds a {@link Property} by traversing the bean's field tree
*
* @param fieldPath
* the <b><code>.</code></b> separated field paths relative to
* the {@link #getBean()} that will be traversed
* @param property
* the {@link Property} to bind to the field class type of the
* property
* @param propertyType
* the class type of the {@link Property} value
*/
@SuppressWarnings("unchecked")
public <T> void bindBidirectional(final String fieldPath,
final Property<T> property, final Class<T> propertyType) {
Class<T> clazz = propertyType != null ? propertyType
: propertyValueClass(property);
if (clazz == null && property.getValue() != null) {
clazz = (Class<T>) property.getValue().getClass();
}
if (clazz == null || clazz == Object.class) {
throw new UnsupportedOperationException(String.format(
"Unable to determine property value class for %1$s "
+ "and declared type %2$s", property, propertyType));
}
getRoot().performOperation(fieldPath, property, clazz,
FieldBeanOperation.BIND);
}
示例2: save
import javafx.beans.property.Property; //導入方法依賴的package包/類
/**
* Saves a property to a preferences object.
*
* @param property the property to save
* @param preferences the preferences object to save to
* @param serializer a function to use to convert the property's value to a String that can be stored in
* @param <T> the type of the property
*
* @throws IllegalArgumentException if the value of the property is null
*/
public static <T> void save(Property<? extends T> property,
Preferences preferences,
Function<? super T, String> serializer) {
T value = property.getValue();
if (value == null) {
throw new IllegalArgumentException("The property must have a value");
}
preferences.put(property.getName(), serializer.apply(value));
}
示例3: FlushableProperty
import javafx.beans.property.Property; //導入方法依賴的package包/類
/**
* Create a new FlushableProperty.
*
* @param property The property to flush to
*/
public FlushableProperty(Property<T> property) {
super(property.getBean(), property.getName(), property.getValue());
this.property = property;
}
示例4: SimpleStyleableObjectPropertyWrapper
import javafx.beans.property.Property; //導入方法依賴的package包/類
/**
* Creates a new styleable property that wraps another.
*
* @param cssMetaData the CSS metadata describing this styleable property
* @param property the property to wrap
*/
public SimpleStyleableObjectPropertyWrapper(CssMetaData<? extends Styleable, T> cssMetaData, Property<T> property) {
super(cssMetaData, property.getBean(), property.getName(), property.getValue());
addListener((__, prev, cur) -> property.setValue(cur));
}