Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.databinding
Class DataBindingContext


java.lang.Object
  extended by 
org.eclipse.core.databinding.DataBindingContext

public class DataBindingContext
extends Object

A DataBindingContext is the point of contact for the creation and management of bindings, and aggregates validation statuses of its bindings, or more generally, its validation status providers.

A DataBindingContext provides the following abilities:

  • Ability to create bindings between observable values.
  • Ability to create bindings between observable lists.
  • Access to the bindings created by the instance.
  • Access to the list of validation status providers (this includes all bindings).

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.

Since:
1.0

Constructor Summary
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.
 
Method Summary
 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.
  Binding bindList ( IObservableList targetObservableList, IObservableList modelObservableList)
          Creates a Binding to synchronize the values of two observable lists.
  Binding bindList ( IObservableList targetObservableList, IObservableList modelObservableList, UpdateListStrategy targetToModel, UpdateListStrategy modelToTarget)
          Creates a Binding to synchronize the values of two observable lists.
  Binding bindSet ( IObservableSet targetObservableSet, IObservableSet modelObservableSet)
          Creates a Binding to synchronize the values of two observable sets.
  Binding bindSet ( IObservableSet targetObservableSet, IObservableSet modelObservableSet, UpdateSetStrategy targetToModel, UpdateSetStrategy modelToTarget)
          Creates a Binding to synchronize the values of two observable sets.
  Binding bindValue ( IObservableValue targetObservableValue, IObservableValue modelObservableValue)
          Creates a Binding to synchronize the values of two observable values.
  Binding bindValue ( IObservableValue targetObservableValue, IObservableValue modelObservableValue, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget)
          Creates a Binding to synchronize the values of two observable values.
protected   UpdateListStrategy createModelToTargetUpdateListStrategy ( IObservableList modelObservableList, IObservableList targetObservableList)
           
protected   UpdateSetStrategy createModelToTargetUpdateSetStrategy ( IObservableSet modelObservableSet, IObservableSet targetObservableSet)
           
protected   UpdateValueStrategy createModelToTargetUpdateValueStrategy ( IObservableValue fromValue, IObservableValue toValue)
          Returns an update value strategy to be used for copying values from the from value to the to value.
protected   UpdateListStrategy createTargetToModelUpdateListStrategy ( IObservableList targetObservableList, IObservableList modelObservableList)
           
protected   UpdateSetStrategy createTargetToModelUpdateSetStrategy ( IObservableSet targetObservableSet, IObservableSet modelObservableSet)
           
protected   UpdateValueStrategy createTargetToModelUpdateValueStrategy ( IObservableValue fromValue, IObservableValue 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 getBindings ()
          Returns an unmodifiable IObservableList < Binding > of all bindings in order by time of addition.
  Realm getValidationRealm ()
          Returns the validation realm.
  IObservableMap getValidationStatusMap ()
          Deprecated. as of 1.1, please use getValidationStatusProviders()
  IObservableList getValidationStatusProviders ()
          Returns an unmodifiable an unmodifiable IObservableList < ValidationStatusProvider > 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.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataBindingContext

public DataBindingContext()
Creates a data binding context, using the current default realm for the validation observables.

See Also:
Realm

DataBindingContext

public DataBindingContext(
Realm validationRealm)
Creates a data binding context using the given realm for the validation observables.

Parameters:
validationRealm - the realm to be used for the validation observables
See Also:
Realm
Method Detail

bindValue

public final 
Binding bindValue(
IObservableValue targetObservableValue,
                               
IObservableValue modelObservableValue)
Creates a Binding to synchronize the values of two observable values. This method is an alias for bindValue(targetObservableValue, modelObservableValue, null, null).

Parameters:
targetObservableValue - target value, commonly a UI widget
modelObservableValue - model value
Returns:
created binding
Since:
1.2

bindValue

public final 
Binding bindValue(
IObservableValue targetObservableValue,
                               
IObservableValue modelObservableValue,
                               
UpdateValueStrategy targetToModel,
                               
UpdateValueStrategy modelToTarget)
Creates a 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.

Parameters:
targetObservableValue - target value, commonly a UI widget
modelObservableValue - model value
targetToModel - strategy to employ when the target is the source of the change and the model is the destination
modelToTarget - strategy to employ when the model is the source of the change and the target is the destination
Returns:
created binding
See Also:
UpdateValueStrategy

createModelToTargetUpdateValueStrategy

protected 
UpdateValueStrategy createModelToTargetUpdateValueStrategy(
IObservableValue fromValue,
                                                                     
IObservableValue toValue)
Returns an update value strategy to be used for copying values from the from value to the to value. Clients may override.

Parameters:
fromValue -
toValue -
Returns:
a update value strategy

createTargetToModelUpdateValueStrategy

protected 
UpdateValueStrategy createTargetToModelUpdateValueStrategy(
IObservableValue fromValue,
                                                                     
IObservableValue toValue)
Returns an update value strategy to be used for copying values from the from value to the to value. Clients may override.

Parameters:
fromValue -
toValue -
Returns:
a update value strategy

bindList

public final 
Binding bindList(
IObservableList targetObservableList,
                              
IObservableList modelObservableList)
Creates a Binding to synchronize the values of two observable lists. This method is an alias for bindList(targetObservableList, modelObservableList, null, null).

Parameters:
targetObservableList - target list, commonly a list representing a list in the UI
modelObservableList - model list
Returns:
created binding
Since:
1.2
See Also:
UpdateListStrategy

bindList

public final 
Binding bindList(
IObservableList targetObservableList,
                              
IObservableList modelObservableList,
                              
UpdateListStrategy targetToModel,
                              
UpdateListStrategy modelToTarget)
Creates a 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.

Parameters:
targetObservableList - target list, commonly a list representing a list in the UI
modelObservableList - model list
targetToModel - strategy to employ when the target is the source of the change and the model is the destination
modelToTarget - strategy to employ when the model is the source of the change and the target is the destination
Returns:
created binding
See Also:
UpdateListStrategy

createModelToTargetUpdateListStrategy

protected 
UpdateListStrategy createModelToTargetUpdateListStrategy(
IObservableList modelObservableList,
                                                                   
IObservableList targetObservableList)
Parameters:
modelObservableList -
targetObservableList -
Returns:
an update list strategy

createTargetToModelUpdateListStrategy

protected 
UpdateListStrategy createTargetToModelUpdateListStrategy(
IObservableList targetObservableList,
                                                                   
IObservableList modelObservableList)
Parameters:
targetObservableList -
modelObservableList -
Returns:
an update list strategy

bindSet

public final 
Binding bindSet(
IObservableSet targetObservableSet,
                             
IObservableSet modelObservableSet)
Creates a Binding to synchronize the values of two observable sets. This method is an alias for bindSet(targetObservableValue, modelObservableValue, null, null).

Parameters:
targetObservableSet - target set, commonly a set representing a set in the UI
modelObservableSet - model set
Returns:
created binding
Since:
1.2

bindSet

public final 
Binding bindSet(
IObservableSet targetObservableSet,
                             
IObservableSet modelObservableSet,
                             
UpdateSetStrategy targetToModel,
                             
UpdateSetStrategy modelToTarget)
Creates a 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.

Parameters:
targetObservableSet - target set, commonly a set representing a set in the UI
modelObservableSet - model set
targetToModel - strategy to employ when the target is the source of the change and the model is the destination
modelToTarget - strategy to employ when the model is the source of the change and the target is the destination
Returns:
created binding
Since:
1.1

createTargetToModelUpdateSetStrategy

protected 
UpdateSetStrategy createTargetToModelUpdateSetStrategy(
IObservableSet targetObservableSet,
                                                                 
IObservableSet modelObservableSet)
Parameters:
targetObservableSet -
modelObservableSet -
Returns:
a default set update strategy
Since:
1.1

createModelToTargetUpdateSetStrategy

protected 
UpdateSetStrategy createModelToTargetUpdateSetStrategy(
IObservableSet modelObservableSet,
                                                                 
IObservableSet targetObservableSet)
Parameters:
modelObservableSet -
targetObservableSet -
Returns:
a default set update strategy
Since:
1.1

dispose

public final void dispose()
Disposes of this data binding context and all bindings and validation status providers that were added to this context. This method must be called in the validation realm.


getBindings

public final 
IObservableList getBindings()
Returns an unmodifiable IObservableList < Binding > of all bindings in order by time of addition.

Returns:
an unmodifiable IObservableList < Binding > of all bindings

getValidationStatusProviders

public final 
IObservableList getValidationStatusProviders()
Returns an unmodifiable an unmodifiable IObservableList < ValidationStatusProvider > of all validation status providers in order by time of addition.

Returns:
an unmodifiable IObservableList < ValidationStatusProvider > of all validation status providers
Since:
1.1

getValidationStatusMap

public final 
IObservableMap getValidationStatusMap()
Deprecated. as of 1.1, please use getValidationStatusProviders()

Returns an IObservableMap < Binding, IStatus > 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.

Returns:
the observable map from bindings to status objects.

addBinding

public void addBinding(
Binding binding)
Adds the given binding to this data binding context. This will also add the given binding to the list of validation status providers.

Parameters:
binding - The binding to add.
See Also:
addValidationStatusProvider(ValidationStatusProvider), getValidationStatusProviders()

addValidationStatusProvider

public void addValidationStatusProvider(
ValidationStatusProvider validationStatusProvider)
Adds the given validation status provider to this data binding context.

Parameters:
validationStatusProvider - The validation status provider to add.
Since:
1.1

updateModels

public final void updateModels()
Updates all model observable objects to reflect the current state of the target observable objects.


updateTargets

public final void updateTargets()
Updates all target observable objects to reflect the current state of the model observable objects.


removeBinding

public boolean removeBinding(
Binding binding)
Removes the given binding.

Parameters:
binding -
Returns:
true if was associated with the context, false if not

removeValidationStatusProvider

public boolean removeValidationStatusProvider(
ValidationStatusProvider validationStatusProvider)
Removes the validation status provider.

Parameters:
validationStatusProvider -
Returns:
true if was associated with the context, false if not
Since:
1.1

getValidationRealm

public final 
Realm getValidationRealm()
Returns the validation realm.

Returns:
the realm for the validation observables
See Also:
Realm

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire