Class ContainerComboboxDataBinding<T,V>
java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractComboboxDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.ContainerComboboxDataBinding<T,V>
- Type Parameters:
T- The type of the container objectV- The type of the bound value within the container
- All Implemented Interfaces:
AbstractDataBinding<V>,AbstractSelectObjectDataBinding<V>,ContainerDataBinding<T,V>
- Direct Known Subclasses:
EmfComboboxDataBinding
public class ContainerComboboxDataBinding<T,V>
extends AbstractComboboxDataBinding<V>
implements ContainerDataBinding<T,V>
A specialized combo box binding implementation that works with container objects.
Extends
AbstractComboboxDataBinding and implements ContainerDataBinding
to provide container-aware combo box 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 bound value.protected BiConsumer<T, V> Handler that processes new values and updates the container.protected org.eclipse.core.databinding.observable.value.IValueChangeListener<Object> Listener that handles container value changes and updates the combo box.protected BiFunction<T, V, String> Function that formats values for display with container context.Function that extracts the value from the container.Fields inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractComboboxDataBinding
canBeNull, comboViewer, comparator, contentProvider, controlDecoration, filter, values -
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.protected org.eclipse.jface.viewers.IBaseLabelProviderCreates a custom label provider that uses the container-aware name extractor.getValue()Gets the current value from the binding.handler(BiConsumer<T, V> handler) Sets the handler function that updates the container with new values.nameExtractor(BiFunction<T, V, String> nameExtractor) Sets the name extractor function that formats values with container context.valueExtractor(Function<T, V> valueExtractor) Sets the value extractor function that gets the value from the container.Methods inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractComboboxDataBinding
canBeNull, enable, setComparator, setControl, setFilter, valuesMethods 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 bound value. 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 combo box. -
valueExtractor
Function that extracts the value from the container. Defaults to a function that always returns null. -
nameExtractor
Function that formats values for display with container context. Defaults to standard String.valueOf() conversion. -
handler
Handler that processes new values and updates the container. Defaults to a no-op consumer.
-
-
Constructor Details
-
ContainerComboboxDataBinding
public ContainerComboboxDataBinding()
-
-
Method Details
-
getLabelProvider
protected org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()Creates a custom label provider that uses the container-aware name extractor.- Overrides:
getLabelProviderin classAbstractComboboxDataBinding<V>- Returns:
- Configured label provider instance
-
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 classAbstractComboboxDataBinding<V>
-
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 classAbstractComboboxDataBinding<V>
-
valueExtractor
Sets the value extractor function that gets the value from the container.- Parameters:
valueExtractor- The function to extract the value- Returns:
- this binding instance for method chaining
-
handler
Sets the handler function that updates the container with new values.- Parameters:
handler- The function to handle container updates- Returns:
- this binding instance for method chaining
-
containerObservable
public ContainerComboboxDataBinding<T,V> 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
-
nameExtractor
Sets the name extractor function that formats values with container context.- Parameters:
nameExtractor- The function to format values for display- Returns:
- this binding instance for method chaining
-
createBinding
public void createBinding()Description copied from interface:AbstractDataBindingCreates and initializes the data binding.- Specified by:
createBindingin interfaceAbstractDataBinding<T>- Overrides:
createBindingin classAbstractComboboxDataBinding<V>
-
getContainer
Description copied from interface:ContainerDataBindingGets the observable container that holds the bound value.- Specified by:
getContainerin interfaceContainerDataBinding<T,V> - Returns:
- An
IObservableValuerepresenting the container object. The container itself is observable and will notify listeners of changes.
-