org.trails.component
Class FilteredAssociationSelect

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.PropertySelection
                  extended by org.trails.component.AbstractPropertySelection
                      extended by org.trails.component.AssociationSelect
                          extended by org.trails.component.FilteredAssociationSelect
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, org.apache.tapestry.form.IFormComponent, org.apache.tapestry.form.ValidatableField, org.apache.tapestry.IComponent, org.apache.tapestry.IDirectEvent, org.apache.tapestry.internal.Component, org.apache.tapestry.IRender

public abstract class FilteredAssociationSelect
extends AssociationSelect

Component that renders a select element based on the annotations InitialValue and PossibleValues.

If the property has a PossibleValues annotation, the select will render its options evaluating the expression passed as the value of the annotation.

If the property has a InitialValue it will render all instances of that property type and resubmit the form every time the value changes, so the related select values can be filtered.

Author:
pruggia

Field Summary
 
Fields inherited from class org.apache.tapestry.AbstractComponent
_body, _bodyCount
 
Constructor Summary
FilteredAssociationSelect()
           
 
Method Summary
 org.apache.tapestry.form.IPropertySelectionModel buildSelectionModel()
          Creates an IPropertySelectionModel based on properties annotated with PossibleValues and InitialValue.
 java.lang.String getOnChangeJavascript()
          If the property is annotated with InitialValue, this method generates javascript code to submit the form and update the options for the filtered property.
abstract  java.lang.Object getPageModel()
           
protected  void prepareForRender(org.apache.tapestry.IRequestCycle cycle)
          Sets the initial value for the property based on the expression declared in the InitialValue annotation.
 
Methods inherited from class org.trails.component.AssociationSelect
getClassDescriptor, getDescriptorService, getPersistenceService
 
Methods inherited from class org.trails.component.AbstractPropertySelection
getIdParameter, getInstances, getModel, getNoneLabel, getOptionRenderer, getPropertyDescriptor, getValidatableFieldSupport, getValue, isAllowNone, setAllowNone, setInstances, setModel, setNoneLabel, setPropertyDescriptor, setValue
 
Methods inherited from class org.apache.tapestry.form.PropertySelection
isRequired, renderFormComponent, rewindFormComponent
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
generateClientId, getCanTakeFocus, getForm, 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, 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, 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
 

Constructor Detail

FilteredAssociationSelect

public FilteredAssociationSelect()
Method Detail

getPageModel

@Parameter(required=true)
public abstract java.lang.Object getPageModel()

prepareForRender

protected void prepareForRender(org.apache.tapestry.IRequestCycle cycle)
Sets the initial value for the property based on the expression declared in the InitialValue annotation.

Overrides:
prepareForRender in class org.apache.tapestry.AbstractComponent
Parameters:
cycle - the request cycle, it's never null.

buildSelectionModel

public org.apache.tapestry.form.IPropertySelectionModel buildSelectionModel()
Creates an IPropertySelectionModel based on properties annotated with PossibleValues and InitialValue.

Overrides:
buildSelectionModel in class AssociationSelect
Returns:
Returns the selection model, it never returns null.

getOnChangeJavascript

public java.lang.String getOnChangeJavascript()
If the property is annotated with InitialValue, this method generates javascript code to submit the form and update the options for the filtered property.

Returns:
a fragment of javascript. It never returns null.


Copyright © 2004-2008. All Rights Reserved.