net.xoetrope.xui.data
Class XListBinding

java.lang.Object
  extended by net.xoetrope.xui.data.XDataBinding
      extended by net.xoetrope.xui.data.XListBinding
Direct Known Subclasses:
XLocalisedListBinding

public class XListBinding
extends XDataBinding

Bind a list to a data model value/node. The binding allows a list 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 list like components such as comboboxes or drop down lists.

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


Field Summary
protected  java.lang.String attribStr
           
protected  boolean bDirty
           
protected  XListHolder listHolder
           
protected  XListModelAdapter model
           
protected  boolean saveToSourceNode
           
protected  boolean useUnique
           
 
Fields inherited from class net.xoetrope.xui.data.XDataBinding
component, currentProject, DEFAULT_OUTPUT_PATH, outputModel, outputPath, reevaluate, sourceModel, sourcePath
 
Constructor Summary
XListBinding()
          null ctor
 
Method Summary
protected  java.lang.String addItem(java.lang.String s)
          Add an item to the component.
 void get()
          Updates the TextComponent 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
 boolean getDirty()
          Retrieve the dirty flag
 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 TextComponent.
 void setDirty(boolean dirty)
          Set the dirty flag so that the list repopulates
 void setOutput(XModel newNode, java.lang.String outputPath)
          Update the path values stored by this node.
 void setSource(XModel newNode)
          Set the source for this bindings's data
 void setup(XProject project, java.lang.Object c, java.util.Hashtable bindingConfig, java.util.Hashtable instanceConfig)
          Setup and configure the binding instance.
 void setUseUnique(boolean isUnique)
          Set the list to use unique entries (remove duplicates)
 
Methods inherited from class net.xoetrope.xui.data.XDataBinding
getAttributes, getComponent, getOutput, getOutputPath, getReevaluate, getSource, getSourcePath, setOutputPath, setReevaluate, setSourcePath, setupHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listHolder

protected XListHolder listHolder

model

protected XListModelAdapter model

useUnique

protected boolean useUnique

bDirty

protected boolean bDirty

saveToSourceNode

protected boolean saveToSourceNode

attribStr

protected java.lang.String attribStr
Constructor Detail

XListBinding

public XListBinding()
null ctor

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

setDirty

public void setDirty(boolean dirty)
Set the dirty flag so that the list repopulates

Parameters:
dirty - the state for the dirty flag

getDirty

public boolean getDirty()
Retrieve the dirty flag

Returns:
the dirty flag

get

public void get()
Updates the TextComponent 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 class XDataBinding

addItem

protected java.lang.String addItem(java.lang.String s)
Add an item to the component. In a separate method to aid with subclassing for localisation

Parameters:
s - The new item to be added to the list
Returns:
The passed string

set

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

Specified by:
set in class XDataBinding

setUseUnique

public void setUseUnique(boolean isUnique)
Set the list to use unique entries (remove duplicates)

Parameters:
isUnique - teh new flag value

getName

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

Returns:
the name

setSource

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

Overrides:
setSource in class XDataBinding
Parameters:
newNode - the path to the data in the model

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.

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

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