org.formaria.aria.data
Class ValueBinding

java.lang.Object
  extended by org.formaria.aria.data.DataBinding
      extended by org.formaria.aria.data.ValueBinding

public class ValueBinding
extends DataBinding

Bind an ValueHolder to a data model value/node. The binding allows a 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 the Image component.

For a text component the source and destination area synonymous.

Copyright (c) Formaria Ltd., 2008. See license.txt for licensing details


Field Summary
protected  java.lang.String attribStr
           
 
Fields inherited from class org.formaria.aria.data.DataBinding
component, currentProject, DEFAULT_OUTPUT_PATH, outputModel, outputPath, reevaluate, sourceModel, sourcePath
 
Constructor Summary
ValueBinding()
          Construct a new data binding
 
Method Summary
 void get()
          Updates the ValueHolder with the value obtained from the data model.
 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.
protected  void setComponentValue(java.lang.Object value)
           
protected  void setModelValue(java.lang.Object value)
          Code moved from the set method to enable easier overloading.
 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, getAttributes, getComponent, getOutput, getOutputPath, getReevaluate, getSource, getSourcePath, setOutput, setOutputPath, setReevaluate, setSource, setSourcePath, setupHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attribStr

protected java.lang.String attribStr
Constructor Detail

ValueBinding

public ValueBinding()
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()
Updates the ValueHolder with the value obtained from the data model.

Specified by:
get in class DataBinding

setComponentValue

protected void setComponentValue(java.lang.Object value)

set

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

Specified by:
set in class DataBinding

setModelValue

protected void setModelValue(java.lang.Object value)
Code moved from the set method to enable easier overloading. The default behaviour is to receive the value from the ImageHolder component but in the case where the model needs to be updated on an index value instead of the text for example, the subclassed binding can overload the set method and call setModelValue with the appropriate value.

Parameters:
value - the value to be stored in the model.

getName

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

Returns:
the name

getType

public java.lang.String getType()
Get the type of this binding

Specified by:
getType in class DataBinding
Returns:
the binding type name