org.apache.tapestry.form
Interface IFormComponent

All Superinterfaces:
IComponent, IRender, org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder
All Known Subinterfaces:
TranslatedField, ValidatableField, ValidatableFieldExtension
All Known Implementing Classes:
AbstractFormComponent, AbstractFormWidget, AbstractPostfield, Autocompleter, Button, Checkbox, DateField, DatePicker, DropdownDatePicker, DropdownTimePicker, ForBean, FormConditional, GTimePicker, Hidden, IfBean, ImageSubmit, LinkSubmit, ListEdit, MultiplePropertySelection, NumericField, Palette, Postfield, PropertySelection, Radio, RadioGroup, Select, SelectionField, Submit, Suggest, TextArea, TextField, Upload, ValidatingTextField, ValidField

public interface IFormComponent
extends IComponent

A common interface implemented by all form components (components that create interactive elements in the rendered page).

Author:
Howard Lewis Ship

Method Summary
 String getClientId()
          Returns the component's client-side element id.
 String getDisplayName()
          May be implemented to return a user-presentable, localized name for the component, which is used in labels or error messages.
 IForm getForm()
          Returns the IForm which contains the component, or null if the component is not contained by a form, or if the containing Form is not currently rendering.
 String getName()
          Returns the name of the component, which is automatically generated during renderring.
 boolean isDisabled()
          Returns true if the component is disabled.
 boolean isRequired()
          Returns true if the field is required.
 void setName(String name)
          Invoked by FormBehavior.getElementId(IFormComponent) when a name is created for a form component.
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, peekClientId, renderBody, setBinding, setClientId, setContainedComponent, setContainer, setId, setNamespace, setPage, setTemplateTagName
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.hivemind.LocationHolder
setLocation
 
Methods inherited from interface org.apache.hivemind.Locatable
getLocation
 

Method Detail

getForm

IForm getForm()
Returns the IForm which contains the component, or null if the component is not contained by a form, or if the containing Form is not currently rendering.


getName

String getName()
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 ForBean, 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.


setName

void setName(String name)
Invoked by FormBehavior.getElementId(IFormComponent) when a name is created for a form component.

Since:
3.0
See Also:
FormBehavior.getElementId(IFormComponent)

getDisplayName

String getDisplayName()
May be implemented to return a user-presentable, localized name for the component, which is used in labels or error messages. Most components simply return null.

Since:
1.0.9

isDisabled

boolean isDisabled()
Returns true if the component is disabled. This is important when the containing form is submitted, since disabled parameters do not update their bindings.

Since:
2.2

getClientId

String getClientId()
Returns the component's client-side element id. Typically, this is specified using an id parameter on the component and is passed through IRequestCycle.getUniqueId(String) to ensure that it is unique. The component is expected to write an id attribute (if it has a non null id). As with getName(), if a component renders more than once (such as inside a loop) then on each render it will have a different clientId.

Note:Though semantically this method should result in the roughly the same results, the method used to create unique client ID's on form components is not the same as that defined in IComponent.

Specified by:
getClientId in interface IComponent
Returns:
the id, or null if the component doesn't support an id.
Since:
4.0

isRequired

boolean isRequired()
Returns true if the field is required. This will (typically) involve consulting the component's validators.

Since:
4.0


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.