org.apache.tapestry.contrib.form
Class MultiplePropertySelection

java.lang.Object
  extended by org.apache.tapestry.spec.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.form.AbstractFormComponent
              extended by org.apache.tapestry.contrib.form.MultiplePropertySelection
All Implemented Interfaces:
IFormComponent, IComponent, ILocatable, ILocationHolder, IRender

public abstract class MultiplePropertySelection
extends AbstractFormComponent

A component which uses <input type=checkbox> to set a property of some object. Typically, the values for the object are defined using an Enum. A MultiplePropertySelection is dependent on an {link IPropertySelectionModel} to provide the list of possible values.

Often, this is used to select one or more Enum to assign to a property; the EnumPropertySelectionModel class simplifies this.

The Palette component is more powerful, but requires client-side JavaScript and is not fully cross-browser compatible.

Parameter Type Direction Required Default Description
selectedList java.util.List in-out yes   The property to set. During rendering, this property is read, and sets the default value of the options in the select. When the form is submitted, list is cleared, then has each selected option added to it.
renderer IMultiplePropertySelectionRenderer in no shared instance of CheckBoxMultiplePropertySelectionRenderer Defines the object used to render this component. The default renders a table of checkboxes.
model IPropertySelectionModel in yes   The model provides a list of possible labels, and matches those labels against possible values that can be assigned back to the property.
disabled boolean in no false Controls whether the <select> is active or not. A disabled PropertySelection does not update its value parameter.

Corresponds to the disabled HTML attribute.

Informal parameters are not allowed.

Version:
$Id: MultiplePropertySelection.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Sanjay Munjal

Field Summary
static IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
          A shared instance of CheckBoxMultiplePropertySelectionRenderer.
 
Constructor Summary
MultiplePropertySelection()
           
 
Method Summary
protected  void finishLoad()
          Invoked, as a convienience, from AbstractComponent.finishLoad(IRequestCycle, IPageLoader, IComponentSpecification).
abstract  IPropertySelectionModel getModel()
           
abstract  IMultiplePropertySelectionRenderer getRenderer()
           
abstract  IBinding getSelectedListBinding()
           
abstract  boolean isDisabled()
          Returns true if the component is disabled (this is relevant to the renderer).
protected  void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
          Renders the component, much of which is the responsiblity of the renderer.
abstract  void setRenderer(IMultiplePropertySelectionRenderer renderer)
           
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
getDisplayName, getForm, getForm, getName, setForm, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, cleanupAfterRender, 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, 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.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
 

Field Detail

DEFAULT_CHECKBOX_RENDERER

public static final IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
A shared instance of CheckBoxMultiplePropertySelectionRenderer.

Constructor Detail

MultiplePropertySelection

public MultiplePropertySelection()
Method Detail

getSelectedListBinding

public abstract IBinding getSelectedListBinding()

finishLoad

protected void finishLoad()
Description copied from class: AbstractComponent
Invoked, as a convienience, from AbstractComponent.finishLoad(IRequestCycle, IPageLoader, IComponentSpecification). This implemenation does nothing. Subclasses may override without invoking this implementation.

Overrides:
finishLoad in class AbstractComponent

isDisabled

public abstract boolean isDisabled()
Returns true if the component is disabled (this is relevant to the renderer).


renderComponent

protected void renderComponent(IMarkupWriter writer,
                               IRequestCycle cycle)
Renders the component, much of which is the responsiblity of the renderer. The possible options, their labels, and the values to be encoded in the form are provided by the model.

Specified by:
renderComponent in class AbstractComponent

getModel

public abstract IPropertySelectionModel getModel()

getRenderer

public abstract IMultiplePropertySelectionRenderer getRenderer()

setRenderer

public abstract void setRenderer(IMultiplePropertySelectionRenderer renderer)