|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LinkEventType.java | - | 75% | 66.7% | 71.4% |
|
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 | private final String _name; | |
27 | ||
28 | private final String _attributeName; | |
29 | ||
30 | /** | |
31 | * Type for <code>onMouseOver</code>. This may also be called "focus". | |
32 | */ | |
33 | ||
34 | public static final LinkEventType MOUSE_OVER = new LinkEventType("MOUSE_OVER", "onMouseOver"); | |
35 | ||
36 | /** | |
37 | * Type for <code>onMouseOut</code>. This may also be called "blur". | |
38 | */ | |
39 | ||
40 | public static final LinkEventType MOUSE_OUT = new LinkEventType("MOUSE_OUT", "onMouseOut"); | |
41 | ||
42 | /** | |
43 | * Type for <code>onClick</code>. | |
44 | * | |
45 | * @since 1.0.1 | |
46 | */ | |
47 | ||
48 | public static final LinkEventType CLICK = new LinkEventType("CLICK", "onClick"); | |
49 | ||
50 | /** | |
51 | * Type for <code>onDblClick</code>. | |
52 | * | |
53 | * @since 1.0.1 | |
54 | */ | |
55 | ||
56 | public static final LinkEventType DOUBLE_CLICK = new LinkEventType("DOUBLE_CLICK", "onDblClick"); | |
57 | ||
58 | /** | |
59 | * Type for <code>onMouseDown</code>. | |
60 | * | |
61 | * @since 1.0.1. | |
62 | */ | |
63 | ||
64 | public static final LinkEventType MOUSE_DOWN = new LinkEventType("MOUSE_DOWN", "onMouseDown"); | |
65 | ||
66 | /** | |
67 | * Type for <code>onMouseUp</code>. | |
68 | * | |
69 | * @since 1.0.1 | |
70 | */ | |
71 | ||
72 | public static final LinkEventType MOUSE_UP = new LinkEventType("MOUSE_UP", "onMouseUp"); | |
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 | 6 | protected LinkEventType(String name, String attributeName) |
84 | { | |
85 | ||
86 | 6 | _name = name; |
87 | 6 | _attributeName = attributeName; |
88 | } | |
89 | ||
90 | /** | |
91 | * Returns the name of the HTML attribute corresponding to this type. | |
92 | */ | |
93 | ||
94 | 1 | public String getAttributeName() |
95 | { | |
96 | 1 | return _attributeName; |
97 | } | |
98 | ||
99 | 0 | public String toString() |
100 | { | |
101 | 0 | return "LinkEventType[" + _name + "]"; |
102 | } | |
103 | } |
|