Class AbstractComboboxDataBinding<V>
java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractComboboxDataBinding<V>
- Type Parameters:
V- The type of selectable values
- All Implemented Interfaces:
AbstractDataBinding<V>,AbstractSelectObjectDataBinding<V>
- Direct Known Subclasses:
ComboboxDataBinding,ContainerComboboxDataBinding
public abstract class AbstractComboboxDataBinding<V>
extends Object
implements AbstractSelectObjectDataBinding<V>
Abstract base class for combo box data bindings with support for filtering,
sorting, and validation of selectable values. Provides core functionality
for binding SWT
ComboViewer controls to model values.- Author:
- Ionov Ivan
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BooleanSupplierSupplier determining whether null values are allowed.protected org.eclipse.jface.viewers.ComboViewerThe bound combo viewer control.protected Comparator<V> Comparator for sorting values in the combo box.protected org.eclipse.jface.viewers.IStructuredContentProviderContent provider for the combo viewer.protected org.eclipse.jface.fieldassist.ControlDecorationControl decoration for displaying validation errors.Filter predicate for limiting available values in the combo box.The list of available values for selection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcanBeNull(BooleanSupplier canBeNull) Sets whether null values are permitted in the combo box.voidCreates 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 org.eclipse.jface.viewers.IBaseLabelProviderGets the label provider for the combo viewer.voidsetComparator(Comparator<V> comparator) Sets a comparator to define the sorting order of values.voidsetControl(Object control) Sets the UI control for this binding.voidSets a filter predicate to determine which values should be included.voidSets the complete list of available values for selection.Methods 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
-
comboViewer
protected org.eclipse.jface.viewers.ComboViewer comboViewerThe bound combo viewer control. -
filter
Filter predicate for limiting available values in the combo box. Null means no filtering is applied. -
comparator
Comparator for sorting values in the combo box. Null means no sorting is applied. -
values
The list of available values for selection. -
canBeNull
Supplier determining whether null values are allowed. Defaults to false (null values not allowed). -
controlDecoration
protected org.eclipse.jface.fieldassist.ControlDecoration controlDecorationControl decoration for displaying validation errors. -
contentProvider
protected org.eclipse.jface.viewers.IStructuredContentProvider contentProviderContent provider for the combo viewer. Defaults toArrayContentProvider.
-
-
Constructor Details
-
AbstractComboboxDataBinding
public AbstractComboboxDataBinding()
-
-
Method Details
-
getLabelProvider
protected org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()Gets the label provider for the combo viewer. Can be overridden by subclasses to provide custom labeling.- Returns:
- The label provider instance
-
executeToTarget
public void executeToTarget()Description copied from interface:AbstractDataBindingExecutes the binding to push data from model to UI control (target).- Specified by:
executeToTargetin interfaceAbstractDataBinding<V>
-
executeToModel
public void executeToModel()Description copied from interface:AbstractDataBindingExecutes the binding to pull data from UI control to model.- Specified by:
executeToModelin interfaceAbstractDataBinding<V>
-
createBinding
public void createBinding()Description copied from interface:AbstractDataBindingCreates and initializes the data binding.- Specified by:
createBindingin interfaceAbstractDataBinding<V>
-
enable
public void enable(boolean enable) Description copied from interface:AbstractDataBindingEnables or disables the bound control.- Specified by:
enablein interfaceAbstractDataBinding<V>- Parameters:
enable- true to enable, false to disable
-
values
Description copied from interface:AbstractSelectObjectDataBindingSets the complete list of available values for selection.- Specified by:
valuesin interfaceAbstractSelectObjectDataBinding<V>- Parameters:
values- List of all possible values
-
setControl
Description copied from interface:AbstractDataBindingSets the UI control for this binding.- Specified by:
setControlin interfaceAbstractDataBinding<V>- Parameters:
control- The control to bind to
-
setFilter
Description copied from interface:AbstractSelectObjectDataBindingSets a filter predicate to determine which values should be included.- Specified by:
setFilterin interfaceAbstractSelectObjectDataBinding<V>- Parameters:
filter- Predicate that returns true for values to include
-
setComparator
Description copied from interface:AbstractSelectObjectDataBindingSets a comparator to define the sorting order of values.- Specified by:
setComparatorin interfaceAbstractSelectObjectDataBinding<V>- Parameters:
comparator- Comparator to use for sorting values
-
canBeNull
Sets whether null values are permitted in the combo box.- Parameters:
canBeNull- Supplier that returns true if null values are allowed
-