org.apache.tapestry.form
Class Checkbox

java.lang.Object
  extended byorg.apache.hivemind.impl.BaseLocatable
      extended byorg.apache.tapestry.AbstractComponent
          extended byorg.apache.tapestry.form.AbstractFormComponent
              extended byorg.apache.tapestry.form.Checkbox
All Implemented Interfaces:
IComponent, IFormComponent, IRender, org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, ValidatableField

public abstract class Checkbox
extends AbstractFormComponent
implements ValidatableField

Implements a component that manages an HTML <input type=checkbox> form element. [ Component Reference ]

As of 4.0, this component can be validated.

Author:
Howard Lewis Ship, Paul Ferraro

Constructor Summary
Checkbox()
           
 
Method Summary
abstract  ValidatableFieldSupport getValidatableFieldSupport()
          Injected.
abstract  boolean getValue()
           
 boolean isRequired()
          Returns true if the field is required.
protected  void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
           
protected  void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
          In traditional HTML, many checkboxes would have the same name but different values.
abstract  void setValue(boolean selected)
           
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
getAlwaysRenderBodyOnRewind, getCanTakeFocus, getForm, getIdParameter, getName, renderComponent, renderDelegateAttributes, renderDelegatePrefix, renderDelegateSuffix, renderIdAttribute, setClientId, setForm, setName, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, finishLoad, finishLoad, format, format, format, format, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isInActiveState, isParameterBound, isRendering, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty, toString
 
Methods inherited from class org.apache.hivemind.impl.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.ValidatableField
getValidators
 
Methods inherited from interface org.apache.tapestry.form.IFormComponent
getClientId, getDisplayName, getForm, getName, isDisabled, setName
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isRendering, renderBody, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty
 
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
 

Constructor Detail

Checkbox

public Checkbox()
Method Detail

renderFormComponent

protected void renderFormComponent(IMarkupWriter writer,
                                   IRequestCycle cycle)
Specified by:
renderFormComponent in class AbstractFormComponent
See Also:
org.apache.tapestry.form.validator.AbstractRequirableField#renderRequirableFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

rewindFormComponent

protected void rewindFormComponent(IMarkupWriter writer,
                                   IRequestCycle cycle)
In traditional HTML, many checkboxes would have the same name but different values. Under Tapestry, it makes more sense to have different names and a fixed value. For a checkbox, we only care about whether the name appears as a request parameter.

Specified by:
rewindFormComponent in class AbstractFormComponent

getValue

public abstract boolean getValue()

setValue

public abstract void setValue(boolean selected)

getValidatableFieldSupport

public abstract ValidatableFieldSupport getValidatableFieldSupport()
Injected.


isRequired

public boolean isRequired()
Description copied from interface: IFormComponent
Returns true if the field is required. This will (typically) involve consulting the component's validators.

Specified by:
isRequired in interface IFormComponent
Overrides:
isRequired in class AbstractFormComponent
See Also:
AbstractFormComponent.isRequired()