Class ContainerAutoCompleteTextDataBinding<T,V>
java.lang.Object
com.amalgamasimulation.desktop.binding.widgets.AbstractTextDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.AbstractAutoCompleteTextDataBinding<V>
com.amalgamasimulation.desktop.binding.widgets.ContainerAutoCompleteTextDataBinding<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:
EmfAutoCompleteTextDataBinding
public class ContainerAutoCompleteTextDataBinding<T,V>
extends AbstractAutoCompleteTextDataBinding<V>
implements ContainerDataBinding<T,V>
A specialized auto-complete text binding implementation that works with container objects.
Extends
AbstractAutoCompleteTextDataBinding and implements ContainerDataBinding
to provide container-aware auto-complete functionality with EMF support.- 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 text control.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.AbstractAutoCompleteTextDataBinding
comparator, filter, valuesFields inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractTextDataBinding
background, canBeNull, controlDecoration, readonly, strategy, text -
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).protected StringFormats a value for display in the auto-complete dropdown.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, 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.AbstractAutoCompleteTextDataBinding
setComparator, setFilter, valuesMethods inherited from class com.amalgamasimulation.desktop.binding.widgets.AbstractTextDataBinding
background, canBeNull, enable, isSenseless, readonly, setControl, strategyMethods 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 text control. -
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
-
ContainerAutoCompleteTextDataBinding
public ContainerAutoCompleteTextDataBinding()
-
-
Method Details
-
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 classAbstractTextDataBinding<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 classAbstractTextDataBinding<V>
-
createBinding
public void createBinding()Description copied from interface:AbstractDataBindingCreates and initializes the data binding.- Specified by:
createBindingin interfaceAbstractDataBinding<T>- Overrides:
createBindingin classAbstractAutoCompleteTextDataBinding<V>
-
format
Description copied from class:AbstractAutoCompleteTextDataBindingFormats a value for display in the auto-complete dropdown. Must be implemented by concrete subclasses.- Specified by:
formatin classAbstractAutoCompleteTextDataBinding<V>- Parameters:
value- The value to format- Returns:
- String representation of the value
-
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.
-
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
-
nameExtractor
public ContainerAutoCompleteTextDataBinding<T,V> nameExtractor(BiFunction<T, V, String> 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
-
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 ContainerAutoCompleteTextDataBinding<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
-