incubator.net.xoetrope.xui
Class XDataBindingContext

java.lang.Object
  extended by incubator.net.xoetrope.xui.XDataBindingContext

public class XDataBindingContext
extends java.lang.Object

    

A class used by XPage to manage the data binding coordination

Copyright (c) Xoetrope Ltd., 2002-2005

License: see license.txt

$Revision: 1.1 $


Field Summary
protected  XPathEvaluator evaluator
           
 java.util.Vector modelBindings
          Vector of XDataBinding Objects currently in use by the XPage
 
Constructor Summary
XDataBindingContext(XPathEvaluator pathEvaluator)
          Creates a new instance of XDataBindingContext
 
Method Summary
 void addBinding(XDataBinding b, boolean doGet)
          Add a binding of a component to the data model.
 XDataBinding getBinding(java.lang.Object targetComp)
          Find the data binding associated with a component
 XDataBinding getBinding(java.lang.String targetPath)
          Find the data binding associated with a data source path
 java.util.Vector getBindings()
          Retrieve the Vector of XDataBinding for the XPage
 void removeBinding(XDataBinding b)
          Remove a binding of a component to the data model.
 void saveBoundComponentValues()
          Save the component values to the model
 void updateBinding(XDataBinding binding)
          Update the bound model node for the binding.
 void updateBindings()
          Iterate all of the bindings in the page to reflect the model state.
 void updateBoundComponentValues()
          Update the UI with values from the model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelBindings

public java.util.Vector modelBindings
Vector of XDataBinding Objects currently in use by the XPage


evaluator

protected XPathEvaluator evaluator
Constructor Detail

XDataBindingContext

public XDataBindingContext(XPathEvaluator pathEvaluator)
Creates a new instance of XDataBindingContext

Method Detail

getBindings

public java.util.Vector getBindings()
Retrieve the Vector of XDataBinding for the XPage

Returns:
Vector of XDataBinding

addBinding

public void addBinding(XDataBinding b,
                       boolean doGet)
Add a binding of a component to the data model. If the page has already been activated this method will update the binding automatically.

Parameters:
b - the binding "param doGet do a get on the binding once it has been added

removeBinding

public void removeBinding(XDataBinding b)
Remove a binding of a component to the data model.

Parameters:
b - the binding

updateBindings

public void updateBindings()
Iterate all of the bindings in the page to reflect the model state.


updateBinding

public void updateBinding(XDataBinding binding)
Update the bound model node for the binding. First the output path is reevaluated and then updated by setting the output node. Then the source path is reevaluated and set. Evaluation of the paths allows derived classes to dynamically modify the bindings. Some bindings may save the selection or state information to the output node and subsequently use it to restore the component state. This method does not alter the data held by the bound model nodes. To actually save the data use saveBoundComponentValues and to update the UI use updateBoundComponentValues.

Parameters:
binding - The databinding to be updated

updateBoundComponentValues

public void updateBoundComponentValues()
Update the UI with values from the model


saveBoundComponentValues

public void saveBoundComponentValues()
Save the component values to the model


getBinding

public XDataBinding getBinding(java.lang.Object targetComp)
Find the data binding associated with a component

Parameters:
targetComp - the component whose binding is required
Returns:
the binding or null if no binding is found

getBinding

public XDataBinding getBinding(java.lang.String targetPath)
Find the data binding associated with a data source path

Parameters:
targetPath - the path to the bound model
Returns:
the binding or null if no binding is found