javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnEvent.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 24 Feb 2015 11:12:53 +0100
changeset 1787 ea12a3bb4b33
parent 530 3ce069ec3312
permissions -rw-r--r--
Using year range 2012-2015 in copyright header
     1 /**
     2  * Back 2 Browser Bytecode Translator
     3  * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4  *
     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.
     8  *
     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.
    13  *
    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.
    17  */
    18 package org.apidesign.bck2brwsr.htmlpage.api;
    19 
    20 /** Type of events to use in connection with {@link On} annotation.
    21  *
    22  * @author Jaroslav Tulach <jtulach@netbeans.org>
    23  */
    24 public enum OnEvent {
    25     ABORT("onabort"),
    26     BLUR("onblur"),
    27     CAN_PLAY("oncanplay"),
    28     CAN_PLAY_THROUGH("oncanplaythrough"),
    29     CHANGE("onchange"),
    30     CLICK("onclick"),
    31     CONTEXT_MENU("oncontextmenu"),
    32     DBL_CLICK("ondblclick"),
    33     DRAG("ondrag"),
    34     DRAG_END("ondragend"),
    35     DRAG_ENTER("ondragenter"),
    36     DRAG_LEAVE("ondragleave"),
    37     DRAG_OVER("ondragover"),
    38     DRAG_START("ondragstart"),
    39     DROP("ondrop"),
    40     DURATION_CHANGE("ondurationchange"),
    41     EMPTIED("onemptied"),
    42     ENDED("onended"),
    43     ERROR("onerror"),
    44     FOCUS("onfocus"),
    45     FORM_CHANGE("onformchange"),
    46     FORM_INPUT("onforminput"),
    47     INPUT("oninput"),
    48     INVALID("oninvalid"),
    49     KEY_DOWN("onkeydown"),
    50     KEY_PRESS("onkeypress"),
    51     KEY_UP("onkeyup"),
    52     LOAD("onload"),
    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"),
    62     PAUSE("onpause"),
    63     PLAY("onplay"),
    64     PLAYING("onplaying"),
    65     PROGRESS("onprogress"),
    66     RATE_CHANGE("onratechange"),
    67     READY_STATE_CHANGE("onreadystatechange"),
    68     SCROLL("onscroll"),
    69     SEEKED("onseeked"),
    70     SEEKING("onseeking"),
    71     SELECT("onselect"),
    72     SHOW("onshow"),
    73     STALLED("onstalled"),
    74     SUBMIT("onsubmit"),
    75     SUSPEND("onsuspend"),
    76     TIME_UPDATE("ontimeupdate"),
    77     VOLUME_CHANGE("onvolumechange"),
    78     WAITING("onwaiting");
    79     
    80     final String id;
    81     
    82     private OnEvent(String id) {
    83         this.id = id;
    84     }
    85     
    86     /** The name of property this event is referenced by from an {@link Element}.
    87      * For {@link OnEvent#CHANGE}, it is <code>onchange</code>.
    88      */
    89     public String getElementPropertyName() {
    90         return id;
    91     }
    92     
    93     /** What should happen when this even happen on one
    94      * of associated elements. Continue by calling {@link OnController#perform(java.lang.Runnable)}
    95      * method.
    96      * 
    97      * @param elmnts one or more elements
    98      * @return controller with <code>perform</code> method.
    99      */
   100     public OnController of(Element... elmnts) {
   101         return new OnController(this, elmnts);
   102     }
   103 }