Module MaterialFX

Class AbstractBindingHelper<T>

java.lang.Object
io.github.palexdev.materialfx.bindings.base.AbstractBindingHelper<T>
Type Parameters:
T -
Direct Known Subclasses:
BiBindingHelper, BindingHelper

public abstract class AbstractBindingHelper<T> extends Object
Base class for binding helpers.

Specifies common properties such as:

- The 'target', which is the property that will be updated when the source changes

- The action to perform to update the target (also called targetUpdater), it's a BiConsumer that offers both the oldValue and the newValue

- A listener called 'sourceListener', which is added to the source property and triggers the updateTarget(ObservableValue, Object, Object)

Specifies common behaviors such as:

- Abstract base methods to: 'bind' the target to the source, specify the targetUpdater, allow to 'invalidate' the binding and cause computations specified by the helper subclass, specify how to 'dispose' the helper and check if it's been disposed before

- The method responsible for updating the target (triggered by the sourceListener)

- The actions to perform: before/after the target update, before/after the binding, before/after the unbinding

  • Field Details

  • Constructor Details

    • AbstractBindingHelper

      public AbstractBindingHelper()
  • Method Details

    • bind

      public abstract AbstractBindingHelper<T> bind(ObservableValue<? extends T> target)
    • with

      public abstract AbstractBindingHelper<T> with(BiConsumer<T,T> targetUpdater)
    • invalidate

      public abstract void invalidate()
    • dispose

      public abstract void dispose()
    • isDispose

      public abstract boolean isDispose()
    • updateTarget

      protected void updateTarget(ObservableValue<? extends T> source, T oldValue, T newValue)
      Invoked by the sourceListener, it's responsible for updating the specified target using the specified targetUpdater BiConsumer.

      Also calls beforeUpdateTarget() and afterUpdateTarget().

      Parameters:
      source - the source property
      oldValue - the source's oldValue
      newValue - the source's newValue
    • beforeUpdateTarget

      protected void beforeUpdateTarget()
      Empty by default.
    • afterUpdateTarget

      protected void afterUpdateTarget()
      Empty by default.
    • beforeBind

      protected void beforeBind()
      Empty by default.
    • afterBind

      protected void afterBind()
      Empty by default.
    • beforeUnbind

      protected void beforeUnbind()
      Empty by default.
    • afterUnbind

      protected void afterUnbind()
      Empty by default.