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.contrib.form.MultiplePropertySelection
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, IFormComponent, ValidatableField, IComponent, IDirectEvent, Component, IRender

public abstract class MultiplePropertySelection
extends AbstractFormComponent
implements ValidatableField

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 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, this component can be validated.

Author:
Sanjay Munjal

Field Summary
static IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
          A shared instance of CheckBoxMultiplePropertySelectionRenderer.
 
Fields inherited from class org.apache.tapestry.AbstractComponent
_body, _bodyCount
 
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  Collection getSelectedList()
           
abstract  ValidatableFieldSupport getValidatableFieldSupport()
           
 boolean isRequired()
          Returns false.
protected  void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
          Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to render the component.
protected  void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
          Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to rewind the component.
abstract  void setRenderer(IMultiplePropertySelectionRenderer renderer)
           
abstract  void setSelectedList(Collection selectedList)
           
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
generateClientId, getCanTakeFocus, getForm, getIdParameter, getName, getRenderBodyOnRewind, peekClientId, renderComponent, renderDelegateAttributes, renderDelegatePrefix, renderDelegateSuffix, setForm, setName, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, equals, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getBoundId, getClientId, getComponent, getComponents, getContainedComponent, getContainedRenderers, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getInnerRenderers, getListeners, getMessages, getNamespace, getPage, getRenderWorker, getSpecification, getSpecifiedId, getTemplateTagName, hasEvents, hashCode, isInActiveState, isParameterBound, isRendering, isStateful, pageEndRender, prepareForRender, render, renderBody, renderIdAttribute, renderInformalParameters, setBinding, setClientId, setContainedComponent, setContainer, setHasEvents, setId, setNamespace, setPage, setTemplateTagName, toString, triggerEvent
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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, 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
 

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 Collection getSelectedList()

setSelectedList

public abstract void setSelectedList(Collection selectedList)

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

renderFormComponent

protected void renderFormComponent(IMarkupWriter writer,
                                   IRequestCycle cycle)
Description copied from class: AbstractFormComponent
Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to render the component.

Specified by:
renderFormComponent in class AbstractFormComponent

rewindFormComponent

protected void rewindFormComponent(IMarkupWriter writer,
                                   IRequestCycle cycle)
Description copied from class: AbstractFormComponent
Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to rewind the component. If the component is disabled this will not be invoked.

Specified by:
rewindFormComponent in class AbstractFormComponent
See Also:
org.apache.tapestry.form.AbstractRequirableField#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

getModel

public abstract IPropertySelectionModel getModel()

getRenderer

public abstract IMultiplePropertySelectionRenderer getRenderer()

setRenderer

public abstract void setRenderer(IMultiplePropertySelectionRenderer renderer)

getValidatableFieldSupport

public abstract ValidatableFieldSupport getValidatableFieldSupport()

isRequired

public boolean isRequired()
Description copied from class: AbstractFormComponent
Returns false. Subclasses that might be required must override this method. Typically, this involves checking against the component's validators.

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


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