org.apache.tapestry.param
Class AbstractParameterConnector

java.lang.Object
  extended by org.apache.tapestry.param.AbstractParameterConnector
All Implemented Interfaces:
IParameterConnector
Direct Known Subclasses:
BooleanParameterConnector, DoubleParameterConnector, IntParameterConnector, ObjectParameterConnector, StringParameterConnector

public abstract class AbstractParameterConnector
extends Object
implements IParameterConnector

Standard implementation of IParameterConnector. Subclasses add in the ability to clear parameters.

Since:
2.0.3
Version:
$Id: AbstractParameterConnector.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Constructor Summary
protected AbstractParameterConnector(IComponent component, String parameterName, IBinding binding)
          Creates a connector.
 
Method Summary
protected  IBinding getBinding()
           
protected  Object getBindingValue(Class requiredType)
          Gets the value of the binding.
 void resetParameter(IRequestCycle cycle)
          Restores the property to its default value.
protected  void setPropertyValue(Object value)
          Sets the property of the component to the specified value.
protected  boolean shouldSetPropertyValue(IRequestCycle cycle)
          Returns true if the connector should update the property value from the binding.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.param.IParameterConnector
setParameter
 

Constructor Detail

AbstractParameterConnector

protected AbstractParameterConnector(IComponent component,
                                     String parameterName,
                                     IBinding binding)
Creates a connector. In addition, obtains the current value of the component property; this value will be used to restore the component property.

Method Detail

setPropertyValue

protected void setPropertyValue(Object value)
Sets the property of the component to the specified value.


getBindingValue

protected Object getBindingValue(Class requiredType)
Gets the value of the binding.

Parameters:
requiredType - if not null, the expected type of the value object.
See Also:
IBinding.getObject(), IBinding.getObject(String, Class)

getBinding

protected IBinding getBinding()

toString

public String toString()
Overrides:
toString in class Object

resetParameter

public void resetParameter(IRequestCycle cycle)
Restores the property to its default value. For Direction.FORM parameters, extracts the property value and sets the binding form it (when appropriate).

Specified by:
resetParameter in interface IParameterConnector

shouldSetPropertyValue

protected boolean shouldSetPropertyValue(IRequestCycle cycle)
Returns true if the connector should update the property value from the binding. For Direction.IN, this always returns true. For Direction.FORM, this returns true only if the request cycle and the active form are rewinding.

Since:
2.2