net.xoetrope.swing.tree
Class XTreeBinding

java.lang.Object
  extended by net.xoetrope.swing.tree.XTreeBinding
All Implemented Interfaces:
XDataBinding

public class XTreeBinding
extends java.lang.Object
implements XDataBinding

This class provides a means of binding a model node and its children to an XModel node.

Copyright: Copyright (c) Xoetrope Ltd., 2001-2004

$Revision: 2.4 $

License see license.txt


Field Summary
protected  javax.swing.JTree comp
          the bound component
protected  XModelAdapter model
          the source node
protected  XModel outputNode
          the output node
protected  java.lang.String outputPath
          The output path
protected  java.lang.String srcPath
          The path to the source node
 
Fields inherited from interface net.xoetrope.xui.data.XDataBinding
DEFAULT_OUTPUT_PATH
 
Constructor Summary
XTreeBinding(javax.swing.JTree c, XModelAdapter node)
          Construct a new data binding
 
Method Summary
 void get()
          Updates the Tree component 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 component to which this object binds
 java.lang.String getSourcePath()
          Get the model component to which this object binds
protected  java.lang.String getTreePath()
          Get the path from the root to the selected node
 void set()
          Updates the data model with the value retrieved from the TextComponent.
 void setOutput(XModel newNode, java.lang.String outputPath)
          Set the output node where state data for this binding will be saved
 void setOutputPath(java.lang.String newPath)
          Set the model path for the output/state data
 void setSource(XModel newNode)
          Set the source for this bindings's data
 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 javax.swing.JTree comp
the bound component


model

protected XModelAdapter model
the source node


outputNode

protected XModel outputNode
the output node


srcPath

protected java.lang.String srcPath
The path to the source node


outputPath

protected java.lang.String outputPath
The output path

Constructor Detail

XTreeBinding

public XTreeBinding(javax.swing.JTree c,
                    XModelAdapter node)
Construct a new data binding

Parameters:
c - the JTree component to be bound
node - the model node
Method Detail

get

public void get()
Updates the Tree component with the value obtained from the data model. Filters the list by ignoring repeat items (note that this does not guarantee unique list entries unless the useUnique flag is set).

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 component to which this object binds

Specified by:
getSourcePath in interface XDataBinding
Returns:
the source path

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 new source path

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 new output path

getOutputPath

public java.lang.String getOutputPath()
Get the model component to which this object binds

Specified by:
getOutputPath in interface XDataBinding
Returns:
the current output path

setSource

public void setSource(XModel newNode)
Set the source for this bindings's data

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

setOutput

public void setOutput(XModel newNode,
                      java.lang.String outputPath)
Set the output node where state data for this binding will be saved

Specified by:
setOutput in interface XDataBinding
Parameters:
newNode - the output node
outputPath - the output path

getTreePath

protected java.lang.String getTreePath()
Get the path from the root to the selected node

Returns:
the path