org.apache.tapestry5.corelib.base
Class AbstractField

java.lang.Object
  extended by org.apache.tapestry5.corelib.base.AbstractField
All Implemented Interfaces:
ClientElement, Field
Direct Known Subclasses:
AbstractTextField, Checkbox, Checklist, DateField, KaptchaField, Palette, Select, Upload

@SupportsInformalParameters
public abstract class AbstractField
extends Object
implements Field

Provides initialization of the clientId and elementName properties. In addition, adds the RenderInformals, RenderDisabled and DiscardBody mixins.


Constructor Summary
AbstractField()
           
 
Method Summary
protected  void decorateInsideField()
          Invoked from subclasses after they have written their tag and (where appropriate) their informal parameters and have allowed their Validator to write markup as well.
 String getClientId()
          Returns a unique id for the element.
 String getControlName()
          Returns the value used as the name attribute of the rendered element.
 String getLabel()
          Returns a user presentable (localized) label for the field, which may be used inside <label> elements on the client, and inside client or server-side validation error messages.
 boolean isDisabled()
          Returns true if the field is disabled; A disabled field will render a disabled attribute so that it is non-responsive on the client (at least, until its disabled status is changed on the client using JavaScript).
 boolean isRequired()
          Returns false; most components do not support declarative validation.
protected abstract  void processSubmission(String controlName)
          Method implemented by subclasses to actually do the work of processing the submission of the form.
protected  void putPropertyNameIntoBeanValidationContext(String parameterName)
           
protected  void removePropertyNameFromBeanValidationContext()
           
protected  void setDecorator(ValidationDecorator decorator)
           
protected  void setFormSupport(FormSupport formSupport)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractField

public AbstractField()
Method Detail

getLabel

public final String getLabel()
Description copied from interface: Field
Returns a user presentable (localized) label for the field, which may be used inside <label> elements on the client, and inside client or server-side validation error messages.

Specified by:
getLabel in interface Field
Returns:
the label
See Also:
Label

getClientId

public final String getClientId()
Description copied from interface: ClientElement
Returns a unique id for the element. This value will be unique for any given rendering of a page. This value is intended for use as the id attribute of the client-side element, and will be used with any DHTML/Ajax related JavaScript.

Specified by:
getClientId in interface ClientElement

getControlName

public final String getControlName()
Description copied from interface: Field
Returns the value used as the name attribute of the rendered element. This value will be unique within an enclosing form, even if the same component renders multiple times.

Specified by:
getControlName in interface Field
See Also:
FormSupport.allocateControlName(String)

isDisabled

public final boolean isDisabled()
Description copied from interface: Field
Returns true if the field is disabled; A disabled field will render a disabled attribute so that it is non-responsive on the client (at least, until its disabled status is changed on the client using JavaScript). A disabled field will ignore any value passed up in a form submit request. Care must be taken if the disabled status of a field can change between the time the field is rendered and the time the enclosing form is submitted.

Specified by:
isDisabled in interface Field

processSubmission

protected abstract void processSubmission(String controlName)
Method implemented by subclasses to actually do the work of processing the submission of the form. The element's controlName property will already have been set. This method is only invoked if the field is not disabled.

Parameters:
controlName - the control name of the rendered element (used to find the correct parameter in the request)

decorateInsideField

protected final void decorateInsideField()
Invoked from subclasses after they have written their tag and (where appropriate) their informal parameters and have allowed their Validator to write markup as well.


setDecorator

protected final void setDecorator(ValidationDecorator decorator)

setFormSupport

protected final void setFormSupport(FormSupport formSupport)

isRequired

public boolean isRequired()
Returns false; most components do not support declarative validation.

Specified by:
isRequired in interface Field
Returns:
true if a non-blank value is required for the field

putPropertyNameIntoBeanValidationContext

protected void putPropertyNameIntoBeanValidationContext(String parameterName)

removePropertyNameFromBeanValidationContext

protected void removePropertyNameFromBeanValidationContext()


Copyright © 2003-2012 The Apache Software Foundation.