net.xoetrope.xui.data
Class XLabelBinding

java.lang.Object
  extended by net.xoetrope.xui.data.XLabelBinding
All Implemented Interfaces:
XDataBinding

public class XLabelBinding
extends java.lang.Object
implements XDataBinding

Bind an XLabel 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. For a label component the source and destination area synonymous.

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


Field Summary
protected  XTextHolder comp
          The component to which the data is being bound
protected  XModel model
           
protected  java.lang.String srcPath
           
 
Fields inherited from interface net.xoetrope.xui.data.XDataBinding
DEFAULT_OUTPUT_PATH
 
Constructor Summary
XLabelBinding(java.lang.Object c, java.lang.String dataElement, XModel srcModel)
          Construct a new data binding
 
Method Summary
 void get()
          Updates the TextComponent with the value obtained from the data model.
 java.lang.Object getComponent()
          Gets the component on which this binding operates
 java.lang.String getName()
          Gets the name of the model node
 java.lang.String getOutputPath()
          Get the model path for the output/state data
 java.lang.String getSourcePath()
          Get the model path for the source data
 void set()
          Updates the data model with the value retrieved from the TextComponent.
 void setOutput(XModel newNode, java.lang.String outputPath)
          Update the output node used by this adapter.
 void setOutputPath(java.lang.String newPath)
          Set the model path for the output/state data
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comp

protected XTextHolder comp
The component to which the data is being bound


model

protected XModel model

srcPath

protected java.lang.String srcPath
Constructor Detail

XLabelBinding

public XLabelBinding(java.lang.Object c,
                     java.lang.String dataElement,
                     XModel srcModel)
Construct a new data binding

Parameters:
c - the component to be bound
dataElement - the name of the data in the model
srcModel - The model to which the component is to be bound
Method Detail

get

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

Specified by:
get in interface XDataBinding

set

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

Specified by:
set in interface XDataBinding

getComponent

public java.lang.Object getComponent()
Gets the component on which this binding operates

Specified by:
getComponent in interface XDataBinding
Returns:
the bound component

getName

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

Returns:
the name

getSourcePath

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

Specified by:
getSourcePath in interface XDataBinding
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

Specified by:
getOutputPath in interface XDataBinding
Returns:
The raw path to which the output model is bound

setSourcePath

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

Specified by:
setSourcePath in interface XDataBinding
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

Specified by:
setOutputPath in interface XDataBinding
Parameters:
newPath - The path to which the output model is to be bound

setSource

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

Specified by:
setSource in interface XDataBinding
Parameters:
newNode - the path of the data in the model

setOutput

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

Specified by:
setOutput in interface XDataBinding
Parameters:
newNode - the new model for saving the output data
outputPath - The path to which the outputModel is writing.