com.maryanovsky.gwtutils.client.ui.touch.gestures.buttontap
Class ButtonTapRecognizer

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
      extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.buttontap.ButtonTapRecognizer
All Implemented Interfaces:
HasButtonTapHandlers

public class ButtonTapRecognizer
extends TouchGestureRecognizer
implements HasButtonTapHandlers

Recognizes button-taps and fires tap events. Unlike a regular tap (recognized by TapRecognizer), a button-tap gesture allows the finger to move between the touch-start and touch-end events, does not limit the amount of time the finger can be pressed. Additionally, there is no such thing as a multi-button-tap and the event object does not include the location of the tap.

Author:
Maryanovsky Alexander

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

Constructor Detail

ButtonTapRecognizer

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


ButtonTapRecognizer

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


ButtonTapRecognizer

public ButtonTapRecognizer(Object buttonTapEventsSource,
                           Condition<? super ButtonTapEvent> buttonTapCondition)
Creates a new ButtonTapRecognizer which will fire events with the specified source object and consult the specified button-tap condition before firing button-tap events.


ButtonTapRecognizer

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

Method Detail

addButtonTapHandler

public HandlerRegistration addButtonTapHandler(ButtonTapHandler handler)
Adds a button-tap handler.

Specified by:
addButtonTapHandler in interface HasButtonTapHandlers

buttonTapCondition

protected boolean buttonTapCondition(ButtonTapEvent evt)
Returns whether the specified ButtonTapEvent should be delivered to the handlers. This allows filtering tap gestures to only those you really want. The default implementation delegates the decision to the button-tap condition passed in the constructor.


onTouchEnd

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

Overrides:
onTouchEnd in class TouchGestureRecognizer