2 * Back 2 Browser Bytecode Translator
3 * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. Look for COPYING file in the top folder.
16 * If not, see http://opensource.org/licenses/GPL-2.0.
18 package org.apidesign.bck2brwsr.htmlpage.api;
20 /** Type of events to use in connection with {@link On} annotation.
22 * @author Jaroslav Tulach <jtulach@netbeans.org>
27 CAN_PLAY("oncanplay"),
28 CAN_PLAY_THROUGH("oncanplaythrough"),
31 CONTEXT_MENU("oncontextmenu"),
32 DBL_CLICK("ondblclick"),
34 DRAG_END("ondragend"),
35 DRAG_ENTER("ondragenter"),
36 DRAG_LEAVE("ondragleave"),
37 DRAG_OVER("ondragover"),
38 DRAG_START("ondragstart"),
40 DURATION_CHANGE("ondurationchange"),
45 FORM_CHANGE("onformchange"),
46 FORM_INPUT("onforminput"),
49 KEY_DOWN("onkeydown"),
50 KEY_PRESS("onkeypress"),
53 LOADED_DATA("onloadeddata"),
54 LOADED_META_DATA("onloadedmetadata"),
55 LOAD_START("onloadstart"),
56 MOUSE_DOWN("onmousedown"),
57 MOUSE_MOVE("onmousemove"),
58 MOUSE_OUT("onmouseout"),
59 MOUSE_OVER("onmouseover"),
60 MOUSE_UP("onmouseup"),
61 MOUSE_WHEEL("onmousewheel"),
65 PROGRESS("onprogress"),
66 RATE_CHANGE("onratechange"),
67 READY_STATE_CHANGE("onreadystatechange"),
76 TIME_UPDATE("ontimeupdate"),
77 VOLUME_CHANGE("onvolumechange"),
82 private OnEvent(String id) {
86 /** The name of property this event is referenced by from an {@link Element}.
87 * For {@link OnEvent#CHANGE}, it is <code>onchange</code>.
89 public String getElementPropertyName() {
93 /** What should happen when this even happen on one
94 * of associated elements. Continue by calling {@link OnController#perform(java.lang.Runnable)}
97 * @param elmnts one or more elements
98 * @return controller with <code>perform</code> method.
100 public OnController of(Element... elmnts) {
101 return new OnController(this, elmnts);