Package ej.widget.event
Class PointerEventHandler
- java.lang.Object
-
- ej.widget.event.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)
Returnsfalse
by default.protected void
onExited()
Does nothing by default.protected boolean
onPressed(int pointerX, int pointerY)
Returnsfalse
by default.protected boolean
onReleased(int pointerX, int pointerY)
Returnsfalse
by default.
-
-
-
Method Detail
-
handleEvent
public final boolean handleEvent(int event)
Description copied from interface:ej.microui.event.EventHandler
Handles an event.- Specified by:
handleEvent
in interfaceej.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)
Returnsfalse
by default.Override this method to react on
PRESSED
events.
Returnstrue
to get event focus. Other widgets will no longer receive pointer events until nextRELEASED
.- Parameters:
pointerX
- thePointer
event X, relative to the attached widget.pointerY
- thePointer
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)
Returnsfalse
by default.Override this method to react on
DRAGGED
events.
Returnstrue
to get event focus. Other widgets will no longer receive pointer events until nextRELEASED
.- Parameters:
pointerX
- thePointer
event X, relative to the attached widget.pointerY
- thePointer
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)
Returnsfalse
by default.Override this method to react on
RELEASED
events.
Returnstrue
to prevent other widgets to also handle this event.- Parameters:
pointerX
- thePointer
event X, relative to the attached widget.pointerY
- thePointer
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.
-
-