java.lang.Object | |||
↳ | com.google.gwt.core.client.JavaScriptObject | ||
↳ | com.google.gwt.dom.client.NativeEvent | ||
↳ | com.google.gwt.user.client.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.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Event.NativePreviewEvent | Represents a preview of a native Event . |
||||||||||
Event.NativePreviewHandler | Handler interface for Event.NativePreviewEvent events. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | FOCUSEVENTS | A bit-mask covering both focus events (focus and blur). | |||||||||
int | GESTUREEVENTS | A bit-mask covering all gesture events (start, change, end). | |||||||||
int | KEYEVENTS | A bit-mask covering all keyboard events (down, up, and press). | |||||||||
int | MOUSEEVENTS | A bit-mask covering all mouse events (down, up, move, over, and out), but not click, dblclick, or wheel events. | |||||||||
int | ONBLUR | Fired when an element loses keyboard focus. | |||||||||
int | ONCHANGE | Fired when the value of an input element changes. | |||||||||
int | ONCLICK | Fired when the user clicks on an element. | |||||||||
int | ONCONTEXTMENU | Fired when the user requests an element's context menu (usually by right-clicking). | |||||||||
int | ONDBLCLICK | Fired when the user double-clicks on an element. | |||||||||
int | ONERROR | Fired when an image encounters an error. | |||||||||
int | ONFOCUS | Fired when an element receives keyboard focus. | |||||||||
int | ONGESTURECHANGE | Fired when the user gesture changes. | |||||||||
int | ONGESTUREEND | Fired when the user gesture ends. | |||||||||
int | ONGESTURESTART | Fired when the user gesture starts. | |||||||||
int | ONKEYDOWN | Fired when the user depresses a key. | |||||||||
int | ONKEYPRESS | Fired when the a character is generated from a keypress (either directly or through auto-repeat). | |||||||||
int | ONKEYUP | Fired when the user releases a key. | |||||||||
int | ONLOAD | Fired when an element (normally an IMG) finishes loading. | |||||||||
int | ONLOSECAPTURE | Fired when an element that has mouse capture loses it. | |||||||||
int | ONMOUSEDOWN | Fired when the user depresses a mouse button over an element. | |||||||||
int | ONMOUSEMOVE | Fired when the mouse is moved within an element's area. | |||||||||
int | ONMOUSEOUT | Fired when the mouse is moved out of an element's area. | |||||||||
int | ONMOUSEOVER | Fired when the mouse is moved into an element's area. | |||||||||
int | ONMOUSEUP | Fired when the user releases a mouse button over an element. | |||||||||
int | ONMOUSEWHEEL | Fired when the user scrolls the mouse wheel over an element. | |||||||||
int | ONPASTE | Fired when the user pastes text into an input element. | |||||||||
int | ONSCROLL | Fired when a scrollable element's scroll offset changes. | |||||||||
int | ONTOUCHCANCEL | Fired when the user cancels touching an element. | |||||||||
int | ONTOUCHEND | Fired when the user ends touching an element. | |||||||||
int | ONTOUCHMOVE | Fired when the user moves while touching an element. | |||||||||
int | ONTOUCHSTART | Fired when the user starts touching an element. | |||||||||
int | TOUCHEVENTS | A bit-mask covering all touch events (start, move, end, cancel). | |||||||||
int | UNDEFINED | Value returned by accessors when the actual integer value is undefined. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.dom.client.NativeEvent
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Not directly instantiable.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
replaced by
addNativePreviewHandler(NativePreviewHandler)
| |||||||||||
Adds a | |||||||||||
Converts the
NativeEvent to Event. | |||||||||||
This method is deprecated.
use
stopPropagation() instead
| |||||||||||
Fire a
Event.NativePreviewEvent for the native event. | |||||||||||
Gets the current event that is being fired.
| |||||||||||
This method is deprecated.
use
getCurrentEventTarget() instead
| |||||||||||
Gets the
EventListener that will receive events for the given
element. | |||||||||||
Gets the current set of events sunk by a given element.
| |||||||||||
This method is deprecated.
use
getRelatedEventTarget() instead | |||||||||||
This method is deprecated.
use
getRelatedEventTarget() instead
| |||||||||||
This method is deprecated.
not supported on all browsers
| |||||||||||
This method is deprecated.
use
getEventTarget() instead
| |||||||||||
This method is deprecated.
use
getRelatedEventTarget() instead | |||||||||||
Gets the enumerated type of this event given a valid event type name.
| |||||||||||
Gets the enumerated type of this event, as defined by
ONCLICK ,
ONMOUSEDOWN , and so forth. | |||||||||||
Releases mouse capture on the given element.
| |||||||||||
This method is deprecated.
use
HandlerRegistration returned from
addNativePreviewHandler(NativePreviewHandler)
| |||||||||||
Sets mouse-capture on the given element.
| |||||||||||
Sets the
EventListener to receive events for the given element. | |||||||||||
Sets the current set of events sunk by a given element.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.dom.client.NativeEvent
| |||||||||||
From class
com.google.gwt.core.client.JavaScriptObject
| |||||||||||
From class
java.lang.Object
|
A bit-mask covering both focus events (focus and blur).
A bit-mask covering all gesture events (start, change, end).
A bit-mask covering all keyboard events (down, up, and press).
A bit-mask covering all mouse events (down, up, move, over, and out), but not click, dblclick, or wheel events.
Fired when an element loses keyboard focus.
Fired when the value of an input element changes.
Fired when the user clicks on an element.
Fired when the user requests an element's context menu (usually by right-clicking). Note that not all browsers will fire this event (notably Opera, as of 9.5).
Fired when the user double-clicks on an element.
Fired when an image encounters an error.
Fired when an element receives keyboard focus.
Fired when the user gesture changes.
Fired when the user gesture ends.
Fired when the user gesture starts.
Fired when the user depresses a key.
Fired when the a character is generated from a keypress (either directly or through auto-repeat).
Fired when the user releases a key.
Fired when an element (normally an IMG) finishes loading.
Fired when an element that has mouse capture loses it.
Fired when the user depresses a mouse button over an element.
Fired when the mouse is moved within an element's area.
Fired when the mouse is moved out of an element's area.
Fired when the mouse is moved into an element's area.
Fired when the user releases a mouse button over an element.
Fired when the user scrolls the mouse wheel over an element.
Fired when the user pastes text into an input element.
Note: This event is not supported on Firefox 2 and earlier, or Opera 10 and earlier. Be aware that it will not fire on these browser versions.
Fired when a scrollable element's scroll offset changes.
Fired when the user cancels touching an element.
Fired when the user ends touching an element.
Fired when the user moves while touching an element.
Fired when the user starts touching an element.
A bit-mask covering all touch events (start, move, end, cancel).
Value returned by accessors when the actual integer value is undefined. In Development Mode, most accessors assert that the requested attribute is reliable across all supported browsers.
Not directly instantiable. Subclasses should also define a protected no-arg constructor to prevent client code from directly instantiating the class.
This method is deprecated.
replaced by
addNativePreviewHandler(NativePreviewHandler)
Adds an event preview to the preview stack. As long as this preview remains on the top of the stack, it will receive all events before they are fired to their listeners. Note that the event preview will receive all events, including those received due to bubbling, whereas normal event handlers only receive explicitly sunk events.
preview | the event preview to be added to the stack. |
---|
Adds a Event.NativePreviewHandler
that will receive all events before
they are fired to their handlers. Note that the handler will receive
all native events, including those received due to bubbling, whereas
normal event handlers only receive explicitly sunk events.
Unlike other event handlers, Event.NativePreviewHandler
are fired in the
reverse order that they are added, such that the last
Event.NativePreviewEvent
that was added is the first to be fired.
Please note that nondeterministic behavior will result if more than one GWT application registers preview handlers. See issue 3892 for details.
handler | the Event.NativePreviewHandler |
---|
HandlerRegistration
used to remove this handler
Converts the NativeEvent
to Event. This is always safe.
event | the event to downcast |
---|
This method is deprecated.
use stopPropagation()
instead
Cancels bubbling for the given event. This will stop the event from being propagated to parent elements.
cancel | true to cancel bubbling |
---|
Fire a Event.NativePreviewEvent
for the native event.
nativeEvent | the native event |
---|
Gets the current event that is being fired. The current event is only available within the lifetime of the onBrowserEvent function. Once the onBrowserEvent method returns, the current event is reset to null.
This method is deprecated.
use getCurrentEventTarget()
instead
Gets the current target element of this event. This is the element whose listener fired last, not the element which fired the event initially.
Gets the EventListener
that will receive events for the given
element. Only one such listener may exist for a single element.
elem | the element whose listener is to be set |
---|
Gets the current set of events sunk by a given element.
elem | the element whose events are to be retrieved |
---|
Event.NativePreviewEvent
)
This method is deprecated.
use getRelatedEventTarget()
instead
Gets the element from which the mouse pointer was moved (only valid for
ONMOUSEOVER
).
This method is deprecated.
use getRelatedEventTarget()
instead
Gets the related target for this event.
This method is deprecated.
not supported on all browsers
Gets the key-repeat state of this event.
true
if this key event was an auto-repeat
This method is deprecated.
use getEventTarget()
instead
Returns the element that was the actual target of the given event.
This method is deprecated.
use getRelatedEventTarget()
instead
Gets the element to which the mouse pointer was moved (only valid for
ONMOUSEOUT
).
Gets the enumerated type of this event given a valid event type name.
typeName | the typeName to be tested |
---|
Gets the enumerated type of this event, as defined by ONCLICK
,
ONMOUSEDOWN
, and so forth.
Releases mouse capture on the given element. Calling this method has no effect if the element does not currently have mouse capture.
elem | the element to release capture |
---|
This method is deprecated.
use HandlerRegistration
returned from
addNativePreviewHandler(NativePreviewHandler)
Removes an element from the preview stack. This element will no longer capture events, though any preview underneath it will begin to do so.
preview | the event preview to be removed from the stack |
---|
Sets mouse-capture on the given element. This element will directly receive
all mouse events until releaseCapture(Element)
is called on it.
elem | the element on which to set mouse capture |
---|
Sets the EventListener
to receive events for the given element.
Only one such listener may exist for a single element.
elem | the element whose listener is to be set |
---|---|
listener | the listener to receive events
|
Sets the current set of events sunk by a given element. These events will
be fired to the nearest EventListener
specified on any of the
element's parents.
elem | the element whose events are to be retrieved |
---|---|
eventBits | a bitfield describing the events sunk on this element (its
possible values are described in Event.NativePreviewEvent )
|