Class BooleanDataBinding
java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
com.amalgamasimulation.desktop.binding.widgets.BooleanDataBinding
- All Implemented Interfaces:
AbstractDataBinding<Boolean>
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 Summary
FieldsModifier and TypeFieldDescriptionThe function that handles new boolean values when they change.protected BooleanSupplierThe function that provides the current boolean value from the model.Fields inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
checkbox -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidPerforms an action when the value changes.getValue()Gets the current value from the binding.Sets the handler function that processes new boolean values.valueExtractor(BooleanSupplier valueExtractor) Sets the value extractor function that provides the current boolean state.Methods inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
createBinding, enable, executeToModel, executeToTarget, isSenseless, setControl, updateEnableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.amalgamasimulation.desktop.binding.widgets.AbstractDataBinding
createControlDecoration
-
Field Details
-
valueExtractor
The function that provides the current boolean value from the model. Defaults to a function that always returns false. -
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
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
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
Description copied from interface:AbstractDataBindingGets the current value from the binding.- Returns:
- The current value of type V
-
doAction
Description copied from interface:AbstractDataBindingPerforms an action when the value changes.- Parameters:
newNalue- The new value being set
-