Package cz.masci.springfx.mvci.util
Class BindingUtils
java.lang.Object
cz.masci.springfx.mvci.util.BindingUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T,U extends javafx.beans.property.Property<T>, V>
voidbindNullableBidirectional(javafx.beans.value.ObservableValue<V> source, List<org.apache.commons.lang3.tuple.Triple<U, Function<V, U>, T>> propertyList) Create bidirectional bindings between properties of nullable object and another properties.<T,U extends javafx.beans.property.Property<T>, V>
voidbindNullableBidirectional(javafx.beans.value.ObservableValue<V> source, U property, Function<V, U> sourceProperty, T defaultValue) Create bidirectional bindings between property of nullable object and another property.
-
Constructor Details
-
BindingUtils
public BindingUtils()
-
-
Method Details
-
bindNullableBidirectional
public <T,U extends javafx.beans.property.Property<T>, void bindNullableBidirectionalV> (javafx.beans.value.ObservableValue<V> source, U property, Function<V, U> sourceProperty, T defaultValue) Create bidirectional bindings between property of nullable object and another property. It solves bidirectional bindings problem when trying bind property in observable value which could be null with another property.- Type Parameters:
T- Property value type. Is same for source property and property.U- Property type of source property and property.V- Source value type.- Parameters:
source- Nullable observable value object. Means that the result ofObservableValue.getValue()could return null.property- Another property the source property will be bind to if the source observable value is not null. Otherwise, property value is set to the default value.sourceProperty- Source value property which will be bind to the destination property if the source value is not null.defaultValue- Default value when the source value is null.
-
bindNullableBidirectional
public <T,U extends javafx.beans.property.Property<T>, void bindNullableBidirectionalV> (javafx.beans.value.ObservableValue<V> source, List<org.apache.commons.lang3.tuple.Triple<U, Function<V, U>, T>> propertyList) Create bidirectional bindings between properties of nullable object and another properties. It solves bidirectional bindings problem when trying bind property in observable value which could be null with another property.The list could contain values with the same type only.
- Type Parameters:
T- Property value type. Is same for source property and property.U- Property type of source property and property.V- Source value type.- Parameters:
source- Nullable observable value object. Means that the result ofObservableValue.getValue()could return null.propertyList- List of properties which should be boundbindNullableBidirectional(ObservableValue, Property, Function, Object).
Each item contains:property, sourceProperty, defaultValue
-