Class PointerEventHandler

  • All Implemented Interfaces:
    ej.microui.event.EventHandler
    Direct Known Subclasses:
    ClickEventHandler, SwipeEventHandler

    public abstract class PointerEventHandler
    extends java.lang.Object
    implements ej.microui.event.EventHandler
    Abstract pointer event handler.

    It can be used as base class for event handlers compatible with PointerEventDispatcher semantic.

    Since:
    3.5.0
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected PointerEventHandler​(ej.mwt.Widget widget)
      Instantiates the handler for the given widget.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean handleEvent​(int event)
      Handles an event.
      protected boolean onDragged​(int pointerX, int pointerY)
      Returns false by default.
      protected void onExited()
      Does nothing by default.
      protected boolean onPressed​(int pointerX, int pointerY)
      Returns false by default.
      protected boolean onReleased​(int pointerX, int pointerY)
      Returns false by default.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PointerEventHandler

        protected PointerEventHandler​(ej.mwt.Widget widget)
        Instantiates the handler for the given widget.
        Parameters:
        widget - the attached widget.
    • Method Detail

      • handleEvent

        public final boolean handleEvent​(int event)
        Description copied from interface: ej.microui.event.EventHandler
        Handles an event.
        Specified by:
        handleEvent in interface ej.microui.event.EventHandler
        Parameters:
        event - the event to handle.
        Returns:
        true if the event is consumed, false otherwise.
        See Also:
        Event
      • onPressed

        protected boolean onPressed​(int pointerX,
                                    int pointerY)
        Returns false by default.

        Override this method to react on PRESSED events.
        Returns true to get event focus. Other widgets will no longer receive pointer events until next RELEASED.

        Parameters:
        pointerX - the Pointer event X, relative to the attached widget.
        pointerY - the Pointer event Y, relative to the attached widget.
        Returns:
        true if the event has been processed, false if it should be dispatched to other handlers.
      • onDragged

        protected boolean onDragged​(int pointerX,
                                    int pointerY)
        Returns false by default.

        Override this method to react on DRAGGED events.
        Returns true to get event focus. Other widgets will no longer receive pointer events until next RELEASED.

        Parameters:
        pointerX - the Pointer event X, relative to the attached widget.
        pointerY - the Pointer event Y, relative to the attached widget.
        Returns:
        true if the event has been processed, false if it should be dispatched to other handlers.
      • onReleased

        protected boolean onReleased​(int pointerX,
                                     int pointerY)
        Returns false by default.

        Override this method to react on RELEASED events.
        Returns true to prevent other widgets to also handle this event.

        Parameters:
        pointerX - the Pointer event X, relative to the attached widget.
        pointerY - the Pointer event Y, relative to the attached widget.
        Returns:
        true if the event has been processed, false if it should be dispatched to other handlers.
      • onExited

        protected void onExited()
        Does nothing by default.

        Override this method to react on focus loss events.