com.primix.tapestry.form
Class Checkbox

java.lang.Object
  |
  +--com.primix.tapestry.AbstractComponent
        |
        +--com.primix.tapestry.form.AbstractFormComponent
              |
              +--com.primix.tapestry.form.Checkbox
All Implemented Interfaces:
IComponent, IFormComponent, IRender

public class Checkbox
extends AbstractFormComponent

Implements a component that manages an HTML <input type=checkbox> form element.
Parameter Type Read / Write Required Default Description
selected java.lang.Boolean R / W yes   Indicates whether the checkbox is selected or not.

Corresponds to the checked HTML attribute.

disabled boolean R no false Controls whether the text field is active or not. If disabled, then any value that comes up when the form is submitted is ignored.

Corresponds to the disabled HTML attribute.

Informal parameters are allowed. A body is not allowed.

Version:
$Id: Checkbox.java,v 1.9 2001/08/28 20:33:41 hship Exp $
Author:
Howard Ship

Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Constructor Summary
Checkbox()
           
 
Method Summary
 IBinding getDisabledBinding()
           
 java.lang.String getName()
          Returns the name of the component, which is automatically generated during renderring.
 IBinding getSelectedBinding()
           
 void render(IResponseWriter writer, IRequestCycle cycle)
          Renders the form elements, or responds when the form containing the element is submitted (by checking Form.isRewinding().
 void setDisabledBinding(IBinding value)
           
 void setSelectedBinding(IBinding value)
           
 
Methods inherited from class com.primix.tapestry.form.AbstractFormComponent
getForm, getForm
 
Methods inherited from class com.primix.tapestry.AbstractComponent
addAsset, addComponent, addWrapped, cleanupAfterRender, cleanupComponent, finishLoad, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getPage, getSpecification, prepareForRender, renderWrapped, reset, setBinding, setContainer, setId, setPage, setSpecification, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.primix.tapestry.IComponent
addAsset, addComponent, addWrapped, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getPage, getSpecification, renderWrapped, setBinding, setContainer, setId, setPage, setSpecification
 

Constructor Detail

Checkbox

public Checkbox()
Method Detail

getName

public java.lang.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.

Overrides:
getName in class AbstractFormComponent

getDisabledBinding

public IBinding getDisabledBinding()

getSelectedBinding

public IBinding getSelectedBinding()

render

public void render(IResponseWriter writer,
                   IRequestCycle cycle)
            throws RequestCycleException
Renders the form elements, or responds when the form containing the element is submitted (by checking Form.isRewinding().

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.


setDisabledBinding

public void setDisabledBinding(IBinding value)

setSelectedBinding

public void setSelectedBinding(IBinding value)