Package ej.widget.event
Class ClickEventHandler
- java.lang.Object
-
- ej.widget.event.PointerEventHandler
-
- ej.widget.event.ClickEventHandler
-
- All Implemented Interfaces:
ej.microui.event.EventHandler
public class ClickEventHandler extends PointerEventHandler
The click event handler responsibility is to detect pointer events (press, drag, release) and help interact with abutton-like interactiveelement.- Since:
- 4.3.0
-
-
Constructor Summary
Constructors Constructor Description ClickEventHandler(ej.mwt.Widget widget, Clickable clickable)Creates a swipe event handler on an element.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidhandleClick()Deprecated.Internal API.protected voidonExited()Does nothing by default.protected booleanonPressed(int pointerX, int pointerY)Returnsfalseby default.protected booleanonReleased(int pointerX, int pointerY)Returnsfalseby default.voidsetOnClickListener(OnClickListener onClickListener)Sets the "on click" listener.-
Methods inherited from class ej.widget.event.PointerEventHandler
handleEvent, onDragged
-
-
-
-
Constructor Detail
-
ClickEventHandler
public ClickEventHandler(ej.mwt.Widget widget, Clickable clickable)Creates a swipe event handler on an element.- Parameters:
widget- the attached widget.clickable- the clickable.
-
-
Method Detail
-
setOnClickListener
public void setOnClickListener(@Nullable OnClickListener onClickListener)Sets the "on click" listener.- Parameters:
onClickListener- the "on click" listener to set ornull.
-
onPressed
protected boolean onPressed(int pointerX, int pointerY)Description copied from class:PointerEventHandlerReturnsfalseby default.Override this method to react on
PRESSEDevents.
Returnstrueto get event focus. Other widgets will no longer receive pointer events until nextRELEASED.- Overrides:
onPressedin classPointerEventHandler- Parameters:
pointerX- thePointerevent X, relative to the attached widget.pointerY- thePointerevent Y, relative to the attached widget.- Returns:
trueif the event has been processed,falseif it should be dispatched to other handlers.
-
onReleased
protected boolean onReleased(int pointerX, int pointerY)Description copied from class:PointerEventHandlerReturnsfalseby default.Override this method to react on
RELEASEDevents.
Returnstrueto prevent other widgets to also handle this event.- Overrides:
onReleasedin classPointerEventHandler- Parameters:
pointerX- thePointerevent X, relative to the attached widget.pointerY- thePointerevent Y, relative to the attached widget.- Returns:
trueif the event has been processed,falseif it should be dispatched to other handlers.
-
onExited
protected void onExited()
Description copied from class:PointerEventHandlerDoes nothing by default.Override this method to react on focus loss events.
- Overrides:
onExitedin classPointerEventHandler
-
handleClick
@Deprecated public void handleClick()
Deprecated.Internal API.Handles a click event.
-
-