net.xoetrope.optional.data
Class XListTableBinding

java.lang.Object
  extended by net.xoetrope.optional.data.XListTableBinding
All Implemented Interfaces:
XDataBinding

public class XListTableBinding
extends java.lang.Object
implements XDataBinding

A data binding for list components, including drop down lists. This binding allows a key field to be chosen so that records may be chosen using a key (or ID) value. A display field can also be specified so that the list need not display the first field from the table.

Copyright Xoetrope (c) 2001-2004

$Revision: 2.5 $ License: see license.txt


Field Summary
protected  int displayColumnIdx
           
protected  int keyColumnIdx
           
protected  DatabaseTableModelAdapter modelAdapter
           
protected  XModel outputNode
           
protected  java.lang.String outputPath
           
protected  java.lang.String sourcePath
           
protected  XListHolder target
           
protected  boolean useUnique
           
 
Fields inherited from interface net.xoetrope.xui.data.XDataBinding
DEFAULT_OUTPUT_PATH
 
Constructor Summary
XListTableBinding(java.lang.Object c, DatabaseTableModelAdapter node)
          Construct a new data binding
XListTableBinding(java.lang.Object comp, XModel xmodel)
          Construct a new data binding
 
Method Summary
 void get()
          Update the bound component with the value obtained from the data model.
 java.lang.Object getComponent()
          Get the component to which this binding is attached
 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()
          Update the data model with the value retrieved from the bound component.
 void setDisplayColumn(java.lang.String displayColumn)
          Set the display column index, by default it is set to zero or the first column
 void setKeyColumn(java.lang.String keyColumn)
          Set the key column index, by default it is set to zero or the first column
 void setOutput(XModel newNode, java.lang.String outputPath)
          Update the path values stored by this node.
 void setOutputPath(java.lang.String newPath)
          Set the model path for the output/state data
 void setSource(XModel newNode)
          Update the model node used in the binding.
 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

modelAdapter

protected DatabaseTableModelAdapter modelAdapter

target

protected XListHolder target

outputNode

protected XModel outputNode

outputPath

protected java.lang.String outputPath

sourcePath

protected java.lang.String sourcePath

useUnique

protected boolean useUnique

displayColumnIdx

protected int displayColumnIdx

keyColumnIdx

protected int keyColumnIdx
Constructor Detail

XListTableBinding

public XListTableBinding(java.lang.Object comp,
                         XModel xmodel)
Construct a new data binding

Parameters:
comp - the component to be bound
xmodel - the model node that is to act as the data source

XListTableBinding

public XListTableBinding(java.lang.Object c,
                         DatabaseTableModelAdapter node)
Construct a new data binding

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

get

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

Specified by:
get in interface XDataBinding

set

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

Specified by:
set in interface XDataBinding

getComponent

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

Specified by:
getComponent in interface XDataBinding
Returns:
The component which is being bound

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)
Update the model node used in the binding. Note that this method does not modify the path values stored by this node.

Specified by:
setSource in interface XDataBinding
Parameters:
newNode - the new model for the data source

setOutput

public void setOutput(XModel newNode,
                      java.lang.String outputPath)
Update the path values stored by this node. The output path 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.

setDisplayColumn

public void setDisplayColumn(java.lang.String displayColumn)
Set the display column index, by default it is set to zero or the first column

Parameters:
displayColumn - the column index (zero based)

setKeyColumn

public void setKeyColumn(java.lang.String keyColumn)
Set the key column index, by default it is set to zero or the first column

Parameters:
keyColumn - the column index (zero based)