Package org.pepstock.charba.client.dom
Class BaseNativeEvent
- java.lang.Object
-
- org.pepstock.charba.client.dom.BaseNativeEvent
-
- All Implemented Interfaces:
IsJSType,IsCastable
- Direct Known Subclasses:
BaseNativeMouseEvent
@JsType(isNative=true, name="Object", namespace="<global>") public class BaseNativeEvent extends Object implements IsCastableRepresents events that occur due to the user interacting with a pointing device (such as a mouse).
It also used for event which is sent when the state of contacts with a touch sensitive surface changes.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetButton()Returns the button number that was pressed (if applicable) when the mouse event was fired.intgetButtons()Returns the buttons being depressed (if any) when the mouse event was fired.TouchListgetChangedTouches()Returns a list of all the touch objects representing individual points of contact whose states changed between the previous touch event and this one.doublegetClientX()Returns the X coordinate of the mouse pointer in local (DOM content) coordinates.doublegetClientY()Returns the Y coordinate of the mouse pointer in local (DOM content) coordinates.BaseEventTargetgetCurrentTarget()Returns a reference to the currently registered target for the event.
This is the object to which the event is currently slated to be sent.doublegetLayerX()Returns the horizontal coordinate of the event relative to the current layer.doublegetLayerY()Returns the vertical coordinate of the event relative to the current layer.doublegetOffsetX()Returns the X coordinate of the mouse pointer relative to the position of the padding edge of the target node.doublegetOffsetY()Returns the Y coordinate of the mouse pointer relative to the position of the padding edge of the target node.doublegetPageX()Returns the X coordinate of the mouse pointer relative to the whole document.doublegetPageY()Returns the Y coordinate of the mouse pointer relative to the whole document.BaseHtmlElementgetRelatedTarget()Returns the secondary target for the event, if there is one.doublegetScreenX()Returns the X coordinate of the mouse pointer in global (screen) coordinates.doublegetScreenY()Returns the Y coordinate of the mouse pointer in global (screen) coordinates.BaseEventTargetgetTarget()Returns a reference to the target to which the event was originally dispatched.TouchListgetTargetTouches()Returns a list of all the touch objects that are both currently in contact with the touch surface and were also started on the same element that is the target of the event.TouchListgetTouches()Returns a list of all the touch objects representing all current points of contact with the surface, regardless of target or changed status.StringgetType()Returns the type of the event.doublegetX()Returns the horizontal coordinate of the event relative to the current layer.doublegetY()Returns the vertical coordinate of the event relative to the current layer.voidinitEvent(String eventTypeArg, boolean bubbles, boolean cancelable)Initialize the value of a created event.booleanisAltKey()Returns true if the alt key was down when the mouse event was fired.booleanisCtrlKey()Returns true if the control key was down when the mouse event was fired.booleanisDefaultPrevented()Indicates whether or not the call toBaseEvent.preventDefault()canceled the event.booleanisMetaKey()Returns true if the meta key was down when the mouse event was fired.booleanisShiftKey()Returns true if the shift key was down when the mouse event was fired.voidpreventDefault()Cancels the event (if it is cancelable).voidstopImmediatePropagation()Prevents all other listeners from being called.voidstopPropagation()Stops the propagation of events further along in the DOM.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.dom.IsCastable
as
-
-
-
-
Method Detail
-
isAltKey
@JsProperty public final boolean isAltKey()
Returns true if the alt key was down when the mouse event was fired.- Returns:
- true if the alt key was down when the mouse event was fired
-
getButton
@JsProperty public final int getButton()
Returns the button number that was pressed (if applicable) when the mouse event was fired.- Returns:
- the button number that was pressed (if applicable) when the mouse event was fired
-
getButtons
@JsProperty public final int getButtons()
Returns the buttons being depressed (if any) when the mouse event was fired.- Returns:
- the buttons being depressed (if any) when the mouse event was fired
-
getClientX
@JsProperty public final double getClientX()
Returns the X coordinate of the mouse pointer in local (DOM content) coordinates.- Returns:
- the X coordinate of the mouse pointer in local (DOM content) coordinates
-
getClientY
@JsProperty public final double getClientY()
Returns the Y coordinate of the mouse pointer in local (DOM content) coordinates.- Returns:
- the Y coordinate of the mouse pointer in local (DOM content) coordinates
-
isCtrlKey
@JsProperty public final boolean isCtrlKey()
Returns true if the control key was down when the mouse event was fired.- Returns:
- true if the control key was down when the mouse event was fired
-
isMetaKey
@JsProperty public final boolean isMetaKey()
Returns true if the meta key was down when the mouse event was fired.- Returns:
- true if the meta key was down when the mouse event was fired
-
getOffsetX
@JsProperty public final double getOffsetX()
Returns the X coordinate of the mouse pointer relative to the position of the padding edge of the target node.- Returns:
- the X coordinate of the mouse pointer relative to the position of the padding edge of the target node
-
getOffsetY
@JsProperty public final double getOffsetY()
Returns the Y coordinate of the mouse pointer relative to the position of the padding edge of the target node.- Returns:
- the Y coordinate of the mouse pointer relative to the position of the padding edge of the target node
-
getPageX
@JsProperty public final double getPageX()
Returns the X coordinate of the mouse pointer relative to the whole document.- Returns:
- the X coordinate of the mouse pointer relative to the whole document
-
getPageY
@JsProperty public final double getPageY()
Returns the Y coordinate of the mouse pointer relative to the whole document.- Returns:
- the Y coordinate of the mouse pointer relative to the whole document
-
getScreenX
@JsProperty public final double getScreenX()
Returns the X coordinate of the mouse pointer in global (screen) coordinates.- Returns:
- the X coordinate of the mouse pointer in global (screen) coordinates
-
getScreenY
@JsProperty public final double getScreenY()
Returns the Y coordinate of the mouse pointer in global (screen) coordinates.- Returns:
- the Y coordinate of the mouse pointer in global (screen) coordinates
-
isShiftKey
@JsProperty public final boolean isShiftKey()
Returns true if the shift key was down when the mouse event was fired.- Returns:
- true if the shift key was down when the mouse event was fired
-
getRelatedTarget
@JsProperty public final BaseHtmlElement getRelatedTarget()
Returns the secondary target for the event, if there is one.- Returns:
- the secondary target for the event, if there is one
-
getChangedTouches
@JsProperty public final TouchList getChangedTouches()
Returns a list of all the touch objects representing individual points of contact whose states changed between the previous touch event and this one.- Returns:
- a list of all the touch objects representing individual points of contact whose states changed between the previous touch event and this one
-
getTargetTouches
@JsProperty public final TouchList getTargetTouches()
Returns a list of all the touch objects that are both currently in contact with the touch surface and were also started on the same element that is the target of the event.- Returns:
- a list of all the touch objects that are both currently in contact with the touch surface and were also started on the same element that is the target of the event
-
getTouches
@JsProperty public final TouchList getTouches()
Returns a list of all the touch objects representing all current points of contact with the surface, regardless of target or changed status.- Returns:
- a list of all the touch objects representing all current points of contact with the surface, regardless of target or changed status
-
getLayerX
@JsProperty public final double getLayerX()
Returns the horizontal coordinate of the event relative to the current layer.- Returns:
- the horizontal coordinate of the event relative to the current layer
-
getLayerY
@JsProperty public final double getLayerY()
Returns the vertical coordinate of the event relative to the current layer.- Returns:
- the vertical coordinate of the event relative to the current layer
-
getX
@JsOverlay public final double getX()
Returns the horizontal coordinate of the event relative to the current layer.- Returns:
- the horizontal coordinate of the event relative to the current layer
-
getY
@JsOverlay public final double getY()
Returns the vertical coordinate of the event relative to the current layer.- Returns:
- the vertical coordinate of the event relative to the current layer
-
getCurrentTarget
@JsProperty public final BaseEventTarget getCurrentTarget()
Returns a reference to the currently registered target for the event.
This is the object to which the event is currently slated to be sent.- Returns:
- a reference to the currently registered target for the event
-
isDefaultPrevented
@JsProperty public final boolean isDefaultPrevented()
Indicates whether or not the call toBaseEvent.preventDefault()canceled the event.- Returns:
- Indicates whether or not the call to
BaseEvent.preventDefault()canceled the event
-
getTarget
@JsProperty public final BaseEventTarget getTarget()
Returns a reference to the target to which the event was originally dispatched.- Returns:
- a reference to the target to which the event was originally dispatched
-
getType
@JsProperty public final String getType()
Returns the type of the event.- Returns:
- the type of the event
-
initEvent
@JsMethod public final void initEvent(String eventTypeArg, boolean bubbles, boolean cancelable)
Initialize the value of a created event.- Parameters:
eventTypeArg- a string which is defining the type of eventbubbles- deciding whether the event should bubble up through the event chain or notcancelable- defining whether the event can be canceled
-
preventDefault
@JsMethod public final void preventDefault()
Cancels the event (if it is cancelable).
-
stopImmediatePropagation
@JsMethod public final void stopImmediatePropagation()
Prevents all other listeners from being called.
-
stopPropagation
@JsMethod public final void stopPropagation()
Stops the propagation of events further along in the DOM.
-
-