net.sf.tapestry.contrib.form
Class MultiplePropertySelection

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

public 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 PropertySelection 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.

Parameter Type Read / Write Required Default Description
selectedList java.util.List R / W 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 R no shared instance of CheckBoxMultiplePropertySelectionRenderer Defines the object used to render this component. The default renders a table of checkboxes.
model IPropertySelectionModel R 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 R 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,v 1.3 2001/09/10 18:25:13 hship Exp $
Author:
Sanjay Munjal

Field Summary
static IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
          A shared instance of CheckBoxPropertySelectionRenderer.
 
Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Constructor Summary
MultiplePropertySelection()
           
 
Method Summary
 IBinding getDisabledBinding()
           
 IBinding getModelBinding()
           
 java.lang.String getName()
          Returns the name assigned to this PropertySelection by the Form that wraps it.
 IBinding getRendererBinding()
           
 IBinding getSelectedListBinding()
           
 boolean isDisabled()
          Returns true if the component is disabled (this is relevant to the renderer).
 void render(IResponseWriter writer, IRequestCycle cycle)
          Renders the component, much of which is the responsiblity of the renderer.
 void setDisabledBinding(IBinding value)
           
 void setModelBinding(IBinding value)
           
 void setRendererBinding(IBinding value)
           
 void setSelectedListBinding(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
 

Field Detail

DEFAULT_CHECKBOX_RENDERER

public static final IMultiplePropertySelectionRenderer DEFAULT_CHECKBOX_RENDERER
A shared instance of CheckBoxPropertySelectionRenderer.
Constructor Detail

MultiplePropertySelection

public MultiplePropertySelection()
Method Detail

getSelectedListBinding

public IBinding getSelectedListBinding()

setSelectedListBinding

public void setSelectedListBinding(IBinding value)

getModelBinding

public IBinding getModelBinding()

setModelBinding

public void setModelBinding(IBinding value)

getDisabledBinding

public IBinding getDisabledBinding()

setDisabledBinding

public void setDisabledBinding(IBinding value)

setRendererBinding

public void setRendererBinding(IBinding value)

getRendererBinding

public IBinding getRendererBinding()

getName

public java.lang.String getName()
Returns the name assigned to this PropertySelection by the Form that wraps it.
Overrides:
getName in class AbstractFormComponent

isDisabled

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

render

public void render(IResponseWriter writer,
                   IRequestCycle cycle)
            throws RequestCycleException
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.