KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > form > FormEventType


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>&amp;&amp;</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 JavaDoc _name;
46
47     private final String JavaDoc _addListenerMethodName;
48
49     private FormEventType(String JavaDoc name, String JavaDoc addListenerMethodName)
50     {
51         _name = name;
52         _addListenerMethodName = addListenerMethodName;
53     }
54
55     public String JavaDoc toString()
56     {
57         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     public String JavaDoc getAddListenerMethodName()
66     {
67         return _addListenerMethodName;
68     }
69 }
Popular Tags