com.maryanovsky.gwtutils.client.ui.touch.gestures.tap
Class TapRecognizer

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
      extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.tap.TapRecognizer
All Implemented Interfaces:
HasTapHandlers

public class TapRecognizer
extends TouchGestureRecognizer
implements HasTapHandlers

Recognizes and fires single-finger, multi-tap events.

Author:
Maryanovsky Alexander

Field Summary
 
Fields inherited from class com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
handlerManager
 
Constructor Summary
TapRecognizer(Object tapEventsSource)
          Creates a new TapRecognizer which will fire events with the specified source object.
TapRecognizer(Object tapEventsSource, Condition<? super TapEvent> tapCondition)
          Creates a new TapRecognizer which will fire events with the specified source object and consult the specified tap condition before firing tap events.
TapRecognizer(Object tapEventsSource, H touchEventsSource)
          Creates a new TapRecognizer which will fire events with the specified source object and use the specified source of touch events.
TapRecognizer(Object tapEventsSource, H touchEventsSource, Condition<? super TapEvent> tapCondition)
          Creates a new TapRecognizer which will fire events with the specified source object, use the specified source of touch events and consult the specified tap condition before firing tap events.
 
Method Summary
 HandlerRegistration addTapHandler(TapHandler handler)
          Adds a tap handler.
protected  void onTouchCancel(TouchCancelEvent evt)
          Invoked when a touch event is canceled.
protected  void onTouchEnd(TouchEndEvent evt)
          Invoked when a finger touching the screen is lifted.
protected  void onTouchMove(TouchMoveEvent evt)
          Invoked when a finger touching the screen is moved.
protected  void onTouchStart(TouchStartEvent evt)
          Invoked when a touch starts.
protected  boolean tapCondition(TapEvent evt)
          Returns whether the specified TapEvent should be delivered to the handlers.
 
Methods inherited from class com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
fireEvent, setTouchEventsSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TapRecognizer

public TapRecognizer(Object tapEventsSource)
Creates a new TapRecognizer which will fire events with the specified source object.


TapRecognizer

public TapRecognizer(Object tapEventsSource,
                     H touchEventsSource)
Creates a new TapRecognizer which will fire events with the specified source object and use the specified source of touch events.


TapRecognizer

public TapRecognizer(Object tapEventsSource,
                     Condition<? super TapEvent> tapCondition)
Creates a new TapRecognizer which will fire events with the specified source object and consult the specified tap condition before firing tap events.


TapRecognizer

public TapRecognizer(Object tapEventsSource,
                     H touchEventsSource,
                     Condition<? super TapEvent> tapCondition)
Creates a new TapRecognizer which will fire events with the specified source object, use the specified source of touch events and consult the specified tap condition before firing tap events. See the documentation of tapCondition(TapEvent) for more information on the tap condition.

Method Detail

addTapHandler

public HandlerRegistration addTapHandler(TapHandler handler)
Adds a tap handler.

Specified by:
addTapHandler in interface HasTapHandlers

tapCondition

protected boolean tapCondition(TapEvent evt)
Returns whether the specified TapEvent should be delivered to the handlers. This allows filtering tap gestures to only those you really want. For example, if you only want to recognize double taps, you would override this method and return evt.getTapCount() == 2. The default implementation delegates the decision to the tap condition passed in the constructor.


onTouchStart

protected void onTouchStart(TouchStartEvent evt)
Invoked when a touch starts.

Overrides:
onTouchStart in class TouchGestureRecognizer

onTouchMove

protected void onTouchMove(TouchMoveEvent evt)
Invoked when a finger touching the screen is moved.

Overrides:
onTouchMove in class TouchGestureRecognizer

onTouchEnd

protected void onTouchEnd(TouchEndEvent evt)
Invoked when a finger touching the screen is lifted.

Overrides:
onTouchEnd in class TouchGestureRecognizer

onTouchCancel

protected void onTouchCancel(TouchCancelEvent evt)
Invoked when a touch event is canceled.

Overrides:
onTouchCancel in class TouchGestureRecognizer