Package com.google.gwt.dom.client
Class NativeEvent
- java.lang.Object
-
- com.google.gwt.core.client.JavaScriptObject
-
- com.google.gwt.dom.client.NativeEvent
-
- Direct Known Subclasses:
Event
public class NativeEvent extends JavaScriptObject
The native dom event.
-
-
Field Summary
Fields Modifier and Type Field Description static intBUTTON_LEFTThe left mouse button.static intBUTTON_MIDDLEThe middle mouse button.static intBUTTON_RIGHTThe right mouse button.
-
Constructor Summary
Constructors Modifier Constructor Description protectedNativeEvent()Required constructor for GWT compiler to function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetAltKey()Gets whether the ALT key was depressed when the given event occurred.intgetButton()Gets the mouse buttons that were depressed when the given event occurred.JsArray<Touch>getChangedTouches()Get an array of touches which have changed since the last touch event.intgetCharCode()Gets the Unicode codepoint of the character generated by this key event.intgetClientX()Gets the mouse x-position within the browser window's client area.intgetClientY()Gets the mouse y-position within the browser window's client area.booleangetCtrlKey()Gets whether the CTRL key was depressed when the given event occurred.EventTargetgetCurrentEventTarget()Gets the current target element of this event.DataTransfergetDataTransfer()Get theDataTransferassociated with the current drag event.EventTargetgetEventTarget()Returns the element that was the actual target of the given event.intgetKeyCode()Gets the key code (code associated with the physical key) associated with this event.booleangetMetaKey()Gets whether the META key was depressed when the given event occurred.intgetMouseWheelVelocityY()Gets the velocity of the mouse wheel associated with the event along the Y axis.EventTargetgetRelatedEventTarget()Gets the related target for this event.doublegetRotation()Get the rotation in degrees, with positive values indicating clockwise rotation.doublegetScale()Get the amount scaled since the gesture started, with 1.0 representing no scaling.intgetScreenX()Gets the mouse x-position on the user's display.intgetScreenY()Gets the mouse y-position on the user's display.booleangetShiftKey()Gets whether the shift key was depressed when the given event occurred.java.lang.StringgetString()Gets a string representation of this event.JsArray<Touch>getTargetTouches()Get an array of touches which have changed since the last touch event.JsArray<Touch>getTouches()Get an array of touches which have changed since the last touch event.java.lang.StringgetType()Gets the enumerated type of this event.voidpreventDefault()Prevents the browser from taking its default action for the given event.voidstopPropagation()Stops the event from being propagated to parent elements.-
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
-
-
-
-
Field Detail
-
BUTTON_LEFT
public static final int BUTTON_LEFT
The left mouse button.- See Also:
- Constant Field Values
-
BUTTON_MIDDLE
public static final int BUTTON_MIDDLE
The middle mouse button.- See Also:
- Constant Field Values
-
BUTTON_RIGHT
public static final int BUTTON_RIGHT
The right mouse button.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAltKey
public final boolean getAltKey()
Gets whether the ALT key was depressed when the given event occurred.- Returns:
trueif ALT was depressed when the event occurred
-
getButton
public final int getButton()
Gets the mouse buttons that were depressed when the given event occurred.- Returns:
- a bit-field, defined by
BUTTON_LEFT,BUTTON_MIDDLE, andBUTTON_RIGHT
-
getChangedTouches
public final JsArray<Touch> getChangedTouches()
Get an array of touches which have changed since the last touch event.- Returns:
- array of touches which have changed since the last touch event
-
getCharCode
public final int getCharCode()
Gets the Unicode codepoint of the character generated by this key event.- Returns:
- the Unicode codepoint.
-
getClientX
public final int getClientX()
Gets the mouse x-position within the browser window's client area.- Returns:
- the mouse x-position
-
getClientY
public final int getClientY()
Gets the mouse y-position within the browser window's client area.- Returns:
- the mouse y-position
-
getCtrlKey
public final boolean getCtrlKey()
Gets whether the CTRL key was depressed when the given event occurred.- Returns:
trueif CTRL was depressed when the event occurred
-
getCurrentEventTarget
public final EventTarget getCurrentEventTarget()
Gets the current target element of this event. This is the element whose listener fired last, not the element which fired the event initially.- Returns:
- the event's current target element
-
getDataTransfer
public final DataTransfer getDataTransfer()
Get theDataTransferassociated with the current drag event.- Returns:
- the
DataTransferobject, or null if not a drag event
-
getEventTarget
public final EventTarget getEventTarget()
Returns the element that was the actual target of the given event.- Returns:
- the target element
-
getKeyCode
public final int getKeyCode()
Gets the key code (code associated with the physical key) associated with this event.- Returns:
- the key code
- See Also:
KeyCodes
-
getMetaKey
public final boolean getMetaKey()
Gets whether the META key was depressed when the given event occurred.- Returns:
trueif META was depressed when the event occurred
-
getMouseWheelVelocityY
public final int getMouseWheelVelocityY()
Gets the velocity of the mouse wheel associated with the event along the Y axis.The velocity of the event is an artificial 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.
- Returns:
- The velocity of the mouse wheel.
-
getRelatedEventTarget
public final EventTarget getRelatedEventTarget()
Gets the related target for this event.- Returns:
- the related target
-
getRotation
public final double getRotation()
Get the rotation in degrees, with positive values indicating clockwise rotation.- Returns:
- the rotation in degrees since the gesture started
-
getScale
public final double getScale()
Get the amount scaled since the gesture started, with 1.0 representing no scaling.- Returns:
- the amount scaled since the gesture started
-
getScreenX
public final int getScreenX()
Gets the mouse x-position on the user's display.- Returns:
- the mouse x-position
-
getScreenY
public final int getScreenY()
Gets the mouse y-position on the user's display.- Returns:
- the mouse y-position
-
getShiftKey
public final boolean getShiftKey()
Gets whether the shift key was depressed when the given event occurred.- Returns:
trueif shift was depressed when the event occurred
-
getString
public final java.lang.String getString()
Gets a string representation of this event. We do not overrideJavaScriptObject.toString()because it is final inJavaScriptObject.- Returns:
- the string representation of this event
-
getTargetTouches
public final JsArray<Touch> getTargetTouches()
Get an array of touches which have changed since the last touch event.- Returns:
- array of touches which have changed since the last touch event
-
getTouches
public final JsArray<Touch> getTouches()
Get an array of touches which have changed since the last touch event.- Returns:
- array of touches which have changed since the last touch event
-
getType
public final java.lang.String getType()
Gets the enumerated type of this event.- Returns:
- the event's enumerated type
-
preventDefault
public final void preventDefault()
Prevents the browser from taking its default action for the given event.
-
stopPropagation
public final void stopPropagation()
Stops the event from being propagated to parent elements.
-
-