Class TextDataBinding<V>

java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractTextDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.TextDataBinding<V>
Type Parameters:
V - The type of the model value being bound
All Implemented Interfaces:
AbstractDataBinding<V>

public class TextDataBinding<V> extends AbstractTextDataBinding<V>
A concrete implementation of AbstractTextDataBinding that uses functional interfaces for value access and modification. Provides a fluent API for configuring text-based 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 text changes. Defaults to a no-op consumer.
  • Constructor Details

    • TextDataBinding

      public TextDataBinding()
  • Method Details

    • 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
    • valueExtractor

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

      public TextDataBinding<V> handler(Consumer<V> handler)
      Sets the handler function that processes new values from text input.
      Parameters:
      handler - The consumer function to handle value changes
      Returns:
      this binding instance for method chaining