/
OnEvent.java
103 lines (98 loc) · 3.12 KB
/
OnEvent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* Back 2 Browser Bytecode Translator
* Copyright (C) 2012-2018 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. Look for COPYING file in the top folder.
* If not, see http://opensource.org/licenses/GPL-2.0.
*/
package org.apidesign.bck2brwsr.htmlpage.api;
/** Type of events to use in connection with {@link On} annotation.
*
* @author Jaroslav Tulach <jtulach@netbeans.org>
*/
public enum OnEvent {
ABORT("onabort"),
BLUR("onblur"),
CAN_PLAY("oncanplay"),
CAN_PLAY_THROUGH("oncanplaythrough"),
CHANGE("onchange"),
CLICK("onclick"),
CONTEXT_MENU("oncontextmenu"),
DBL_CLICK("ondblclick"),
DRAG("ondrag"),
DRAG_END("ondragend"),
DRAG_ENTER("ondragenter"),
DRAG_LEAVE("ondragleave"),
DRAG_OVER("ondragover"),
DRAG_START("ondragstart"),
DROP("ondrop"),
DURATION_CHANGE("ondurationchange"),
EMPTIED("onemptied"),
ENDED("onended"),
ERROR("onerror"),
FOCUS("onfocus"),
FORM_CHANGE("onformchange"),
FORM_INPUT("onforminput"),
INPUT("oninput"),
INVALID("oninvalid"),
KEY_DOWN("onkeydown"),
KEY_PRESS("onkeypress"),
KEY_UP("onkeyup"),
LOAD("onload"),
LOADED_DATA("onloadeddata"),
LOADED_META_DATA("onloadedmetadata"),
LOAD_START("onloadstart"),
MOUSE_DOWN("onmousedown"),
MOUSE_MOVE("onmousemove"),
MOUSE_OUT("onmouseout"),
MOUSE_OVER("onmouseover"),
MOUSE_UP("onmouseup"),
MOUSE_WHEEL("onmousewheel"),
PAUSE("onpause"),
PLAY("onplay"),
PLAYING("onplaying"),
PROGRESS("onprogress"),
RATE_CHANGE("onratechange"),
READY_STATE_CHANGE("onreadystatechange"),
SCROLL("onscroll"),
SEEKED("onseeked"),
SEEKING("onseeking"),
SELECT("onselect"),
SHOW("onshow"),
STALLED("onstalled"),
SUBMIT("onsubmit"),
SUSPEND("onsuspend"),
TIME_UPDATE("ontimeupdate"),
VOLUME_CHANGE("onvolumechange"),
WAITING("onwaiting");
final String id;
private OnEvent(String id) {
this.id = id;
}
/** The name of property this event is referenced by from an {@link Element}.
* For {@link OnEvent#CHANGE}, it is <code>onchange</code>.
*/
public String getElementPropertyName() {
return id;
}
/** What should happen when this even happen on one
* of associated elements. Continue by calling {@link OnController#perform(java.lang.Runnable)}
* method.
*
* @param elmnts one or more elements
* @return controller with <code>perform</code> method.
*/
public OnController of(Element... elmnts) {
return new OnController(this, elmnts);
}
}