com.primix.tapestry.form
Class PropertySelection

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

public class PropertySelection
extends AbstractFormComponent

A component which uses either <select> and <option> elements or <input type=radio> 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 a particular Enum to assign to a property; the EnumPropertySelectionModel class simplifies this.

Parameter Type Read / Write Required Default Description
value java.lang.Object R / W yes   The property to set. During rendering, this property is read, and sets the default value of the selection (if it is null, no element is selected). When the form is submitted, this property is updated based on the new selection.
renderer IPropertySelectionRenderer R no shared instance of SelectPropertySelectionRenderer Defines the object used to render the PropertySelection.

SelectPropertySelectionRenderer renders the component as a <select>.

RadioPropertySelectionRenderer renders the component as a table of radio buttons.

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 allowed, and are applied to the <select> element. A body is not allowed.

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

Field Summary
static IPropertySelectionRenderer DEFAULT_RADIO_RENDERER
          A shared instance of RadioPropertySelectionRenderer.
static IPropertySelectionRenderer DEFAULT_SELECT_RENDERER
          A shared instance of SelectPropertySelectionRenderer.
 
Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Constructor Summary
PropertySelection()
           
 
Method Summary
 IPropertySelectionRenderer getDefaultRadioRenderer()
          Deprecated. Use instead.
 IPropertySelectionRenderer getDefaultSelectRenderer()
          Deprecated. Use DEFAULT_SELECT_RENDERER instead.
 IBinding getDisabledBinding()
           
 IBinding getModelBinding()
           
 java.lang.String getName()
          Returns the name assigned to this PropertySelection by the Form that wraps it.
 IBinding getRendererBinding()
           
 IBinding getValueBinding()
           
 boolean isDisabled()
          Returns true if this PropertySelection's disabled parameter yields true.
 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 setValueBinding(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_SELECT_RENDERER

public static final IPropertySelectionRenderer DEFAULT_SELECT_RENDERER
A shared instance of SelectPropertySelectionRenderer.

DEFAULT_RADIO_RENDERER

public static final IPropertySelectionRenderer DEFAULT_RADIO_RENDERER
A shared instance of RadioPropertySelectionRenderer.
Constructor Detail

PropertySelection

public PropertySelection()
Method Detail

getValueBinding

public IBinding getValueBinding()

setValueBinding

public void setValueBinding(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 this PropertySelection's disabled parameter yields true. The corresponding HTML control(s) should be disabled.

getDefaultSelectRenderer

public IPropertySelectionRenderer getDefaultSelectRenderer()
Deprecated. Use DEFAULT_SELECT_RENDERER instead.

Returns the default SelectPropertySelectionRenderer instance. This is a shared instance.

getDefaultRadioRenderer

public IPropertySelectionRenderer getDefaultRadioRenderer()
Deprecated. Use instead.

Returns a shared instance of RadioPropertySelectionRenderer.

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, thier labels, and the values to be encoded in the form are provided by the model.