Class BooleanDataBinding

java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
com.amalgamasimulation.desktop.binding.widgets.BooleanDataBinding
All Implemented Interfaces:
AbstractDataBinding<Boolean>

public class BooleanDataBinding extends AbstractBooleanDataBinding
A concrete implementation of AbstractBooleanDataBinding that uses functional interfaces for value access and modification. Provides a fluent API for configuring boolean data bindings.
Author:
Ionov Ivan
See Also:
  • Field Details

    • valueExtractor

      protected BooleanSupplier valueExtractor
      The function that provides the current boolean value from the model. Defaults to a function that always returns false.
    • handler

      protected Consumer<Boolean> handler
      The function that handles new boolean values when they change. Defaults to a no-op consumer.
  • Constructor Details

    • BooleanDataBinding

      public BooleanDataBinding()
  • Method Details

    • valueExtractor

      public BooleanDataBinding valueExtractor(BooleanSupplier valueExtractor)
      Sets the value extractor function that provides the current boolean state.
      Parameters:
      valueExtractor - The function to get the current value
      Returns:
      this binding instance for method chaining
    • handler

      public BooleanDataBinding handler(Consumer<Boolean> handler)
      Sets the handler function that processes new boolean values.
      Parameters:
      handler - The function to handle value changes
      Returns:
      this binding instance for method chaining
    • getValue

      public Boolean getValue()
      Description copied from interface: AbstractDataBinding
      Gets the current value from the binding.
      Returns:
      The current value of type V
    • doAction

      public void doAction(Boolean newNalue)
      Description copied from interface: AbstractDataBinding
      Performs an action when the value changes.
      Parameters:
      newNalue - The new value being set