org.apache.tapestry.form
Class AbstractFormComponent

java.lang.Object
  extended by org.apache.tapestry.spec.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.form.AbstractFormComponent
All Implemented Interfaces:
IFormComponent, IComponent, ILocatable, ILocationHolder, IRender
Direct Known Subclasses:
AbstractPostfield, AbstractTextField, Button, Checkbox, DatePicker, FormConditional, Hidden, ImageSubmit, LinkSubmit, ListEdit, MultiplePropertySelection, PropertySelection, RadioGroup, Select, Submit, TextArea, Upload

public abstract class AbstractFormComponent
extends AbstractComponent
implements IFormComponent

A base class for building components that correspond to HTML form elements. All such components must be wrapped (directly or indirectly) by a Form component.

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

Constructor Summary
AbstractFormComponent()
           
 
Method Summary
 String getDisplayName()
          Implemented in some subclasses to provide a display name (suitable for presentation to the user as a label or error message).
abstract  IForm getForm()
          Returns the IForm which contains the component, or null if the component is not contained by a form, of if the containing Form is not currently renderring.
 IForm getForm(IRequestCycle cycle)
          Returns the Form wrapping this component.
abstract  String getName()
          Returns the name of the component, which is automatically generated during renderring.
abstract  void setForm(IForm form)
           
abstract  void setName(String name)
          Invoked by IForm.getElementId(IFormComponent) when a name is created for a form component.
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, cleanupAfterRender, finishLoad, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, format, format, format, format, formatString, formatString, formatString, formatString, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, pageEndRender, prepareForRender, render, renderBody, renderComponent, renderInformalParameters, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification, toString
 
Methods inherited from class org.apache.tapestry.spec.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.form.IFormComponent
isDisabled
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, renderBody, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.tapestry.ILocationHolder
setLocation
 
Methods inherited from interface org.apache.tapestry.ILocatable
getLocation
 

Constructor Detail

AbstractFormComponent

public AbstractFormComponent()
Method Detail

getForm

public IForm getForm(IRequestCycle cycle)
Returns the Form wrapping this component. Invokes setForm(IForm) (so that the component may know, later, what the form is). Also, if the form has a delegate, then IValidationDelegate.setFormComponent(IFormComponent) is invoked.

Throws:
ApplicationRuntimeException - if the component is not wrapped by a Form.

getForm

public abstract IForm getForm()
Description copied from interface: IFormComponent
Returns the IForm which contains the component, or null if the component is not contained by a form, of if the containing Form is not currently renderring.

Specified by:
getForm in interface IFormComponent

setForm

public abstract void setForm(IForm form)

getName

public abstract String getName()
Description copied from interface: IFormComponent
Returns the name of the component, which is automatically generated during renderring.

This value is set inside the component's render method and is not cleared. If the component is inside a Foreach, the value returned is the most recent name generated for the component.

This property is made available to facilitate writing JavaScript that allows components (in the client web browser) to interact.

In practice, a Script component works with the Body component to get the JavaScript code inserted and referenced.

Specified by:
getName in interface IFormComponent

setName

public abstract void setName(String name)
Description copied from interface: IFormComponent
Invoked by IForm.getElementId(IFormComponent) when a name is created for a form component.

Specified by:
setName in interface IFormComponent

getDisplayName

public String getDisplayName()
Implemented in some subclasses to provide a display name (suitable for presentation to the user as a label or error message). This implementation return null.

Specified by:
getDisplayName in interface IFormComponent