net.xoetrope.optional.data
Class XLocalisedListBinding

java.lang.Object
  extended by net.xoetrope.xui.data.XListBinding
      extended by net.xoetrope.optional.data.XLocalisedListBinding
All Implemented Interfaces:
XCustomDataBinding, XDataBinding

public class XLocalisedListBinding
extends XListBinding
implements XCustomDataBinding

A list binding that supports localization of the list content

Copyright Xoetrope (c) 2001-2004

$Revision: 2.8 $ License: see license.txt


Field Summary
protected  java.util.Vector keys
           
protected  java.util.ResourceBundle languageResourceBundle
           
 
Fields inherited from class net.xoetrope.xui.data.XListBinding
attribStr, bDirty, comp, model, outputNode, outputPath, saveToSourceNode, srcPath, useUnique
 
Fields inherited from interface net.xoetrope.xui.data.XDataBinding
DEFAULT_OUTPUT_PATH
 
Constructor Summary
XLocalisedListBinding()
          null ctor
XLocalisedListBinding(java.lang.Object c, java.lang.String dataElement)
          Construct a new data binding
XLocalisedListBinding(java.lang.Object c, java.lang.String dataElement, java.lang.String destElement)
          Construct a new data binding
XLocalisedListBinding(java.lang.Object c, java.lang.String dataElement, java.lang.String destElement, XModel srcModel, XModel dstModel)
          Construct a new data binding
XLocalisedListBinding(java.lang.Object c, java.lang.String dataElement, java.lang.String destElement, XModel srcModel, XModel dstModel, java.lang.String attribStr, boolean saveToSource)
          Construct a new data binding, and set the languageResourceBundle for text to be translated
 
Method Summary
protected  java.lang.String addItem(java.lang.String s)
          translate the text at this point
 java.lang.String getKey(int idx)
          Get the untranslated key for a list item
 void setup(java.lang.Object c, XmlElement xmlElement)
          Used to setup custom components where the constructor.
protected  java.lang.String translate(java.lang.String key)
          Translate the text being added to the list.
 
Methods inherited from class net.xoetrope.xui.data.XListBinding
get, getComponent, getDirty, getName, getOutputPath, getSourcePath, set, setDirty, setOutput, setOutputPath, setSource, setSourcePath, setUseUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

languageResourceBundle

protected java.util.ResourceBundle languageResourceBundle

keys

protected java.util.Vector keys
Constructor Detail

XLocalisedListBinding

public XLocalisedListBinding()
null ctor


XLocalisedListBinding

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

Parameters:
c - the component to be bound
dataElement - the name of the data in the model

XLocalisedListBinding

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

Parameters:
c - the component to be bound
dataElement - the name of the data in the model
destElement - the name of the destination data in the model
srcModel - the model node that acts as the data source for this node
dstModel - the model node to which the selection is saved

XLocalisedListBinding

public XLocalisedListBinding(java.lang.Object c,
                             java.lang.String dataElement,
                             java.lang.String destElement)
Construct a new data binding

Parameters:
c - the component to be bound
dataElement - the name of the data in the model
destElement - The path to the model node that acts as the output model

XLocalisedListBinding

public XLocalisedListBinding(java.lang.Object c,
                             java.lang.String dataElement,
                             java.lang.String destElement,
                             XModel srcModel,
                             XModel dstModel,
                             java.lang.String attribStr,
                             boolean saveToSource)
Construct a new data binding, and set the languageResourceBundle for text to be translated

Parameters:
c - the component to be bound
dataElement - the name of the data in the model
destElement - the name of the destination data in the model
srcModel - the model node that acts as the data source for this node
dstModel - the model node to which the selection is saved
saveToSource - true to save the selected value as the value of the source node, false to save only to the output node
Method Detail

setup

public void setup(java.lang.Object c,
                  XmlElement xmlElement)
Used to setup custom components where the constructor. The properties of the binding are specified by the xmlElement and the date pointed to by the dataElement path is bound to the component

Specified by:
setup in interface XCustomDataBinding
Parameters:
c - the component to bind to
xmlElement - the XML element which contains the binding configuration

translate

protected java.lang.String translate(java.lang.String key)
Translate the text being added to the list.

Parameters:
key - the key to be look up in the resourcebundle
Returns:
the translated key or the key itself if no translation found

addItem

protected java.lang.String addItem(java.lang.String s)
translate the text at this point

Overrides:
addItem in class XListBinding
Parameters:
s - the text to be translated
Returns:
The passed String

getKey

public java.lang.String getKey(int idx)
Get the untranslated key for a list item

Parameters:
idx - the list index
Returns:
the key at the specified index