org.japano.action
Class Parameter

java.lang.Object
  extended by org.japano.action.Parameter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Attribute, Info, Radio, Select, Submit, TextArea, TextField

public abstract class Parameter
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Wraps a single HTTP parameter mapped to an Action property. This class is the base class for all action parameters.

Version:
$Id: Parameter.java,v 1.18 2005/11/27 06:56:24 fforw Exp $ SourceForge.net Logo
Author:
Sven Helmberger ( sven dot helmberger at gmx dot de )
See Also:
Serialized Form

Field Summary
protected  java.lang.String defaultValue
          The default form value for this parameter.
protected  java.lang.String errorMessage
          Error message displayed when the validation fails.
protected  Parametrized parent
          Parent bean of this parameter.
protected  Validator validator
          validator for this parameter or null.
 
Constructor Summary
Parameter()
           
 
Method Summary
protected static java.lang.String addListVariable(org.japano.jasper.compiler.ServletWriter servletWriter, java.lang.String varBaseName, java.util.List l)
           
protected static void addStyleAttributes(Tag tag)
           
protected  void appendAttribute(org.japano.jasper.compiler.ServletWriter servletWriter, java.lang.String name, java.lang.String value, org.japano.jasper.compiler.CompilationContext context, java.lang.Class target)
           
protected  void appendStyleAttributes(org.japano.jasper.compiler.ServletWriter servletWriter, java.lang.String styleId, java.lang.String styleClass, java.lang.String style, org.japano.jasper.compiler.CompilationContext context)
           
 java.lang.Object clone()
           
abstract  void configure(MetadataTag tag)
          Configures this paramater instance with information by the given MetadataTag.
 void configureValidation(MetadataTag validationTag)
           
abstract  java.util.List createTags(ActionTag parent)
          Generates a Tag for this type of parameter.
 java.lang.String getAccessorName()
           
abstract  void getCode(org.japano.jasper.compiler.ServletWriter servletWriter, org.japano.jasper.compiler.CompilationContext context, java.lang.String styleId, java.lang.String styleClass, java.lang.String style)
          Returns the input field code for this type of parameter
 java.lang.String getDefaultValue()
          Getter for property defaultValue.
 java.lang.String getDescription()
          Getter for property description.
 java.lang.String getErrorMessage()
           
 java.lang.String getFieldId()
           
protected  java.lang.reflect.Method getMutator(java.lang.Class beanClass)
           
 java.lang.String getMutatorName()
           
 java.lang.String getName()
          setter for property name.
 java.lang.String getProperty()
          setter for property property.
 java.lang.String getQualifiedName()
           
 java.lang.String getRequiredMessage()
           
protected  java.lang.String getTagName(java.lang.String actionName)
           
 java.lang.Class getType()
           
protected  java.lang.reflect.Method getValueMethod()
           
 boolean isRequired()
          Returns whether the parameter is required or not.
static java.lang.String makeFieldId(java.lang.String text)
           
 void set(java.lang.Object bean, java.lang.String value)
           
 void set(java.lang.Object bean, java.lang.String[] value)
           
 void setDefaultValue(java.lang.String defaultValue)
          Setter for property defaultValue.
 void setDescription(java.lang.String description)
          Setter for property description.
 void setName(java.lang.String name)
          Setter for property name.
 void setParent(Parametrized parent)
           
 void setProperty(java.lang.String property)
          Setter for property property.
 void setValidator(Validator validator)
           
 java.lang.String toString()
           
protected  java.lang.String validate(Session session, java.lang.String value)
           
protected  JavaExpression valueExpression()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected Parametrized parent
Parent bean of this parameter. Is null if the parameter is the child of an action.


validator

protected Validator validator
validator for this parameter or null.


errorMessage

protected java.lang.String errorMessage
Error message displayed when the validation fails.


defaultValue

protected java.lang.String defaultValue
The default form value for this parameter.

Constructor Detail

Parameter

public Parameter()
Method Detail

isRequired

public boolean isRequired()
Returns whether the parameter is required or not.

Returns:
required?

getName

public java.lang.String getName()
setter for property name.

Returns:
Value of property name.

setName

public void setName(java.lang.String name)
Setter for property name.

Parameters:
name - New value of property name.

getProperty

public java.lang.String getProperty()
setter for property property.

Returns:
Value of property property.

setProperty

public void setProperty(java.lang.String property)
Setter for property property.

Parameters:
property - New value of property property.

getDescription

public java.lang.String getDescription()
Getter for property description.

Returns:
Value of property description.

setDescription

public void setDescription(java.lang.String description)
Setter for property description.

Parameters:
description - New value of property description.

getQualifiedName

public java.lang.String getQualifiedName()

getType

public java.lang.Class getType()

getErrorMessage

public java.lang.String getErrorMessage()

set

public void set(java.lang.Object bean,
                java.lang.String value)

set

public void set(java.lang.Object bean,
                java.lang.String[] value)

validate

protected java.lang.String validate(Session session,
                                    java.lang.String value)
                             throws InvalidParameterException
Throws:
InvalidParameterException

getMutatorName

public java.lang.String getMutatorName()

getAccessorName

public java.lang.String getAccessorName()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setParent

public void setParent(Parametrized parent)

getMutator

protected java.lang.reflect.Method getMutator(java.lang.Class beanClass)

getTagName

protected java.lang.String getTagName(java.lang.String actionName)

configureValidation

public void configureValidation(MetadataTag validationTag)

valueExpression

protected JavaExpression valueExpression()

getValueMethod

protected java.lang.reflect.Method getValueMethod()

appendAttribute

protected void appendAttribute(org.japano.jasper.compiler.ServletWriter servletWriter,
                               java.lang.String name,
                               java.lang.String value,
                               org.japano.jasper.compiler.CompilationContext context,
                               java.lang.Class target)

addStyleAttributes

protected static void addStyleAttributes(Tag tag)

appendStyleAttributes

protected void appendStyleAttributes(org.japano.jasper.compiler.ServletWriter servletWriter,
                                     java.lang.String styleId,
                                     java.lang.String styleClass,
                                     java.lang.String style,
                                     org.japano.jasper.compiler.CompilationContext context)

addListVariable

protected static java.lang.String addListVariable(org.japano.jasper.compiler.ServletWriter servletWriter,
                                                  java.lang.String varBaseName,
                                                  java.util.List l)

getDefaultValue

public java.lang.String getDefaultValue()
Getter for property defaultValue.

Returns:
Value of property defaultValue.

setDefaultValue

public void setDefaultValue(java.lang.String defaultValue)
Setter for property defaultValue.

Parameters:
defaultValue - New value of property defaultValue.

getRequiredMessage

public java.lang.String getRequiredMessage()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

setValidator

public void setValidator(Validator validator)

createTags

public abstract java.util.List createTags(ActionTag parent)
Generates a Tag for this type of parameter.

Parameters:
parent - action tag this parameter is child of
Returns:
Tag or null

getCode

public abstract void getCode(org.japano.jasper.compiler.ServletWriter servletWriter,
                             org.japano.jasper.compiler.CompilationContext context,
                             java.lang.String styleId,
                             java.lang.String styleClass,
                             java.lang.String style)
Returns the input field code for this type of parameter

Parameters:
servletWriter - ServletWriter
context - PageNodeCreator context
styleId - HTML id attribute
styleClass - HTML class attribute
style - HTML style attribute

configure

public abstract void configure(MetadataTag tag)
Configures this paramater instance with information by the given MetadataTag.


getFieldId

public java.lang.String getFieldId()

makeFieldId

public static java.lang.String makeFieldId(java.lang.String text)