org.apache.tapestry.form
Class AbstractFormComponentContributor

java.lang.Object
  extended by org.apache.tapestry.form.AbstractFormComponentContributor
All Implemented Interfaces:
FormComponentContributor
Direct Known Subclasses:
AbstractTranslator

public abstract class AbstractFormComponentContributor
extends Object
implements FormComponentContributor

Abstract FormComponentContributor implementation that adds an optional static javscript method reference to the page.

Since:
4.0
Author:
Paul Ferraro

Constructor Summary
AbstractFormComponentContributor()
           
AbstractFormComponentContributor(String initializer)
           
 
Method Summary
 void accumulateProfileProperty(IFormComponent field, JSONObject profile, String key, Object property)
          Utility method to store a field specific profile property which can later be used by client side validation.
 void accumulateProperty(JSONObject profile, String key, Object value)
          Utility used to append onto an existing property represented as an object array.
 String defaultScript()
          Defines the default JavaScript file used by this contributor.
 String getScript()
           
 void renderContribution(IMarkupWriter writer, IRequestCycle cycle, FormComponentContributorContext context, IFormComponent field)
          Invoked by a form component after it finishes rendering its tag (but before the tag is closed) to allow this object to contribute to the component's rendering process.
 void setScript(String script)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFormComponentContributor

public AbstractFormComponentContributor()

AbstractFormComponentContributor

public AbstractFormComponentContributor(String initializer)
Method Detail

defaultScript

public String defaultScript()
Defines the default JavaScript file used by this contributor. Overriden by most subclasses that use JavaScript.


getScript

public String getScript()

setScript

public void setScript(String script)

renderContribution

public void renderContribution(IMarkupWriter writer,
                               IRequestCycle cycle,
                               FormComponentContributorContext context,
                               IFormComponent field)
Description copied from interface: FormComponentContributor
Invoked by a form component after it finishes rendering its tag (but before the tag is closed) to allow this object to contribute to the component's rendering process. Typically used by Validators and Translators to add javascript methods to the form's submit event handler.

Specified by:
renderContribution in interface FormComponentContributor
Parameters:
writer - allows contributor to write additional attributes into the component's tag
cycle - for accessing request information
context - utilities for genering messages and client-side validation
field - the field for which contributions are being rendered
See Also:
FormComponentContributor.renderContribution(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle, FormComponentContributorContext, org.apache.tapestry.form.IFormComponent)

accumulateProperty

public void accumulateProperty(JSONObject profile,
                               String key,
                               Object value)
Utility used to append onto an existing property represented as an object array.

Parameters:
profile -
key -
value -

accumulateProfileProperty

public void accumulateProfileProperty(IFormComponent field,
                                      JSONObject profile,
                                      String key,
                                      Object property)
Utility method to store a field specific profile property which can later be used by client side validation.

Parameters:
field - The field to store the property for, will key off of IFormComponent.getClientId().
profile - The profile for the form.
key - The property key to store.
property - The property to store.


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