Coverage Report - org.apache.tapestry.form.FormComponentContributorContext
 
Classes in this File Line Coverage Branch Coverage Complexity
FormComponentContributorContext
N/A
N/A
1
 
 1  
 // Copyright 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.form;
 16  
 
 17  
 import org.apache.tapestry.FormBehavior;
 18  
 import org.apache.tapestry.IComponent;
 19  
 import org.apache.tapestry.json.JSONObject;
 20  
 import org.apache.tapestry.util.RegexpMatcher;
 21  
 import org.apache.tapestry.valid.ValidationConstants;
 22  
 
 23  
 /**
 24  
  * Object that provides support to objects that implement
 25  
  * {@link org.apache.tapestry.form.FormComponentContributor}. For the moment, at least, this is all
 26  
  * about client-side JavaScript generation.
 27  
  * <p>
 28  
  * TODO: Having support for regular expressions might be useful (and would allow a single
 29  
  * {@link RegexpMatcher to be shared}).
 30  
  * 
 31  
  * @author Howard Lewis Ship
 32  
  * @since 4.0
 33  
  */
 34  
 public interface FormComponentContributorContext extends ValidationMessages
 35  
 {
 36  
     /**
 37  
      * Includes the indicated script; the path is a path on the classpath.
 38  
      */
 39  
 
 40  
     void includeClasspathScript(String path);
 41  
 
 42  
     /**
 43  
      * Adds initialization to register a submit handler on the client side. A submit handler is a
 44  
      * JavaScript method that accepts a single parameter, a (JavaScript) FormSubmitEvent.
 45  
      * 
 46  
      * @param handler
 47  
      *            either the name of a submit listener ("myListener"), or an inline implementation
 48  
      *            of a listener function ("function(event) { ... } ").
 49  
      * @deprecated To be removed in 4.2 with no replacement. The new preferred way to do this is by using simple
 50  
      * <code>dojo.event.connect("formName", "event", object, "functionName)</code> style connections.
 51  
      */
 52  
 
 53  
     void addSubmitHandler(String handler);
 54  
     
 55  
     /**
 56  
      * Adds initialization javascript code that will be executed on page/content/etc load.
 57  
      * @param target 
 58  
      *          The component the script is being added for.
 59  
      * @param script
 60  
      *          The javascript code to execute.
 61  
      */
 62  
     void addInitializationScript(IComponent target, String script);
 63  
     
 64  
     /**
 65  
      * Registers a field for automatic focus. The goal is for the first field that is in error to
 66  
      * get focus; failing that, the first required field; failing that, any field.
 67  
      * 
 68  
      * @param priority
 69  
      *            a priority level used to determine whether the registered field becomes the focus
 70  
      *            field. Constants for this purpose are defined in {@link ValidationConstants}.
 71  
      * @see org.apache.tapestry.FormBehavior#registerForFocus(IFormComponent, int)
 72  
      */
 73  
 
 74  
      void registerForFocus(int priority);
 75  
      
 76  
      /**
 77  
       * The javascript object profile being built by this context to validate/translate
 78  
       * form values. This is really just a delegate to {@link FormBehavior}.
 79  
       * @return {@link JSONObject} profile.
 80  
       */
 81  
      JSONObject getProfile();
 82  
 }