Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LinkEventType |
|
| 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.components; | |
16 | ||
17 | /** | |
18 | * Different types of JavaScript events that an {@link ILinkComponent} can provide handlers for. | |
19 | * | |
20 | * @author Howard Lewis Ship | |
21 | * @since 0.2.9 | |
22 | */ | |
23 | ||
24 | public class LinkEventType | |
25 | { | |
26 | /** | |
27 | * Type for <code>onMouseOver</code>. This may also be called "focus". | |
28 | */ | |
29 | ||
30 | 0 | public static final LinkEventType MOUSE_OVER = new LinkEventType("MOUSE_OVER", "onMouseOver"); |
31 | ||
32 | /** | |
33 | * Type for <code>onMouseOut</code>. This may also be called "blur". | |
34 | */ | |
35 | ||
36 | 0 | public static final LinkEventType MOUSE_OUT = new LinkEventType("MOUSE_OUT", "onMouseOut"); |
37 | ||
38 | /** | |
39 | * Type for <code>onClick</code>. | |
40 | * | |
41 | * @since 1.0.1 | |
42 | */ | |
43 | ||
44 | 0 | public static final LinkEventType CLICK = new LinkEventType("CLICK", "onClick"); |
45 | ||
46 | /** | |
47 | * Type for <code>onDblClick</code>. | |
48 | * | |
49 | * @since 1.0.1 | |
50 | */ | |
51 | ||
52 | 0 | public static final LinkEventType DOUBLE_CLICK = new LinkEventType("DOUBLE_CLICK", "onDblClick"); |
53 | ||
54 | /** | |
55 | * Type for <code>onMouseDown</code>. | |
56 | * | |
57 | * @since 1.0.1. | |
58 | */ | |
59 | ||
60 | 0 | public static final LinkEventType MOUSE_DOWN = new LinkEventType("MOUSE_DOWN", "onMouseDown"); |
61 | ||
62 | /** | |
63 | * Type for <code>onMouseUp</code>. | |
64 | * | |
65 | * @since 1.0.1 | |
66 | */ | |
67 | ||
68 | 0 | public static final LinkEventType MOUSE_UP = new LinkEventType("MOUSE_UP", "onMouseUp"); |
69 | ||
70 | private final String _name; | |
71 | ||
72 | private final String _attributeName; | |
73 | ||
74 | /** | |
75 | * Constructs a new type of event. The name should match the static final variable (i.e., | |
76 | * MOUSE_OVER) and the attributeName is the name of the HTML attribute to be managed (i.e., | |
77 | * "onMouseOver"). | |
78 | * <p> | |
79 | * This method is protected so that subclasses can be created to provide additional managed | |
80 | * event types. | |
81 | */ | |
82 | ||
83 | protected LinkEventType(String name, String attributeName) | |
84 | 0 | { |
85 | ||
86 | 0 | _name = name; |
87 | 0 | _attributeName = attributeName; |
88 | 0 | } |
89 | ||
90 | /** | |
91 | * Returns the name of the HTML attribute corresponding to this type. | |
92 | */ | |
93 | ||
94 | public String getAttributeName() | |
95 | { | |
96 | 0 | return _attributeName; |
97 | } | |
98 | ||
99 | public String toString() | |
100 | { | |
101 | 0 | return "LinkEventType[" + _name + "]"; |
102 | } | |
103 | } |