|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.core.client.JavaScriptObject
com.google.gwt.user.client.Event
public final class Event
An opaque handle to a native DOM Event. An Event
cannot be
created directly. Instead, use the Event
type when returning a
native DOM event from JSNI methods. An Event
passed back into
JSNI becomes the original DOM event the Event
was created
from, and can be accessed in JavaScript code as expected. This is typically
done by calling methods in the DOM
class.
Field Summary | |
---|---|
static int |
BUTTON_LEFT
The left mouse button (used in DOM.eventGetButton(Event) ). |
static int |
BUTTON_MIDDLE
The middle mouse button (used in DOM.eventGetButton(Event) ). |
static int |
BUTTON_RIGHT
The right mouse button (used in DOM.eventGetButton(Event) ). |
static int |
FOCUSEVENTS
A bit-mask covering both focus events (focus and blur). |
static int |
KEYEVENTS
A bit-mask covering all keyboard events (down, up, and press). |
static int |
MOUSEEVENTS
A bit-mask covering all mouse events (down, up, move, over, and out), but not click, dblclick, or wheel events. |
static int |
ONBLUR
Fired when an element loses keyboard focus. |
static int |
ONCHANGE
Fired when the value of an input element changes. |
static int |
ONCLICK
Fired when the user clicks on an element. |
static int |
ONDBLCLICK
Fired when the user double-clicks on an element. |
static int |
ONERROR
Fired when an image encounters an error. |
static int |
ONFOCUS
Fired when an element receives keyboard focus. |
static int |
ONKEYDOWN
Fired when the user depresses a key. |
static int |
ONKEYPRESS
Fired when the a character is generated from a keypress (either directly or through auto-repeat). |
static int |
ONKEYUP
Fired when the user releases a key. |
static int |
ONLOAD
Fired when an element (normally an IMG) finishes loading. |
static int |
ONLOSECAPTURE
Fired when an element that has mouse capture loses it. |
static int |
ONMOUSEDOWN
Fired when the user depresses a mouse button over an element. |
static int |
ONMOUSEMOVE
Fired when the mouse is moved within an element's area. |
static int |
ONMOUSEOUT
Fired when the mouse is moved out of an element's area. |
static int |
ONMOUSEOVER
Fired when the mouse is moved into an element's area. |
static int |
ONMOUSEUP
Fired when the user releases a mouse button over an element. |
static int |
ONMOUSEWHEEL
Fired when the user scrolls the mouse wheel over an element. |
static int |
ONSCROLL
Fired when a scrollable element's scroll offset changes. |
static int |
UNDEFINED
Error code returned by DOM.getEventXXX methods when the actual integer value is undefined. |
Constructor Summary | |
---|---|
protected |
Event()
Not directly instantiable. |
Method Summary | |
---|---|
void |
cancelBubble(boolean cancel)
Cancels bubbling for the given event. |
boolean |
getAltKey()
Gets whether the ALT key was depressed when the given event occurred. |
int |
getButton()
Gets the mouse buttons that were depressed when the given event occurred. |
int |
getClientX()
Gets the mouse x-position within the browser window's client area. |
int |
getClientY()
Gets the mouse y-position within the browser window's client area. |
boolean |
getCtrlKey()
Gets whether the CTRL key was depressed when the given event occurred. |
static Event |
getCurrentEvent()
Gets the current event that is being fired. |
Element |
getCurrentTarget()
Gets the current target element of this event. |
static int |
getEventsSunk(Element elem)
TODO: doc. |
Element |
getFromElement()
Gets the element from which the mouse pointer was moved (only valid for ONMOUSEOVER ). |
int |
getKeyCode()
Gets the key code associated with this event. |
boolean |
getMetaKey()
Gets whether the META key was depressed when the given event occurred. |
int |
getMouseWheelVelocityY()
Gets the velocity of the mouse wheel associated with the event along the Y axis. |
boolean |
getRepeat()
Gets the key-repeat state of this event. |
int |
getScreenX()
Gets the mouse x-position on the user's display. |
int |
getScreenY()
Gets the mouse y-position on the user's display. |
boolean |
getShiftKey()
Gets whether the shift key was depressed when the given event occurred. |
java.lang.String |
getString()
Gets a string representation of this event. |
Element |
getTarget()
Returns the element that was the actual target of the given event. |
Element |
getToElement()
Gets the element to which the mouse pointer was moved (only valid for ONMOUSEOUT ). |
java.lang.String |
getType()
Gets the enumerated type of this event (as defined in Event ). |
int |
getTypeInt()
Gets the enumerated type of this event, as defined by ONCLICK ,
ONMOUSEDOWN , and so forth. |
void |
preventDefault()
Prevents the browser from taking its default action for the given event. |
static void |
sinkEvents(Element elem,
int eventBits)
TODO: doc. |
Methods inherited from class com.google.gwt.core.client.JavaScriptObject |
---|
cast, createArray, createFunction, createObject, equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int BUTTON_LEFT
DOM.eventGetButton(Event)
).
public static final int BUTTON_MIDDLE
DOM.eventGetButton(Event)
).
public static final int BUTTON_RIGHT
DOM.eventGetButton(Event)
).
public static final int ONBLUR
public static final int ONCHANGE
public static final int ONCLICK
public static final int ONDBLCLICK
public static final int ONERROR
public static final int ONFOCUS
public static final int ONKEYDOWN
public static final int ONKEYPRESS
public static final int ONKEYUP
public static final int ONLOAD
public static final int ONLOSECAPTURE
public static final int ONMOUSEDOWN
public static final int ONMOUSEMOVE
public static final int ONMOUSEOUT
public static final int ONMOUSEOVER
public static final int ONMOUSEUP
public static final int ONMOUSEWHEEL
public static final int ONSCROLL
public static final int FOCUSEVENTS
public static final int KEYEVENTS
public static final int MOUSEEVENTS
public static final int UNDEFINED
Constructor Detail |
---|
protected Event()
Method Detail |
---|
public static Event getCurrentEvent()
public static int getEventsSunk(Element elem)
public static void sinkEvents(Element elem, int eventBits)
public final void cancelBubble(boolean cancel)
cancel
- true
to cancel bubblingpublic final boolean getAltKey()
true
if ALT was depressed when the event occurredpublic final int getButton()
BUTTON_LEFT
,
BUTTON_MIDDLE
, and BUTTON_RIGHT
public final int getClientX()
public final int getClientY()
public final boolean getCtrlKey()
true
if CTRL was depressed when the event occurredpublic final Element getCurrentTarget()
public final Element getFromElement()
ONMOUSEOVER
).
public final int getKeyCode()
For ONKEYPRESS
, this method returns the Unicode value of the
character generated. For ONKEYDOWN
and ONKEYUP
,
it returns the code associated with the physical key.
KeyboardListener
public final boolean getMetaKey()
true
if META was depressed when the event occurredpublic final int getMouseWheelVelocityY()
The velocity of the event is an artifical measurement for relative comparisons of wheel activity. It is affected by some non-browser factors, including choice of input hardware and mouse acceleration settings. The sign of the velocity measurement agrees with the screen coordinate system; negative values are towards the origin and positive values are away from the origin. Standard scrolling speed is approximately ten units per event.
public final boolean getRepeat()
true
if this key event was an auto-repeatpublic final int getScreenX()
public final int getScreenY()
public final boolean getShiftKey()
true
if shift was depressed when the event occurredpublic final java.lang.String getString()
JavaScriptObject.toString()
because it is final in
JavaScriptObject
.
public final Element getTarget()
public final Element getToElement()
ONMOUSEOUT
).
public final java.lang.String getType()
Event
).
public final int getTypeInt()
ONCLICK
,
ONMOUSEDOWN
, and so forth.
public final void preventDefault()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |