Class ComboboxDataBinding<V>

java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractComboboxDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.ComboboxDataBinding<V>
Type Parameters:
V - The type of selectable values
All Implemented Interfaces:
AbstractDataBinding<V>, AbstractSelectObjectDataBinding<V>

public class ComboboxDataBinding<V> extends AbstractComboboxDataBinding<V>
A concrete implementation of AbstractComboboxDataBinding that uses functional interfaces for value access, modification, and display formatting. Provides a fluent API for configuring combo box data bindings.
Author:
Ionov Ivan
See Also:
  • Field Details

    • valueExtractor

      protected Supplier<V> valueExtractor
      The function that provides the current model value. Defaults to a supplier that returns null.
    • handler

      protected Consumer<V> handler
      The function that handles new values when selected. Defaults to a no-op consumer.
    • nameExtractor

      protected Function<V,String> nameExtractor
      The function that formats values for display in the combo box. Defaults to standard String.valueOf() conversion.
  • Constructor Details

    • ComboboxDataBinding

      public ComboboxDataBinding()
  • Method Details

    • getLabelProvider

      protected org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()
      Creates a custom label provider that uses the name extractor function.
      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.
      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.
      Parameters:
      newNalue - The new value being set
    • nameExtractor

      public ComboboxDataBinding<V> nameExtractor(Function<V,String> nameExtractor)
      Sets the function that formats values for display.
      Parameters:
      nameExtractor - The formatting function
      Returns:
      this binding instance for method chaining
    • valueExtractor

      public ComboboxDataBinding<V> valueExtractor(Supplier<V> valueExtractor)
      Sets the value extractor function.
      Parameters:
      valueExtractor - The supplier function to get the current value
      Returns:
      this binding instance for method chaining
    • handler

      public ComboboxDataBinding<V> handler(Consumer<V> handler)
      Sets the handler function for selection changes.
      Parameters:
      handler - The consumer function to handle new values
      Returns:
      this binding instance for method chaining