com.maryanovsky.gwtutils.client.ui.mouse.gestures.wheelscroll
Class WheelScrollRecognizer

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.ui.mouse.gestures.MouseGestureRecognizer
      extended by com.maryanovsky.gwtutils.client.ui.mouse.gestures.wheelscroll.WheelScrollRecognizer
All Implemented Interfaces:
HasAllWheelScrollHandlers, HasWheelScrollDownHandlers, HasWheelScrollUpHandlers

public class WheelScrollRecognizer
extends MouseGestureRecognizer
implements HasAllWheelScrollHandlers

Recognizes and fires mouse wheel scroll events.

Author:
Maryanovsky Alexander

Field Summary
 
Fields inherited from class com.maryanovsky.gwtutils.client.ui.mouse.gestures.MouseGestureRecognizer
handlerManager
 
Constructor Summary
WheelScrollRecognizer(Object wheelScrollEventsSource)
          Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object.
WheelScrollRecognizer(Object wheelScrollEventsSource, Condition<WheelScrollUpEvent> wheelScrollUpCondition, Condition<WheelScrollDownEvent> wheelScrollDownCondition)
          Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object and consult the specified conditions before doing so.
WheelScrollRecognizer(Object wheelScrollEventsSource, H mouseEventsSource)
          Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object and use the specified source of mouse events.
WheelScrollRecognizer(Object wheelScrollEventsSource, H mouseEventsSource, Condition<WheelScrollUpEvent> wheelScrollUpCondition, Condition<WheelScrollDownEvent> wheelScrollDownCondition)
          Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object, use the specified source of mouse events and consult the specified conditions before firing the event(s).
 
Method Summary
 HandlerRegistration addWheelScrollDownHandler(WheelScrollDownHandler handler)
          Adds a mouse wheel scroll-down handler.
 HandlerRegistration addWheelScrollUpHandler(WheelScrollUpHandler handler)
          Adds a mouse wheel scroll-up handler.
protected  void onMouseWheel(MouseWheelEvent event)
          Invoked when the mouse wheel is scrolled.
protected  boolean wheelScrollDownCondition(WheelScrollDownEvent evt)
          Returns whether the specified WheelScrollDownEvent should be delivered to the handlers.
protected  boolean wheelScrollUpCondition(WheelScrollUpEvent evt)
          Returns whether the specified WheelScrollUpEvent should be delivered to the handlers.
 
Methods inherited from class com.maryanovsky.gwtutils.client.ui.mouse.gestures.MouseGestureRecognizer
fireEvent, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, setMouseEventsSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WheelScrollRecognizer

public WheelScrollRecognizer(Object wheelScrollEventsSource)
Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object.


WheelScrollRecognizer

public WheelScrollRecognizer(Object wheelScrollEventsSource,
                             H mouseEventsSource)
Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object and use the specified source of mouse events.


WheelScrollRecognizer

public WheelScrollRecognizer(Object wheelScrollEventsSource,
                             Condition<WheelScrollUpEvent> wheelScrollUpCondition,
                             Condition<WheelScrollDownEvent> wheelScrollDownCondition)
Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object and consult the specified conditions before doing so.


WheelScrollRecognizer

public WheelScrollRecognizer(Object wheelScrollEventsSource,
                             H mouseEventsSource,
                             Condition<WheelScrollUpEvent> wheelScrollUpCondition,
                             Condition<WheelScrollDownEvent> wheelScrollDownCondition)
Creates a new WheelScrollRecognizer which will fire mouse wheel scroll events with the specified source object, use the specified source of mouse events and consult the specified conditions before firing the event(s). See the documentation of wheelScrollUpCondition(WheelScrollUpEvent) and wheelScrollDownCondition(WheelScrollDownEvent) for information on the wheel scroll conditions.

Method Detail

addWheelScrollUpHandler

public HandlerRegistration addWheelScrollUpHandler(WheelScrollUpHandler handler)
Adds a mouse wheel scroll-up handler.

Specified by:
addWheelScrollUpHandler in interface HasWheelScrollUpHandlers

addWheelScrollDownHandler

public HandlerRegistration addWheelScrollDownHandler(WheelScrollDownHandler handler)
Adds a mouse wheel scroll-down handler.

Specified by:
addWheelScrollDownHandler in interface HasWheelScrollDownHandlers

wheelScrollUpCondition

protected boolean wheelScrollUpCondition(WheelScrollUpEvent evt)
Returns whether the specified WheelScrollUpEvent should be delivered to the handlers. This allows filtering mouse wheel scroll up gestures to only those you really want. For example, if you only want to recognize scrolls while the control key is held, you would override this method and return evt.getSourceEvent().isControlKeyDown(). The default implementation delegates the decision to the wheel scroll up condition passed in the constructor.


wheelScrollDownCondition

protected boolean wheelScrollDownCondition(WheelScrollDownEvent evt)
Returns whether the specified WheelScrollDownEvent should be delivered to the handlers. This allows filtering mouse wheel scroll down gestures to only those you really want. For example, if you only want to recognize scrolls while the control key is held, you would override this method and return evt.getSourceEvent().isControlKeyDown(). The default implementation delegates the decision to the wheel scroll down condition passed in the constructor.


onMouseWheel

protected void onMouseWheel(MouseWheelEvent event)
Invoked when the mouse wheel is scrolled.

Overrides:
onMouseWheel in class MouseGestureRecognizer