com.maryanovsky.gwtutils.client.ui.touch.gestures.mouse
Class TapClickEventsConverter

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.mouse.TapClickEventsConverter
All Implemented Interfaces:
HasClickHandlers, HasHandlers

public class TapClickEventsConverter
extends Object
implements HasClickHandlers

Generates synthetic click events from corresponding tap events. This is useful for widget implementers that want to add basic iPhone support without modifying their widget's API. The converter can be used in two ways:

Author:
Maryanovsky Alexander

Constructor Summary
TapClickEventsConverter(UIObject target)
          Creates a new TapClickEventsConverter with the specified target widget.
TapClickEventsConverter(UIObject target, H buttonTapEventsSource)
          Creates a new TapClickEventsConverter with the specified target widget.
TapClickEventsConverter(UIObject target, H tapEventsSource)
          Creates a new TapClickEventsConverter with the specified target widget.
 
Method Summary
 HandlerRegistration addClickHandler(ClickHandler handler)
          
 void fireEvent(GwtEvent<?> event)
          
protected  void onButtonTap(ButtonTapEvent evt)
          Invoked when a button-tap occurs.
protected  void onTap(TapEvent evt)
          Invoked when a tap occurs.
<H extends HasButtonTapHandlers>
void
setButtonTapEventsSource(H source)
          Sets the source of button-tap events for this recognizer.
<H extends HasTapHandlers>
void
setTapEventsSource(H source)
          Sets the source of tap events for this recognizer.
 void stop()
          Unregisters this TapClickEventsConverter from its source, which will cause it to stop firing any click events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TapClickEventsConverter

public TapClickEventsConverter(UIObject target)
Creates a new TapClickEventsConverter with the specified target widget. If the target widget is not null, synthetic click events will be dispatched on it, and its element will be used as the element relative to which event coordinates are measured.


TapClickEventsConverter

public TapClickEventsConverter(UIObject target,
                               H tapEventsSource)
Creates a new TapClickEventsConverter with the specified target widget. If the target widget is not null, synthetic click events will be dispatched on it, and its element will be used as the element relative to which event coordinates are measured. Additionally, you may pass the source of tap events.


TapClickEventsConverter

public TapClickEventsConverter(UIObject target,
                               H buttonTapEventsSource)
Creates a new TapClickEventsConverter with the specified target widget. If the target widget is not null, synthetic click events will be dispatched on it, and its element will be used as the element relative to which event coordinates are measured. Additionally, you may pass the source of button-tap events.

Method Detail

setTapEventsSource

public <H extends HasTapHandlers> void setTapEventsSource(H source)
Sets the source of tap events for this recognizer. Passing null will cause the recognizer to deregister itself from the previous source. You may not simultaneously set both a regular and a button-tap source.


setButtonTapEventsSource

public <H extends HasButtonTapHandlers> void setButtonTapEventsSource(H source)
Sets the source of button-tap events for this recognizer. Passing null will cause the recognizer to deregister itself from the previous source. You may not simultaneously set both a regular and a button-tap source.


addClickHandler

public HandlerRegistration addClickHandler(ClickHandler handler)

Specified by:
addClickHandler in interface HasClickHandlers

fireEvent

public void fireEvent(GwtEvent<?> event)

Specified by:
fireEvent in interface HasHandlers

stop

public void stop()
Unregisters this TapClickEventsConverter from its source, which will cause it to stop firing any click events. You cannot "restart" a the converter after it has been stopped.


onTap

protected void onTap(TapEvent evt)
Invoked when a tap occurs.


onButtonTap

protected void onButtonTap(ButtonTapEvent evt)
Invoked when a button-tap occurs.