Class ContainerComboboxDataBinding<T,V>

java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractComboboxDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.ContainerComboboxDataBinding<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>, AbstractSelectObjectDataBinding<V>, ContainerDataBinding<T,V>
Direct Known Subclasses:
EmfComboboxDataBinding

public class ContainerComboboxDataBinding<T,V> extends AbstractComboboxDataBinding<V> implements ContainerDataBinding<T,V>
A specialized combo box binding implementation that works with container objects. Extends AbstractComboboxDataBinding and implements ContainerDataBinding to provide container-aware combo box 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 combo box.
    • valueExtractor

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

      protected BiFunction<T,V,String> nameExtractor
      Function that formats values for display with container context. Defaults to standard String.valueOf() conversion.
    • handler

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

    • ContainerComboboxDataBinding

      public ContainerComboboxDataBinding()
  • Method Details

    • getLabelProvider

      protected org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()
      Creates a custom label provider that uses the container-aware name extractor.
      Overrides:
      getLabelProvider in class AbstractComboboxDataBinding<V>
      Returns:
      Configured label provider instance
    • 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 AbstractComboboxDataBinding<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 AbstractComboboxDataBinding<V>
    • valueExtractor

      public ContainerComboboxDataBinding<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 ContainerComboboxDataBinding<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 ContainerComboboxDataBinding<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
    • nameExtractor

      public ContainerComboboxDataBinding<T,V> nameExtractor(BiFunction<T,V,String> nameExtractor)
      Sets the name extractor function that formats values with container context.
      Parameters:
      nameExtractor - The function to format values for display
      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 AbstractComboboxDataBinding<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.