Class ContainerBooleanDataBinding<T>
java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
com.amalgamasimulation.desktop.binding.widgets.ContainerBooleanDataBinding<T>
- Type Parameters:
T- The type of the container object
- All Implemented Interfaces:
AbstractDataBinding<Boolean>,ContainerDataBinding<T,Boolean>
- Direct Known Subclasses:
EmfBooleanDataBinding
public class ContainerBooleanDataBinding<T>
extends AbstractBooleanDataBinding
implements ContainerDataBinding<T,Boolean>
A specialized boolean data binding implementation that works with container objects.
Extends
AbstractBooleanDataBinding and implements ContainerDataBinding
to provide container-aware boolean binding functionality.- Author:
- Ionov Ivan
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.core.databinding.observable.value.IObservableValue<T> The observable container value that holds the boolean state.protected BiConsumer<T, Boolean> Handler that processes new boolean values and updates the container.protected org.eclipse.core.databinding.observable.value.IValueChangeListener<Object> Listener that handles container value changes and updates the checkbox state.Function that extracts the boolean value from the container.Fields inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
checkbox -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontainerObservable(org.eclipse.core.databinding.observable.value.IObservableValue<T> containerObservable) Sets the observable container instance.voidCreates and initializes the data binding.voidPerforms an action when the value changes.voidExecutes the binding to pull data from UI control to model.voidExecutes the binding to push data from model to UI control (target).org.eclipse.core.databinding.observable.value.IObservableValue<T> Gets the observable container that holds the bound value.getValue()Gets the current value from the binding.handler(BiConsumer<T, Boolean> handler) Sets the handler function that updates the container with new boolean values.valueExtractor(Function<T, Boolean> valueExtractor) Sets the value extractor function that gets the boolean state from the container.Methods inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
enable, 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, enable, setControl
-
Field Details
-
containerObservable
The observable container value that holds the boolean state. Defaults to an empty writable value. -
modelChangeListener
protected org.eclipse.core.databinding.observable.value.IValueChangeListener<Object> modelChangeListenerListener that handles container value changes and updates the checkbox state. -
valueExtractor
Function that extracts the boolean value from the container. Defaults to a function that always returns false. -
handler
Handler that processes new boolean values and updates the container. Defaults to a no-op consumer.
-
-
Constructor Details
-
ContainerBooleanDataBinding
public ContainerBooleanDataBinding()
-
-
Method Details
-
valueExtractor
Sets the value extractor function that gets the boolean state from the container.- Parameters:
valueExtractor- The function to extract the boolean value- Returns:
- this binding instance for method chaining
-
handler
Sets the handler function that updates the container with new boolean values.- Parameters:
handler- The function to handle container updates- Returns:
- this binding instance for method chaining
-
containerObservable
public ContainerBooleanDataBinding<T> 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
-
getContainer
Description copied from interface:ContainerDataBindingGets the observable container that holds the bound value.- Specified by:
getContainerin interfaceContainerDataBinding<T,Boolean> - Returns:
- An
IObservableValuerepresenting the container object. The container itself is observable and will notify listeners of changes.
-
getValue
Description copied from interface:AbstractDataBindingGets the current value from the binding.- Specified by:
getValuein interfaceAbstractDataBinding<T>- Returns:
- The current value of type V
-
doAction
Description copied from interface:AbstractDataBindingPerforms an action when the value changes.- Specified by:
doActionin interfaceAbstractDataBinding<T>- Parameters:
newNalue- The new value being set
-
executeToTarget
public void executeToTarget()Description copied from interface:AbstractDataBindingExecutes the binding to push data from model to UI control (target).- Specified by:
executeToTargetin interfaceAbstractDataBinding<T>- Overrides:
executeToTargetin classAbstractBooleanDataBinding
-
executeToModel
public void executeToModel()Description copied from interface:AbstractDataBindingExecutes the binding to pull data from UI control to model.- Specified by:
executeToModelin interfaceAbstractDataBinding<T>- Overrides:
executeToModelin classAbstractBooleanDataBinding
-
createBinding
public void createBinding()Description copied from interface:AbstractDataBindingCreates and initializes the data binding.- Specified by:
createBindingin interfaceAbstractDataBinding<T>- Overrides:
createBindingin classAbstractBooleanDataBinding
-