Class DomEvent<H extends EventHandler>

Type Parameters:
H - handler type
All Implemented Interfaces:
HasNativeEvent
Direct Known Subclasses:
BlurEvent, CanPlayThroughEvent, ChangeEvent, ContextMenuEvent, DragDropEventBase, EndedEvent, ErrorEvent, FocusEvent, GestureChangeEvent, GestureEndEvent, GestureStartEvent, HumanInputEvent, KeyEvent, LoadedMetadataEvent, LoadEvent, LoseCaptureEvent, ProgressEvent, ScrollEvent

public abstract class DomEvent<H extends EventHandler> extends GwtEvent<H> implements HasNativeEvent
DomEvent is a subclass of GwtEvent that provides events that underlying native browser event object as well as a subclass of DomEvent.Type that understands GWT event bits used by sinkEvents().
  • Constructor Details

    • DomEvent

      public DomEvent()
  • Method Details

    • fireNativeEvent

      public static void fireNativeEvent(NativeEvent nativeEvent, HasHandlers handlerSource)
      Fires the given native event on the specified handlers.
      Parameters:
      nativeEvent - the native event
      handlerSource - the source of the handlers to fire
    • fireNativeEvent

      public static void fireNativeEvent(NativeEvent nativeEvent, HasHandlers handlerSource, Element relativeElem)
      Fires the given native event on the specified handlers.
      Parameters:
      nativeEvent - the native event
      handlerSource - the source of the handlers to fire
      relativeElem - the element relative to which event coordinates will be measured
    • init

      static void init()
    • getAssociatedType

      public abstract DomEvent.Type<H> getAssociatedType()
      Description copied from class: Event
      Returns the Event.Type used to register this event, allowing an EventBus to find handlers of the appropriate class.
      Specified by:
      getAssociatedType in class GwtEvent<H extends EventHandler>
      Returns:
      the type
    • getNativeEvent

      public final NativeEvent getNativeEvent()
      Description copied from interface: HasNativeEvent
      Gets the underlying native event.
      Specified by:
      getNativeEvent in interface HasNativeEvent
      Returns:
      the native event
    • getRelativeElement

      public final Element getRelativeElement()
      Gets the element relative to which event coordinates will be measured. If this element is null, event coordinates will be measured relative to the window's client area.
      Returns:
      the event's relative element
    • preventDefault

      public void preventDefault()
      Prevents the wrapped native event's default action.
    • setNativeEvent

      public final void setNativeEvent(NativeEvent nativeEvent)
      Sets the native event associated with this dom event. In general, dom events should be fired using the static firing methods.
      Parameters:
      nativeEvent - the native event
    • setRelativeElement

      public void setRelativeElement(Element relativeElem)
      Gets the element relative to which event coordinates will be measured.
      Parameters:
      relativeElem - the event's relative element
    • stopPropagation

      public void stopPropagation()
      Stops the propagation of the underlying native event.