|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
FormComponentContributorContext.java | - | - | - | - |
|
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.valid.ValidationConstants; | |
18 | ||
19 | /** | |
20 | * Object that provides support to objects that implement | |
21 | * {@link org.apache.tapestry.form.FormComponentContributor}. For the moment, at least, this is all | |
22 | * about client-side JavaScript generation. | |
23 | * <p> | |
24 | * TODO: Having support for regular expressions might be useful (and would allow a single | |
25 | * {@link RegexpMatcher to be shared). | |
26 | * | |
27 | * @author Howard Lewis Ship | |
28 | * @since 4.0 | |
29 | */ | |
30 | public interface FormComponentContributorContext extends ValidationMessages | |
31 | { | |
32 | /** | |
33 | * Returns a client-side DOM reference for the field for which contributions are being rendered. | |
34 | * Typically a value such as "document.myform.myfield". | |
35 | */ | |
36 | ||
37 | public String getFieldDOM(); | |
38 | ||
39 | /** | |
40 | * Includes the indicated script; the path is a path on the classpath. | |
41 | */ | |
42 | ||
43 | public void includeClasspathScript(String path); | |
44 | ||
45 | /** | |
46 | * Adds initialization to register a submitListener on the client side. A submitListener is a | |
47 | * JavaScript method that accepts a single parameter, a (JavaScript) FormSubmitEvent. | |
48 | * | |
49 | * @param submitListener | |
50 | * either the name of a submit listener ("myListener"), or an inline implementation | |
51 | * of a listener function ("function(event) { ... } "). | |
52 | */ | |
53 | ||
54 | public void addSubmitListener(String submitListener); | |
55 | ||
56 | /** | |
57 | * Registers a field for automatic focus. The goal is for the first field that is in error to | |
58 | * get focus; failing that, the first required field; failing that, any field. | |
59 | * | |
60 | * @param priority | |
61 | * a priority level used to determine whether the registered field becomes the focus | |
62 | * field. Constants for this purpose are defined in {@link ValidationConstants}. | |
63 | * @see org.apache.tapestry.FormBehavior#registerForFocus(IFormComponent, int) | |
64 | */ | |
65 | ||
66 | public void registerForFocus(int priority); | |
67 | } |
|