|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
FormEventType.java | - | 100% | 100% | 100% |
|
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 a future release of Tapestry. | |
24 | */ | |
25 | ||
26 | public class FormEventType | |
27 | { | |
28 | /** | |
29 | * Form event triggered when the form is submitted. Allows an event handler to perform any final | |
30 | * changes before the results are posted to the server. | |
31 | * <p> | |
32 | * The JavaScript method should return <code>true</code> or <code>false</code>. If there | |
33 | * are multiple event handlers for the form they will be combined using the binary and operator (<code>&&</code>). | |
34 | */ | |
35 | ||
36 | public static final FormEventType SUBMIT = new FormEventType("SUBMIT", "addSubmitListener"); | |
37 | ||
38 | /** | |
39 | * Form event triggered when the form is reset; this allows an event handler to deal with any | |
40 | * special cases related to resetting. | |
41 | */ | |
42 | ||
43 | public static final FormEventType RESET = new FormEventType("RESET", "addResetListener"); | |
44 | ||
45 | private final String _name; | |
46 | ||
47 | private final String _addListenerMethodName; | |
48 | ||
49 | 2 | private FormEventType(String name, String addListenerMethodName) |
50 | { | |
51 | 2 | _name = name; |
52 | 2 | _addListenerMethodName = addListenerMethodName; |
53 | } | |
54 | ||
55 | 10 | public String toString() |
56 | { | |
57 | 10 | return "FormEventType[" + _name + "]"; |
58 | } | |
59 | ||
60 | /** | |
61 | * Returns the DOM property corresponding to event type (used when generating client-side | |
62 | * scripting). | |
63 | */ | |
64 | ||
65 | 3 | public String getAddListenerMethodName() |
66 | { | |
67 | 3 | return _addListenerMethodName; |
68 | } | |
69 | } |
|