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 /** 18 * Object that provides support to objects that implement 19 * {@link org.apache.tapestry.form.FormComponentContributor}. For the moment, at least, this is all 20 * about client-side JavaScript generation. 21 * <p> 22 * TODO: Having support for regular expressions might be useful (and would allow a single 23 * {@link RegexpMatcher to be shared). 24 * 25 * @author Howard Lewis Ship 26 * @since 4.0 27 */ 28 public interface FormComponentContributorContext extends ValidationMessages 29 { 30 /** 31 * Returns a client-side DOM reference for the field for which contributions are being rendered. 32 * Typically a value such as "document.myform.myfield". 33 */ 34 35 public String getFieldDOM(); 36 37 /** 38 * Includes the indicated script; the path is a path on the classpath. 39 */ 40 41 public void includeClasspathScript(String path); 42 43 /** 44 * Adds initialization to register a submitListener on the client side. A submitListener is a 45 * JavaScript method that accepts a single parameter, a (JavaScript) FormSubmitEvent. 46 * 47 * @param submitListener 48 * either the name of a submit listener ("myListener"), or an inline implementation 49 * of a listener function ("function(event) { ... } "). 50 */ 51 52 public void addSubmitListener(String submitListener); 53 } 54