Class BaseNativeEvent

  • All Implemented Interfaces:
    IsJSType, IsCastable
    Direct Known Subclasses:
    BaseNativeMouseEvent

    @JsType(isNative=true,
            name="Object",
            namespace="<global>")
    public class BaseNativeEvent
    extends Object
    implements IsCastable
    Represents 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
      int getButton()
      Returns the button number that was pressed (if applicable) when the mouse event was fired.
      int getButtons()
      Returns the buttons being depressed (if any) when the mouse event was fired.
      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.
      double getClientX()
      Returns the X coordinate of the mouse pointer in local (DOM content) coordinates.
      double getClientY()
      Returns the Y coordinate of the mouse pointer in local (DOM content) coordinates.
      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.
      double getLayerX()
      Returns the horizontal coordinate of the event relative to the current layer.
      double getLayerY()
      Returns the vertical coordinate of the event relative to the current layer.
      double getOffsetX()
      Returns the X coordinate of the mouse pointer relative to the position of the padding edge of the target node.
      double getOffsetY()
      Returns the Y coordinate of the mouse pointer relative to the position of the padding edge of the target node.
      double getPageX()
      Returns the X coordinate of the mouse pointer relative to the whole document.
      double getPageY()
      Returns the Y coordinate of the mouse pointer relative to the whole document.
      BaseHtmlElement getRelatedTarget()
      Returns the secondary target for the event, if there is one.
      double getScreenX()
      Returns the X coordinate of the mouse pointer in global (screen) coordinates.
      double getScreenY()
      Returns the Y coordinate of the mouse pointer in global (screen) coordinates.
      BaseEventTarget getTarget()
      Returns a reference to the target to which the event was originally dispatched.
      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.
      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.
      String getType()
      Returns the type of the event.
      double getX()
      Returns the horizontal coordinate of the event relative to the current layer.
      double getY()
      Returns the vertical coordinate of the event relative to the current layer.
      void initEvent​(String eventTypeArg, boolean bubbles, boolean cancelable)
      Initialize the value of a created event.
      boolean isAltKey()
      Returns true if the alt key was down when the mouse event was fired.
      boolean isCtrlKey()
      Returns true if the control key was down when the mouse event was fired.
      boolean isDefaultPrevented()
      Indicates whether or not the call to BaseEvent.preventDefault() canceled the event.
      boolean isMetaKey()
      Returns true if the meta key was down when the mouse event was fired.
      boolean isShiftKey()
      Returns true if the shift key was down when the mouse event was fired.
      void preventDefault()
      Cancels the event (if it is cancelable).
      void stopImmediatePropagation()
      Prevents all other listeners from being called.
      void stopPropagation()
      Stops the propagation of events further along in the DOM.
      • 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 to BaseEvent.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 event
        bubbles - deciding whether the event should bubble up through the event chain or not
        cancelable - 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.