net.xoetrope.xui.data
Class XDataBinding

java.lang.Object
  extended by net.xoetrope.xui.data.XDataBinding
Direct Known Subclasses:
XLabelBinding, XListBinding, XListTableBinding, XRadioBinding, XStateBinding, XTableTableBinding, XTextBinding, XTreeBinding, XTreeBinding

public abstract class XDataBinding
extends java.lang.Object

Describes an interface used to allow components to be updated when a data model changes and to allow the model to be updated when the user interface elements change.

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt


Field Summary
protected  java.lang.Object component
           
protected  XProject currentProject
           
static java.lang.String DEFAULT_OUTPUT_PATH
          The path to which XUI state information will be output
protected  XModel outputModel
           
protected  java.lang.String outputPath
           
protected  boolean reevaluate
           
protected  XModel sourceModel
           
protected  java.lang.String sourcePath
           
 
Constructor Summary
XDataBinding()
           
 
Method Summary
abstract  void get()
          Update the bound component with the value obtained from the data model.
 java.util.Vector getAttributes(boolean required)
          Get the names of the attributes used by this binding class
protected  java.util.Vector getAttributes(boolean required, java.lang.String[] extraAttribNames)
          Get the names of the attributes used by this binding class
 java.lang.Object getComponent()
          Get the component to which this binding is attached
 XModel getOutput()
          Get the output model
 java.lang.String getOutputPath()
          Get the model path for the output/state data
 boolean getReevaluate()
          Get the reevaluate flag.
 XModel getSource()
          Get the source model
 java.lang.String getSourcePath()
          Get the model path for the source data
abstract  java.lang.String getType()
          Get the type of this binding
abstract  void set()
          Update the data model with the value retrieved from the bound component.
 void setOutput(XModel newNode, java.lang.String path)
          Update the path values stored by this node.
 void setOutputPath(java.lang.String newPath)
          Set the model path for the output/state data
 void setReevaluate(boolean b)
          Set the reevaluate flag.
 void setSource(XModel newNode)
          Set the source node for data in the model
 void setSourcePath(java.lang.String newPath)
          Set the model path for the source data
abstract  void setup(XProject project, java.lang.Object c, java.util.Hashtable bindingConfig, java.util.Hashtable instanceConfig)
          Setup and configure the binding instance.
protected  void setupHelper(XProject project, java.lang.Object c, java.util.Hashtable bindingConfig, java.util.Hashtable instanceConfig)
          A helper designed to be called by the constructor of each binding to store the common parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentProject

protected XProject currentProject

component

protected java.lang.Object component

sourcePath

protected java.lang.String sourcePath

outputPath

protected java.lang.String outputPath

sourceModel

protected XModel sourceModel

outputModel

protected XModel outputModel

reevaluate

protected boolean reevaluate

DEFAULT_OUTPUT_PATH

public static final java.lang.String DEFAULT_OUTPUT_PATH
The path to which XUI state information will be output

See Also:
Constant Field Values
Constructor Detail

XDataBinding

public XDataBinding()
Method Detail

setup

public abstract void setup(XProject project,
                           java.lang.Object c,
                           java.util.Hashtable bindingConfig,
                           java.util.Hashtable instanceConfig)
Setup and configure the binding instance. The binding is configured via the XML setup registered for the particular binding type and then, subsequently by attibitional attributes of the binding instance specified in the page declaration, for the individual binding instance. The binding may also obtain configuration or reference information from the component and the project.

Parameters:
project - the owning project
c - the component being bound
bindingConfig - the XML element which contains the binding configuration
instanceConfig - the XML element which contains the setup attributes of the binding instance

setupHelper

protected void setupHelper(XProject project,
                           java.lang.Object c,
                           java.util.Hashtable bindingConfig,
                           java.util.Hashtable instanceConfig)
A helper designed to be called by the constructor of each binding to store the common parameters.

Parameters:
project - the owning project
c - the component being bound
bindingConfig - the XML element which contains the binding configuration
instanceConfig - the XML element which contains the setup attributes of the binding instance

get

public abstract void get()
Update the bound component with the value obtained from the data model.


set

public abstract void set()
Update the data model with the value retrieved from the bound component.


getComponent

public java.lang.Object getComponent()
Get the component to which this binding is attached

Returns:
The component which is being bound

getSourcePath

public java.lang.String getSourcePath()
Get the model path for the source data

Returns:
The raw path to which the source model is bound

getOutputPath

public java.lang.String getOutputPath()
Get the model path for the output/state data

Returns:
The raw path to which the output model is bound

setSource

public void setSource(XModel newNode)
Set the source node for data in the model

Parameters:
newNode - the path of the data in the model

setOutput

public void setOutput(XModel newNode,
                      java.lang.String path)
Update the path values stored by this node. The output path is used to store selection data and state.

Parameters:
newNode - the new model for saving the output data
path - The path to which the outputModel is writing.

getSource

public XModel getSource()
Get the source model

Returns:
the model node

getOutput

public XModel getOutput()
Get the output model

Returns:
the model node

setSourcePath

public void setSourcePath(java.lang.String newPath)
Set the model path for the source data

Parameters:
newPath - The path to which the source model is to be bound

setOutputPath

public void setOutputPath(java.lang.String newPath)
Set the model path for the output/state data

Parameters:
newPath - The path to which the output model is to be bound

getReevaluate

public boolean getReevaluate()
Get the reevaluate flag. The reevaluate flag controls whether or not the binding paths are revaluated when a page is displayed/redisplayed. By default the value is true. A binding can optionally specify a 'reeval' attribute to control the setting.

Returns:
true if the binding paths are to be reevaluated

setReevaluate

public void setReevaluate(boolean b)
Set the reevaluate flag. The reevaluate flag controls whether or not the binding paths are revaluated when a page is displayed/redisplayed. By default the value is true. A binding can optionally specify a 'reeval' attribute to control the setting.

Parameters:
b - true if the binding paths are to be reevaluated

getAttributes

public java.util.Vector getAttributes(boolean required)
Get the names of the attributes used by this binding class

Parameters:
required - true to list only the require attribues, false for all attributes

getAttributes

protected java.util.Vector getAttributes(boolean required,
                                         java.lang.String[] extraAttribNames)
Get the names of the attributes used by this binding class

Parameters:
required - true to list only the require attribues, false for all attributes
extraAttribNames - the extra attribute names to add to the vector

getType

public abstract java.lang.String getType()
Get the type of this binding

Returns:
the binding type name