|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.gwtutils.client.ui.mouse.gestures.MouseGestureRecognizer
com.maryanovsky.gwtutils.client.ui.mouse.gestures.drag.DragRecognizer
public class DragRecognizer
Recognizes and fires mouse-drag events.
Field Summary | |
---|---|
static Condition<DragStartEvent> |
STANDARD_DRAG_CONDITION
The condition for the standard drag - left mouse button and no keyboard modifiers. |
Fields inherited from class com.maryanovsky.gwtutils.client.ui.mouse.gestures.MouseGestureRecognizer |
---|
handlerManager |
Constructor Summary | |
---|---|
DragRecognizer(Object dragEventsSource)
Creates a new DragRecognizer which will fire drag events with the
specified source object. |
|
DragRecognizer(Object dragEventsSource,
Condition<? super DragStartEvent> dragCondition)
Creates a new DragRecognizer which will fire drag events with
the specified source object and consult the specified drag condition
before doing so. |
|
DragRecognizer(Object dragEventsSource,
H mouseEventsSource)
Creates a new DragRecognizer which will fire drag events with the
specified source object and use the specified source of mouse events. |
|
DragRecognizer(Object dragEventsSource,
H mouseEventsSource,
Condition<? super DragStartEvent> dragCondition)
Creates a new DragRecognizer which will fire events with the
specified source object, use the specified source of mouse events and
consult the specified drag condition before firing the drag event(s). |
Method Summary | |
---|---|
HandlerRegistration |
addDragCancelHandler(DragCancelHandler handler)
Adds a drag cancel handler. |
HandlerRegistration |
addDragEndHandler(DragEndHandler handler)
Adds a drag end handler. |
HandlerRegistration |
addDragMoveHandler(DragMoveHandler handler)
Adds a drag move handler. |
HandlerRegistration |
addDragStartHandler(DragStartHandler handler)
Adds a drag start handler. |
protected boolean |
dragCondition(DragStartEvent evt)
Returns whether the specified DragStartEvent and the drag events
that follow it in the drag gesture should be delivered to the handlers. |
protected void |
onMouseDown(MouseDownEvent event)
Invoked when a mouse button is pressed. |
protected void |
onMouseMove(MouseMoveEvent event)
Invoked when the mouse is moved. |
protected void |
onMouseUp(MouseUpEvent event)
Invoked when a mouse button is released. |
Methods inherited from class com.maryanovsky.gwtutils.client.ui.mouse.gestures.MouseGestureRecognizer |
---|
fireEvent, onMouseOut, onMouseOver, onMouseWheel, setMouseEventsSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Condition<DragStartEvent> STANDARD_DRAG_CONDITION
Constructor Detail |
---|
public DragRecognizer(Object dragEventsSource)
DragRecognizer
which will fire drag events with the
specified source object.
public DragRecognizer(Object dragEventsSource, H mouseEventsSource)
DragRecognizer
which will fire drag events with the
specified source object and use the specified source of mouse events.
public DragRecognizer(Object dragEventsSource, Condition<? super DragStartEvent> dragCondition)
DragRecognizer
which will fire drag events with
the specified source object and consult the specified drag condition
before doing so.
public DragRecognizer(Object dragEventsSource, H mouseEventsSource, Condition<? super DragStartEvent> dragCondition)
DragRecognizer
which will fire events with the
specified source object, use the specified source of mouse events and
consult the specified drag condition before firing the drag event(s).
See the documentation of dragCondition(DragStartEvent)
for more
information on the drag condition.
Method Detail |
---|
public HandlerRegistration addDragStartHandler(DragStartHandler handler)
addDragStartHandler
in interface HasDragStartHandlers
public HandlerRegistration addDragMoveHandler(DragMoveHandler handler)
addDragMoveHandler
in interface HasDragMoveHandlers
public HandlerRegistration addDragEndHandler(DragEndHandler handler)
addDragEndHandler
in interface HasDragEndHandlers
public HandlerRegistration addDragCancelHandler(DragCancelHandler handler)
addDragCancelHandler
in interface HasDragCancelHandlers
protected boolean dragCondition(DragStartEvent evt)
DragStartEvent
and the drag events
that follow it in the drag gesture should be delivered to the handlers.
This allows filtering drag gestures to only those you really want.
For example, if you only want to recognize left-mouse-button drags, you
would override this method and return
evt.getButton() == NativeEvent.BUTTON_LEFT
.
The default implementation delegates the decision to the drag condition
passed in the constructor.
protected void onMouseDown(MouseDownEvent event)
onMouseDown
in class MouseGestureRecognizer
protected void onMouseUp(MouseUpEvent event)
onMouseUp
in class MouseGestureRecognizer
protected void onMouseMove(MouseMoveEvent event)
onMouseMove
in class MouseGestureRecognizer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |