net.xoetrope.xui.data
Class XStateBinding

java.lang.Object
  extended by net.xoetrope.xui.data.XDataBinding
      extended by net.xoetrope.xui.data.XStateBinding

public class XStateBinding
extends XDataBinding

Bind a component's state to a data model value/node. The binding allows a model node to linked to a UI component so that it can be refreshed when new data is written to the model or conversely when the UI component needs to write data to the model.
This binding is designed to be used by components such as RadioButtons or Checkboxes.

This state change does not affect the content displayed by the component.

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


Field Summary
protected  java.lang.String attribStr
           
protected  boolean isLeafNode
           
protected  java.lang.String offValue
          The value which will be used to store the value of the off state of the check/radio components in the model.
protected  java.lang.String onValue
          The value which will be used to store the value of the on state of the check/radio components in the model.
 
Fields inherited from class net.xoetrope.xui.data.XDataBinding
component, currentProject, DEFAULT_OUTPUT_PATH, outputModel, outputPath, reevaluate, sourceModel, sourcePath
 
Constructor Summary
XStateBinding()
          Default constuctor to enable creation of subclassed custom bindings and late binding.
 
Method Summary
 void get()
          Updates the component state with the value obtained from the data model.
 java.lang.String getAttribute()
          Retrieve the name of the attribute which is storing the value of the binding
 java.util.Vector getAttributes(boolean required)
          Get the names of the attributes used by this binding class
 java.lang.String getName()
          Gets the name of the model node
 java.lang.String getType()
          Get the type of this binding
 void set()
          Updates the data model with the value retrieved from the component.
 void setAttribute(java.lang.String attrib)
          Set the name of the attribute which is to be used for storing and retrieving the model value.
 void setOutputPath(java.lang.String newPath)
          Set the model path for the output/state data
 void setup(XProject project, java.lang.Object c, java.util.Hashtable bindingConfig, java.util.Hashtable instanceConfig)
          Setup and configure the binding instance.
 
Methods inherited from class net.xoetrope.xui.data.XDataBinding
getAttributes, getComponent, getOutput, getOutputPath, getReevaluate, getSource, getSourcePath, setOutput, setReevaluate, setSource, setSourcePath, setupHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isLeafNode

protected boolean isLeafNode

attribStr

protected java.lang.String attribStr

onValue

protected java.lang.String onValue
The value which will be used to store the value of the on state of the check/radio components in the model.


offValue

protected java.lang.String offValue
The value which will be used to store the value of the off state of the check/radio components in the model.

Constructor Detail

XStateBinding

public XStateBinding()
Default constuctor to enable creation of subclassed custom bindings and late binding.

Method Detail

setup

public 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.

Specified by:
setup in class XDataBinding
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

setAttribute

public void setAttribute(java.lang.String attrib)
Set the name of the attribute which is to be used for storing and retrieving the model value.

Parameters:
attrib - the name of the attribute which will store the value.

getAttribute

public java.lang.String getAttribute()
Retrieve the name of the attribute which is storing the value of the binding


get

public void get()
Updates the component state with the value obtained from the data model.

Specified by:
get in class XDataBinding

set

public void set()
Updates the data model with the value retrieved from the component.

Specified by:
set in class XDataBinding

setOutputPath

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

Overrides:
setOutputPath in class XDataBinding
Parameters:
newPath - The path to which the output model is to be bound

getName

public java.lang.String getName()
Gets the name of the model node

Returns:
the name

getAttributes

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

Overrides:
getAttributes in class XDataBinding
Parameters:
required - true to list only the require attribues, false for all attributes

getType

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

Specified by:
getType in class XDataBinding
Returns:
the binding type name