public final class PropertyUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T,U> void |
bindBidirectionalWithConverter(javafx.beans.property.Property<T> sourceProperty,
javafx.beans.property.Property<U> bindingTarget,
java.util.function.Function<? super T,? extends U> t2uConverter,
java.util.function.Function<? super U,? extends T> u2tConverter)
Binds two properties bidirectionally.
|
static <K,V,T extends V> |
bindToMapBidirectionally(javafx.beans.property.Property<T> property,
javafx.collections.ObservableMap<K,V> map,
K key,
java.util.function.Function<V,T> v2t)
Binds a property to a specific key in a map.
|
static <T,U> void |
bindWithConverter(javafx.beans.property.Property<T> firstProperty,
javafx.beans.property.Property<U> secondProperty,
java.util.function.Function<U,T> u2tConverter)
Binds
firstProperty to secondProperty , using a conversion function to map
values of type U to T so the first property can be bound. |
static <T> javafx.collections.ObservableList<T> |
combineLists(javafx.collections.ObservableList<T> first,
javafx.collections.ObservableList<T> second)
Combines multiple observable lists into a single one.
|
public static <T,U> void bindBidirectionalWithConverter(javafx.beans.property.Property<T> sourceProperty, javafx.beans.property.Property<U> bindingTarget, java.util.function.Function<? super T,? extends U> t2uConverter, java.util.function.Function<? super U,? extends T> u2tConverter)
Bindings
because the two properties can be of any type, not just
the same type (eg sourceProperty
can be String
and bindingTarget
can be
Double
and the bindings will "just work").
Note: the source property will have its value set to the converted value of the binding target.
The converters will not be called if a value changes to null
; instead, the corresponding
property has its value set directly to null
.
sourceProperty
- the property to apply the binding tobindingTarget
- the property to bind tot2uConverter
- the conversion function to convert values of type T
to U
u2tConverter
- the conversion function to convert values of type U
to T
public static <T,U> void bindWithConverter(javafx.beans.property.Property<T> firstProperty, javafx.beans.property.Property<U> secondProperty, java.util.function.Function<U,T> u2tConverter)
firstProperty
to secondProperty
, using a conversion function to map
values of type U
to T
so the first property can be bound.firstProperty
- the property to bindsecondProperty
- the property to bind tou2tConverter
- the conversion functionpublic static <K,V,T extends V> void bindToMapBidirectionally(javafx.beans.property.Property<T> property, javafx.collections.ObservableMap<K,V> map, K key, java.util.function.Function<V,T> v2t)
K
- the types of the keys in the mapV
- the types of the values in the mapT
- the type of data in the propertyproperty
- the property to bindmap
- the map to bind tokey
- the key for the entry to bind tov2t
- a conversion function for converting objects of type V to type Tpublic static <T> javafx.collections.ObservableList<T> combineLists(javafx.collections.ObservableList<T> first, javafx.collections.ObservableList<T> second)
second
to the end first
. Subsequent additions to either list will be appended to the end of
the combined list. Removing items from either list will also remove those specific items; in this case,
reference equality is used instead of object equality to ensure that only the exact objects that were removed from
the original list are removed from the combined one.T
- the type of data in the listsfirst
- the first listsecond
- the second list