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(java.util.Locale locale, IRequestCycle cycle, IFormComponent field)
           
 
Method Summary
 void addSubmitListener(java.lang.String submitListener)
          Adds initialization to register a submitListener on the client side.
 java.lang.String getFieldDOM()
          Returns a client-side DOM reference for the field for which contributions are being rendered.
 void includeClasspathScript(java.lang.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
 
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
 

Constructor Detail

FormComponentContributorContextImpl

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

getFieldDOM

public java.lang.String getFieldDOM()
Description copied from interface: FormComponentContributorContext
Returns a client-side DOM reference for the field for which contributions are being rendered. Typically a value such as "document.myform.myfield".

Specified by:
getFieldDOM in interface FormComponentContributorContext

includeClasspathScript

public void includeClasspathScript(java.lang.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

addSubmitListener

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

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

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)