org.apache.tapestry.contrib.form
Class MultiplePropertySelection

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.form.AbstractFormComponent
              extended by org.apache.tapestry.form.AbstractRequirableField
                  extended by org.apache.tapestry.contrib.form.MultiplePropertySelection
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, org.apache.tapestry.form.IFormComponent, org.apache.tapestry.form.RequirableField, org.apache.tapestry.IComponent, org.apache.tapestry.IRender

public abstract class MultiplePropertySelection
extends org.apache.tapestry.form.AbstractRequirableField

A component which uses <input type=checkbox> to set a property of some object. Typically, the values for the object are defined using an org.apache.commons.lang.enum.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 org.apache.commons.lang.enum.Enumto assign to a property; the org.apache.tapestry.form.EnumPropertySelectionModelclass simplifies this.

The Palettecomponent 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. As of 4.0, MultiplePropertySelection can indicate that it is required.

Author:
Sanjay Munjal

Field Summary
static IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
          A shared instance of CheckBoxMultiplePropertySelectionRenderer.
 
Constructor Summary
MultiplePropertySelection()
           
 
Method Summary
 void bind(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
           
protected  void finishLoad()
           
abstract  org.apache.tapestry.form.IPropertySelectionModel getModel()
           
abstract  IMultiplePropertySelectionRenderer getRenderer()
           
abstract  java.util.List getSelectedList()
           
 java.lang.String getSubmittedValue(org.apache.tapestry.IRequestCycle cycle)
           
protected  void renderComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
          Renders the component, much of which is the responsiblity of the renderer.
protected  void renderFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
           
protected  void rewindFormComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
           
abstract  void setRenderer(IMultiplePropertySelectionRenderer renderer)
           
abstract  void setSelectedList(java.util.List selectedList)
           
 
Methods inherited from class org.apache.tapestry.form.AbstractRequirableField
getRequirableFieldSupport, setRequiredMessage
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
getForm, getIdParameter, getName, renderDelegateAttributes, renderDelegatePrefix, renderDelegateSuffix, renderIdAttribute, select, setClientId, setForm, setName, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, finishLoad, format, format, format, format, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isInActiveState, isParameterBound, isRendering, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, 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.RequirableField
getRequiredMessage, isRequired
 
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, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isRendering, renderBody, setBinding, 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
 

Field Detail

DEFAULT_CHECKBOX_RENDERER

public static final IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
A shared instance of CheckBoxMultiplePropertySelectionRenderer.

Constructor Detail

MultiplePropertySelection

public MultiplePropertySelection()
Method Detail

getSelectedList

public abstract java.util.List getSelectedList()

setSelectedList

public abstract void setSelectedList(java.util.List selectedList)

finishLoad

protected void finishLoad()
Overrides:
finishLoad in class org.apache.tapestry.AbstractComponent

getSubmittedValue

public java.lang.String getSubmittedValue(org.apache.tapestry.IRequestCycle cycle)
Specified by:
getSubmittedValue in interface org.apache.tapestry.form.RequirableField
Overrides:
getSubmittedValue in class org.apache.tapestry.form.AbstractRequirableField
See Also:
AbstractRequirableField.getSubmittedValue(org.apache.tapestry.IRequestCycle)

renderFormComponent

protected void renderFormComponent(org.apache.tapestry.IMarkupWriter writer,
                                   org.apache.tapestry.IRequestCycle cycle)
Overrides:
renderFormComponent in class org.apache.tapestry.form.AbstractRequirableField
See Also:
AbstractRequirableField.renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

rewindFormComponent

protected void rewindFormComponent(org.apache.tapestry.IMarkupWriter writer,
                                   org.apache.tapestry.IRequestCycle cycle)
Overrides:
rewindFormComponent in class org.apache.tapestry.form.AbstractRequirableField
See Also:
AbstractRequirableField.rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

bind

public void bind(org.apache.tapestry.IMarkupWriter writer,
                 org.apache.tapestry.IRequestCycle cycle)
          throws org.apache.tapestry.valid.ValidatorException
Throws:
org.apache.tapestry.valid.ValidatorException
See Also:
RequirableField.bind(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

renderComponent

protected void renderComponent(org.apache.tapestry.IMarkupWriter writer,
                               org.apache.tapestry.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.

Overrides:
renderComponent in class org.apache.tapestry.form.AbstractFormComponent

getModel

public abstract org.apache.tapestry.form.IPropertySelectionModel getModel()

getRenderer

public abstract IMultiplePropertySelectionRenderer getRenderer()

setRenderer

public abstract void setRenderer(IMultiplePropertySelectionRenderer renderer)