Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
FormEventType |
|
| 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.form; |
|
16 | ||
17 | /** |
|
18 | * Lists different types of JavaScript events that can be associated with a {@link Form} via |
|
19 | * {@link Form#addEventHandler(FormEventType, String)}. |
|
20 | * |
|
21 | * @author Howard Lewis Ship |
|
22 | * @since 1.0.2 |
|
23 | * @deprecated Managing of form events is now done on the client side; this class may be removed in |
|
24 | * a future release of Tapestry. |
|
25 | */ |
|
26 | ||
27 | public final class FormEventType |
|
28 | { |
|
29 | /** |
|
30 | * Form event triggered when the form is submitted. Allows an event handler to perform any final |
|
31 | * changes before the results are posted to the server. |
|
32 | * <p> |
|
33 | * The JavaScript method should return <code>true</code> or <code>false</code>. If there |
|
34 | * are multiple event handlers for the form they will be combined using the binary and operator (<code>&&</code>). |
|
35 | */ |
|
36 | ||
37 | 1 | public static final FormEventType SUBMIT = new FormEventType("SUBMIT", "onsubmit"); |
38 | ||
39 | /** |
|
40 | * Form event triggered when the form is reset; this allows an event handler to deal with any |
|
41 | * special cases related to resetting. |
|
42 | */ |
|
43 | ||
44 | 1 | public static final FormEventType RESET = new FormEventType("RESET", "onreset"); |
45 | ||
46 | private final String _name; |
|
47 | ||
48 | private final String _addHandlerFunctionName; |
|
49 | ||
50 | private FormEventType(String name, String addHandlerFunctionName) |
|
51 | 2 | { |
52 | 2 | _name = name; |
53 | 2 | _addHandlerFunctionName = addHandlerFunctionName; |
54 | 2 | } |
55 | ||
56 | public String toString() |
|
57 | { |
|
58 | 0 | return "FormEventType[" + _name + "]"; |
59 | } |
|
60 | ||
61 | /** |
|
62 | * Returns the name of the function, on the Tapestry object (see Form.js), which should be |
|
63 | * invoked. The first parameter will be the id of the form, the second will be the handler |
|
64 | * itself. |
|
65 | */ |
|
66 | ||
67 | public String getAddHandlerFunctionName() |
|
68 | { |
|
69 | 6 | return _addHandlerFunctionName; |
70 | } |
|
71 | } |