public class DataBindingContext extends Object
bindings
, and aggregates validation statuses of its
bindings, or more generally, its validation status providers.
A DataBindingContext provides the following abilities:
observable
values
.observable
lists
.
Multiple contexts can be used at any point in time. One strategy for the
management of contexts is the aggregation of validation statuses. For example
an IWizardPage
could use a single context and the statuses could
be aggregated to set the page status and fulfillment. Each page in the
IWizard
would have its own context instance.
Constructor and Description |
---|
DataBindingContext()
Creates a data binding context, using the current default realm for the
validation observables.
|
DataBindingContext(Realm validationRealm)
Creates a data binding context using the given realm for the validation
observables.
|
Modifier and Type | Method and Description |
---|---|
void |
addBinding(Binding binding)
Adds the given binding to this data binding context.
|
void |
addValidationStatusProvider(ValidationStatusProvider validationStatusProvider)
Adds the given validation status provider to this data binding context.
|
<T,M> Binding |
bindList(IObservableList<T> targetObservableList,
IObservableList<M> modelObservableList)
Creates a
Binding to synchronize the values of two
observable lists . |
<T,M> Binding |
bindList(IObservableList<T> targetObservableList,
IObservableList<M> modelObservableList,
UpdateListStrategy<? super T,? extends M> targetToModel,
UpdateListStrategy<? super M,? extends T> modelToTarget)
Creates a
Binding to synchronize the values of two
observable lists . |
<T,M> Binding |
bindSet(IObservableSet<T> targetObservableSet,
IObservableSet<M> modelObservableSet)
Creates a
Binding to synchronize the values of two
observable sets . |
<T,M> Binding |
bindSet(IObservableSet<T> targetObservableSet,
IObservableSet<M> modelObservableSet,
UpdateSetStrategy<? super T,? extends M> targetToModel,
UpdateSetStrategy<? super M,? extends T> modelToTarget)
Creates a
Binding to synchronize the values of two
observable sets . |
<T,M> Binding |
bindValue(IObservableValue<T> targetObservableValue,
IObservableValue<M> modelObservableValue)
Creates a
Binding to synchronize the values of two
observable values . |
<T,M> Binding |
bindValue(IObservableValue<T> targetObservableValue,
IObservableValue<M> modelObservableValue,
UpdateValueStrategy<? super T,? extends M> targetToModel,
UpdateValueStrategy<? super M,? extends T> modelToTarget)
Creates a
Binding to synchronize the values of two
observable values . |
protected <M,T> UpdateListStrategy<M,T> |
createModelToTargetUpdateListStrategy(IObservableList<M> modelObservableList,
IObservableList<T> targetObservableList) |
protected <M,T> UpdateSetStrategy<M,T> |
createModelToTargetUpdateSetStrategy(IObservableSet<M> modelObservableSet,
IObservableSet<T> targetObservableSet) |
protected <M,T> UpdateValueStrategy<M,T> |
createModelToTargetUpdateValueStrategy(IObservableValue<M> fromValue,
IObservableValue<T> toValue)
Returns an update value strategy to be used for copying values from the
from value to the to value.
|
protected <T,M> UpdateListStrategy<T,M> |
createTargetToModelUpdateListStrategy(IObservableList<T> targetObservableList,
IObservableList<M> modelObservableList) |
protected <T,M> UpdateSetStrategy<T,M> |
createTargetToModelUpdateSetStrategy(IObservableSet<T> targetObservableSet,
IObservableSet<M> modelObservableSet) |
protected <T,M> UpdateValueStrategy<T,M> |
createTargetToModelUpdateValueStrategy(IObservableValue<T> fromValue,
IObservableValue<M> toValue)
Returns an update value strategy to be used for copying values from the
from value to the to value.
|
void |
dispose()
Disposes of this data binding context and all bindings and validation
status providers that were added to this context.
|
IObservableList<Binding> |
getBindings()
Returns an unmodifiable
IObservableList of all bindings in order
by time of addition. |
Realm |
getValidationRealm()
Returns the validation realm.
|
IObservableMap<Binding,IStatus> |
getValidationStatusMap()
Deprecated.
as of 1.1, please use
getValidationStatusProviders() |
IObservableList<ValidationStatusProvider> |
getValidationStatusProviders()
Returns an unmodifiable
IObservableList of all validation status
providers in order by time of addition. |
boolean |
removeBinding(Binding binding)
Removes the given binding.
|
boolean |
removeValidationStatusProvider(ValidationStatusProvider validationStatusProvider)
Removes the validation status provider.
|
void |
updateModels()
Updates all model observable objects to reflect the current state of the
target observable objects.
|
void |
updateTargets()
Updates all target observable objects to reflect the current state of the
model observable objects.
|
public DataBindingContext()
Realm
public final <T,M> Binding bindValue(IObservableValue<T> targetObservableValue, IObservableValue<M> modelObservableValue)
Binding
to synchronize the values of two
observable values
. This method is an alias for
bindValue(targetObservableValue, modelObservableValue, null,
null)
.targetObservableValue
- target value, commonly a UI widgetmodelObservableValue
- model valuepublic final <T,M> Binding bindValue(IObservableValue<T> targetObservableValue, IObservableValue<M> modelObservableValue, UpdateValueStrategy<? super T,? extends M> targetToModel, UpdateValueStrategy<? super M,? extends T> modelToTarget)
Binding
to synchronize the values of two
observable values
. During synchronization
validation and conversion can be employed to customize the process. For
specifics on the customization of the process see
UpdateValueStrategy
.targetObservableValue
- target value, commonly a UI widgetmodelObservableValue
- model valuetargetToModel
- strategy to employ when the target is the source of the change
and the model is the destinationmodelToTarget
- strategy to employ when the model is the source of the change
and the target is the destinationUpdateValueStrategy
protected <M,T> UpdateValueStrategy<M,T> createModelToTargetUpdateValueStrategy(IObservableValue<M> fromValue, IObservableValue<T> toValue)
fromValue
- toValue
- protected <T,M> UpdateValueStrategy<T,M> createTargetToModelUpdateValueStrategy(IObservableValue<T> fromValue, IObservableValue<M> toValue)
fromValue
- toValue
- public final <T,M> Binding bindList(IObservableList<T> targetObservableList, IObservableList<M> modelObservableList)
Binding
to synchronize the values of two
observable lists
. This method is an alias for
bindList(targetObservableList, modelObservableList, null,
null)
.targetObservableList
- target list, commonly a list representing a list in the UImodelObservableList
- model listUpdateListStrategy
public final <T,M> Binding bindList(IObservableList<T> targetObservableList, IObservableList<M> modelObservableList, UpdateListStrategy<? super T,? extends M> targetToModel, UpdateListStrategy<? super M,? extends T> modelToTarget)
Binding
to synchronize the values of two
observable lists
. During synchronization
validation and conversion can be employed to customize the process. For
specifics on the customization of the process see
UpdateListStrategy
.targetObservableList
- target list, commonly a list representing a list in the UImodelObservableList
- model listtargetToModel
- strategy to employ when the target is the source of the change
and the model is the destinationmodelToTarget
- strategy to employ when the model is the source of the change
and the target is the destinationUpdateListStrategy
protected <M,T> UpdateListStrategy<M,T> createModelToTargetUpdateListStrategy(IObservableList<M> modelObservableList, IObservableList<T> targetObservableList)
modelObservableList
- targetObservableList
- protected <T,M> UpdateListStrategy<T,M> createTargetToModelUpdateListStrategy(IObservableList<T> targetObservableList, IObservableList<M> modelObservableList)
targetObservableList
- modelObservableList
- public final <T,M> Binding bindSet(IObservableSet<T> targetObservableSet, IObservableSet<M> modelObservableSet)
Binding
to synchronize the values of two
observable sets
. This method is an alias for
bindSet(targetObservableValue, modelObservableValue, null,
null)
.targetObservableSet
- target set, commonly a set representing a set in the UImodelObservableSet
- model setpublic final <T,M> Binding bindSet(IObservableSet<T> targetObservableSet, IObservableSet<M> modelObservableSet, UpdateSetStrategy<? super T,? extends M> targetToModel, UpdateSetStrategy<? super M,? extends T> modelToTarget)
Binding
to synchronize the values of two
observable sets
. During synchronization validation
and conversion can be employed to customize the process. For specifics on
the customization of the process see UpdateSetStrategy
.targetObservableSet
- target set, commonly a set representing a set in the UImodelObservableSet
- model settargetToModel
- strategy to employ when the target is the source of the change
and the model is the destinationmodelToTarget
- strategy to employ when the model is the source of the change
and the target is the destinationprotected <T,M> UpdateSetStrategy<T,M> createTargetToModelUpdateSetStrategy(IObservableSet<T> targetObservableSet, IObservableSet<M> modelObservableSet)
targetObservableSet
- modelObservableSet
- protected <M,T> UpdateSetStrategy<M,T> createModelToTargetUpdateSetStrategy(IObservableSet<M> modelObservableSet, IObservableSet<T> targetObservableSet)
modelObservableSet
- targetObservableSet
- public final void dispose()
validation realm
.public final IObservableList<Binding> getBindings()
IObservableList
of all bindings in order
by time of addition.IObservableList
of all bindingspublic final IObservableList<ValidationStatusProvider> getValidationStatusProviders()
IObservableList
of all validation status
providers in order by time of addition.IObservableList
of all validation status
providers@Deprecated public final IObservableMap<Binding,IStatus> getValidationStatusMap()
getValidationStatusProviders()
IObservableMap
mapping from bindings to current
validation statuses. The keys of the map are the bindings returned by
getBindings()
, and the values are the current IStatus objects
for each binding.public void addBinding(Binding binding)
binding
- The binding to add.addValidationStatusProvider(ValidationStatusProvider)
,
getValidationStatusProviders()
public void addValidationStatusProvider(ValidationStatusProvider validationStatusProvider)
validationStatusProvider
- The validation status provider to add.public final void updateModels()
public final void updateTargets()
public boolean removeBinding(Binding binding)
binding
- true
if was associated with the context,
false
if notpublic boolean removeValidationStatusProvider(ValidationStatusProvider validationStatusProvider)
validationStatusProvider
- true
if was associated with the context,
false
if not
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.