Class ContainerTextDataBinding<T,V>

java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractTextDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.ContainerTextDataBinding<T,V>
Type Parameters:
T - The type of the container object
V - The type of the bound value within the container
All Implemented Interfaces:
AbstractDataBinding<V>, ContainerDataBinding<T,V>
Direct Known Subclasses:
EmfTextDataBinding

public class ContainerTextDataBinding<T,V> extends AbstractTextDataBinding<V> implements ContainerDataBinding<T,V>
A specialized text data binding implementation that works with container objects. Extends AbstractTextDataBinding and implements ContainerDataBinding to provide container-aware text binding functionality.
Author:
Ionov Ivan
See Also:
  • Field Details

    • containerObservable

      protected org.eclipse.core.databinding.observable.value.IObservableValue<T> containerObservable
      The observable container value that holds the bound value. Defaults to an empty writable value.
    • modelChangeListener

      protected org.eclipse.core.databinding.observable.value.IValueChangeListener<Object> modelChangeListener
      Listener that handles container value changes and updates the text control.
    • valueExtractor

      protected Function<T,V> valueExtractor
      Function that extracts the value from the container. Defaults to a function that always returns null.
    • handler

      protected BiConsumer<T,V> handler
      Handler that processes new values and updates the container. Defaults to a no-op consumer.
  • Constructor Details

    • ContainerTextDataBinding

      public ContainerTextDataBinding()
  • Method Details

    • getValue

      public V getValue()
      Description copied from interface: AbstractDataBinding
      Gets the current value from the binding.
      Specified by:
      getValue in interface AbstractDataBinding<T>
      Returns:
      The current value of type V
    • doAction

      public void doAction(V newNalue)
      Description copied from interface: AbstractDataBinding
      Performs an action when the value changes.
      Specified by:
      doAction in interface AbstractDataBinding<T>
      Parameters:
      newNalue - The new value being set
    • executeToTarget

      public void executeToTarget()
      Description copied from interface: AbstractDataBinding
      Executes the binding to push data from model to UI control (target).
      Specified by:
      executeToTarget in interface AbstractDataBinding<T>
      Overrides:
      executeToTarget in class AbstractTextDataBinding<V>
    • executeToModel

      public void executeToModel()
      Description copied from interface: AbstractDataBinding
      Executes the binding to pull data from UI control to model.
      Specified by:
      executeToModel in interface AbstractDataBinding<T>
      Overrides:
      executeToModel in class AbstractTextDataBinding<V>
    • valueExtractor

      public ContainerTextDataBinding<T,V> valueExtractor(Function<T,V> valueExtractor)
      Sets the value extractor function that gets the value from the container.
      Parameters:
      valueExtractor - The function to extract the value
      Returns:
      this binding instance for method chaining
    • handler

      public ContainerTextDataBinding<T,V> handler(BiConsumer<T,V> handler)
      Sets the handler function that updates the container with new values.
      Parameters:
      handler - The function to handle container updates
      Returns:
      this binding instance for method chaining
    • containerObservable

      public ContainerTextDataBinding<T,V> containerObservable(org.eclipse.core.databinding.observable.value.IObservableValue<T> containerObservable)
      Sets the observable container instance.
      Parameters:
      containerObservable - The observable container value
      Returns:
      this binding instance for method chaining
    • createBinding

      public void createBinding()
      Description copied from interface: AbstractDataBinding
      Creates and initializes the data binding.
      Specified by:
      createBinding in interface AbstractDataBinding<T>
      Overrides:
      createBinding in class AbstractTextDataBinding<V>
    • getContainer

      public org.eclipse.core.databinding.observable.value.IObservableValue<T> getContainer()
      Description copied from interface: ContainerDataBinding
      Gets the observable container that holds the bound value.
      Specified by:
      getContainer in interface ContainerDataBinding<T,V>
      Returns:
      An IObservableValue representing the container object. The container itself is observable and will notify listeners of changes.