Class BindingUtils

java.lang.Object
cz.masci.springfx.mvci.util.BindingUtils

public class BindingUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T, U extends javafx.beans.property.Property<T>, V>
    void
    bindNullableBidirectional(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>
    void
    bindNullableBidirectional(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BindingUtils

      public BindingUtils()
  • Method Details

    • bindNullableBidirectional

      public <T, U extends javafx.beans.property.Property<T>, V> void bindNullableBidirectional(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 of ObservableValue.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>, V> void bindNullableBidirectional(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 of ObservableValue.getValue() could return null.
      propertyList - List of properties which should be bound bindNullableBidirectional(ObservableValue, Property, Function, Object).
      Each item contains: property, sourceProperty, defaultValue