Class AbstractBooleanDataBinding
java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractBooleanDataBinding
- All Implemented Interfaces:
AbstractDataBinding<Boolean>
- Direct Known Subclasses:
BooleanDataBinding,ContainerBooleanDataBinding
public abstract class AbstractBooleanDataBinding
extends Object
implements AbstractDataBinding<Boolean>
An abstract implementation of
AbstractDataBinding for binding boolean values to SWT Button controls
(typically used for checkboxes). This class handles the two-way synchronization between a boolean model value
and an SWT checkbox widget.
The binding automatically:
- Updates the checkbox state when the model changes
- Updates the model when the checkbox is toggled by the user
- Prevents unnecessary updates when values haven't actually changed
- Author:
- Ionov Ivan
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates and initializes the data binding.voidenable(boolean enable) Enables or disables the bound control.voidExecutes the binding to pull data from UI control to model.voidExecutes the binding to push data from model to UI control (target).protected booleanisSenseless(Object oldValue, Object newValue) voidsetControl(Object control) Sets the UI control for this binding.voidMethods 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, doAction, getValue
-
Field Details
-
checkbox
protected org.eclipse.swt.widgets.Button checkbox
-
-
Constructor Details
-
AbstractBooleanDataBinding
public AbstractBooleanDataBinding()
-
-
Method Details
-
executeToTarget
public void executeToTarget()Description copied from interface:AbstractDataBindingExecutes the binding to push data from model to UI control (target).- Specified by:
executeToTargetin interfaceAbstractDataBinding<Boolean>
-
enable
public void enable(boolean enable) Description copied from interface:AbstractDataBindingEnables or disables the bound control.- Specified by:
enablein interfaceAbstractDataBinding<Boolean>- Parameters:
enable- true to enable, false to disable
-
executeToModel
public void executeToModel()Description copied from interface:AbstractDataBindingExecutes the binding to pull data from UI control to model.- Specified by:
executeToModelin interfaceAbstractDataBinding<Boolean>
-
updateEnable
public void updateEnable() -
createBinding
public void createBinding()Description copied from interface:AbstractDataBindingCreates and initializes the data binding.- Specified by:
createBindingin interfaceAbstractDataBinding<Boolean>
-
isSenseless
-
setControl
Description copied from interface:AbstractDataBindingSets the UI control for this binding.- Specified by:
setControlin interfaceAbstractDataBinding<Boolean>- Parameters:
control- The control to bind to
-