org.formaria.swing.data
Class ListTableBinding

java.lang.Object
  extended by org.formaria.aria.data.DataBinding
      extended by org.formaria.swing.data.ListTableBinding

public class ListTableBinding
extends DataBinding

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 Formaria (c) 2008

$Revision: 2.5 $ License: see license.txt


Field Summary
protected  int displayColumnIdx
           
protected  int keyColumnIdx
           
protected  java.lang.String keyColumnName
           
protected  TableModelAdapter modelAdapter
           
protected  ListHolder target
           
protected  boolean useUnique
           
 
Fields inherited from class org.formaria.aria.data.DataBinding
component, currentProject, DEFAULT_OUTPUT_PATH, outputModel, outputPath, reevaluate, sourceModel, sourcePath
 
Constructor Summary
ListTableBinding()
          Construct a new data binding
 
Method Summary
 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
 java.lang.String getType()
          Get the type of this binding
 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 setOutputPath(java.lang.String newPath)
          Set the model path for the output/state data
 void setSource(DataModel newNode)
          Update the model node used in the binding.
 void setSourcePath(java.lang.String newPath)
          Set the model path for the source data
 void setup(Project project, java.lang.Object c, java.util.Hashtable bindingConfig, java.util.Hashtable instanceConfig)
          Setup and configure the binding instance.
 
Methods inherited from class org.formaria.aria.data.DataBinding
getAttributes, getComponent, getOutput, getOutputPath, getReevaluate, getSource, getSourcePath, setOutput, setReevaluate, setupHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelAdapter

protected TableModelAdapter modelAdapter

target

protected ListHolder target

useUnique

protected boolean useUnique

displayColumnIdx

protected int displayColumnIdx

keyColumnIdx

protected int keyColumnIdx

keyColumnName

protected java.lang.String keyColumnName
Constructor Detail

ListTableBinding

public ListTableBinding()
Construct a new data binding

Method Detail

setup

public void setup(Project 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 DataBinding
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 void get()
Update the bound component with the value obtained from the data model.

Specified by:
get in class DataBinding

set

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

Specified by:
set in class DataBinding

setSourcePath

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

Overrides:
setSourcePath in class DataBinding
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

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

setSource

public void setSource(DataModel newNode)
Update the model node used in the binding. Note that this method does not modify the path values stored by this node.

Overrides:
setSource in class DataBinding
Parameters:
newNode - the new model for the data source

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)

getAttributes

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

Overrides:
getAttributes in class DataBinding
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 DataBinding
Returns:
the binding type name