Klasse DataBindings

java.lang.Object
org.teamapps.commons.databinding.DataBindings

public final class DataBindings extends Object
  • Konstruktordetails

    • DataBindings

      public DataBindings()
  • Methodendetails

    • createObservableValueFromEmptyEvent

      public static <T> ObservableValue<T> createObservableValueFromEmptyEvent(Event<?> changeEvent, Supplier<T> valueSupplier)
      Creates an ObservableValue, the value of which will always be determined by the given valueSupplier. The given Event will be used only for triggering the onChange method, not for determining its value.
      Typparameter:
      T - type of value
      Parameter:
      changeEvent - Event that will trigger the onChange event.
      valueSupplier - Supplier for the value of the created ObservableValue.
      Gibt zurück:
      the created ObservableValue
    • createObservableValueFromEvent

      public static <T> ObservableValue<T> createObservableValueFromEvent(Event<T> event)
      Creates an ObservableValue that takes its value from the values emitted by the specified Event. These values will be cached. Note that initially, the cached value is going to be null.
      Typparameter:
      T - type of value
      Parameter:
      event - Event the values of the created ObservableValue will be taken from.
      Gibt zurück:
      the created ObservableValue
    • createObservableValueFromEvent

      public static <T> ObservableValue<T> createObservableValueFromEvent(Event<T> event, T initialValue)
      Creates an ObservableValue that takes its value from the values emitted by the specified Event. These values will be cached.
      Typparameter:
      T - type of value
      Parameter:
      event - Event the values of the created ObservableValue will be taken from.
      initialValue - The initial value (before the first occurrence of event).
      Gibt zurück:
      the created ObservableValue
    • createMutableValue

      public static <T> MutableValue<T> createMutableValue(Consumer<T> consumer)
      Creates a MutableValue from a Consumer. Since both interfaces are virtually the same, this is a trivial operation.
      Typparameter:
      T - value type
      Parameter:
      consumer - the consumer.
      Gibt zurück:
      the MutableValue
    • bindOneWay

      public static <T> void bindOneWay(ObservableValue<T> observableValue, MutableValue<T> mutableValue)
    • bindTwoWays

      public static <T> void bindTwoWays(TwoWayBindableValue<T> bindable1, TwoWayBindableValue<T> bindable2)