org.apache.tapestry.form
Class FormComponentContributorContextImpl

java.lang.Object
  extended by org.apache.tapestry.form.ValidationMessagesImpl
      extended by org.apache.tapestry.form.FormComponentContributorContextImpl
All Implemented Interfaces:
FormComponentContributorContext, ValidationMessages

public class FormComponentContributorContextImpl
extends ValidationMessagesImpl
implements FormComponentContributorContext

Implementation of FormComponentContributorContext.

Since:
4.0
Author:
Howard Lewis Ship

Constructor Summary
FormComponentContributorContextImpl(Locale locale, IRequestCycle cycle, IFormComponent field)
           
 
Method Summary
 void addInitializationScript(IComponent target, String script)
          Adds initialization javascript code that will be executed on page/content/etc load.
 void addSubmitHandler(String submitListener)
          Adds initialization to register a submit handler on the client side.
 JSONObject getProfile()
          The javascript object profile being built by this context to validate/translate form values.
 void includeClasspathScript(String path)
          Includes the indicated script; the path is a path on the classpath.
 void registerForFocus(int priority)
          Registers a field for automatic focus.
 
Methods inherited from class org.apache.tapestry.form.ValidationMessagesImpl
formatValidationMessage, getLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.form.ValidationMessages
formatValidationMessage, getLocale
 

Constructor Detail

FormComponentContributorContextImpl

public FormComponentContributorContextImpl(Locale locale,
                                           IRequestCycle cycle,
                                           IFormComponent field)
Method Detail

includeClasspathScript

public void includeClasspathScript(String path)
Description copied from interface: FormComponentContributorContext
Includes the indicated script; the path is a path on the classpath.

Specified by:
includeClasspathScript in interface FormComponentContributorContext

addSubmitHandler

public void addSubmitHandler(String submitListener)
Description copied from interface: FormComponentContributorContext
Adds initialization to register a submit handler on the client side. A submit handler is a JavaScript method that accepts a single parameter, a (JavaScript) FormSubmitEvent.

Specified by:
addSubmitHandler in interface FormComponentContributorContext
Parameters:
submitListener - either the name of a submit listener ("myListener"), or an inline implementation of a listener function ("function(event) { ... } ").

addInitializationScript

public void addInitializationScript(IComponent target,
                                    String script)
Description copied from interface: FormComponentContributorContext
Adds initialization javascript code that will be executed on page/content/etc load.

Specified by:
addInitializationScript in interface FormComponentContributorContext
Parameters:
target - The component the script is being added for.
script - The javascript code to execute.

registerForFocus

public void registerForFocus(int priority)
Description copied from interface: FormComponentContributorContext
Registers a field for automatic focus. The goal is for the first field that is in error to get focus; failing that, the first required field; failing that, any field.

Specified by:
registerForFocus in interface FormComponentContributorContext
Parameters:
priority - a priority level used to determine whether the registered field becomes the focus field. Constants for this purpose are defined in ValidationConstants.
See Also:
FormBehavior.registerForFocus(IFormComponent, int)

getProfile

public JSONObject getProfile()
Description copied from interface: FormComponentContributorContext
The javascript object profile being built by this context to validate/translate form values. This is really just a delegate to FormBehavior.

Specified by:
getProfile in interface FormComponentContributorContext
Returns:
JSONObject profile.


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