Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IForm |
|
| 1.0;1 |
1 | // Copyright 2004, 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; | |
16 | ||
17 | import org.apache.tapestry.valid.IValidationDelegate; | |
18 | ||
19 | /** | |
20 | * A generic way to access a component which defines an HTML form (or, perhaps, other similar | |
21 | * constructs, such as a WML {@link org.apache.tapestry.wml.Go}). This interface exists so that the | |
22 | * {@link IRequestCycle}can invoke the {@link #rewind(IMarkupWriter, IRequestCycle)}method (which | |
23 | * is used to deal with a Form that uses the direct service). In release 1.0.5, more responsibility | |
24 | * for forms was moved here. | |
25 | * | |
26 | * @author Howard Lewis Ship | |
27 | * @since 1.0.2 | |
28 | */ | |
29 | ||
30 | public interface IForm extends IComponent, FormBehavior, IDirect | |
31 | { | |
32 | /** | |
33 | * Invoked by the {@link IRequestCycle}to allow a form that uses the direct service, to respond | |
34 | * to the form submission. | |
35 | */ | |
36 | ||
37 | void rewind(IMarkupWriter writer, IRequestCycle cycle); | |
38 | ||
39 | /** | |
40 | * Returns the name of the form. The name is determined as the form component begins to render, | |
41 | * but is not reset (as a convienience for building client-side JavaScript event handlers). The | |
42 | * Form (and Go) components render this name as both the name and the id attribute (so it can be | |
43 | * used like | |
44 | * {@link org.apache.tapestry.form.IFormComponent#getClientId() a field's clientId property}. | |
45 | * | |
46 | * @since 1.0.5 | |
47 | */ | |
48 | ||
49 | String getName(); | |
50 | ||
51 | /** | |
52 | * Returns the validation delegate for the form. Returns null if the form does not have a | |
53 | * delegate. | |
54 | * | |
55 | * @since 1.0.8 | |
56 | */ | |
57 | ||
58 | IValidationDelegate getDelegate(); | |
59 | ||
60 | /** | |
61 | * Indicates whether or not client-side validation will be generated during render. | |
62 | * | |
63 | * @return true, if client-side validation is enabled, false otherwise | |
64 | * @since 4.0 | |
65 | */ | |
66 | boolean isClientValidationEnabled(); | |
67 | ||
68 | /** | |
69 | * Returns true if the form should support automatic field focus (that is, adding JavaScript to | |
70 | * position the cursor into the first field of the form, automatically). This requires that the | |
71 | * Form component be enclosed by a {@link org.apache.tapestry.html.Body} component. When a | |
72 | * single page contains multiple Forms, only the first Form that renders will get field focus; | |
73 | * by setting the Form's focus parameter to false, it is possible to control which Form gets | |
74 | * focus. | |
75 | * | |
76 | * @since 4.0 | |
77 | */ | |
78 | ||
79 | boolean getFocus(); | |
80 | } |