com.maryanovsky.gwtutils.client.ui.dnd
Interface Draggable


public interface Draggable

The interface to be implemented by objects that can be dragged and dropped.

Author:
Maryanovsky Alexander

Method Summary
 Widget getDraggedWidget()
          Returns the widget to be dragged and dropped.
 HasAllMouseHandlers getDragHandle()
          Returns the handle by which the object can be dragged.
 PointView getDragHandleOffset()
          Returns the offset of the drag handle from the dragged widget when not in the middle of a drag-and-drop gesture.
 void onDragCancel()
          Informs the draggable that the drag-and-drop gesture has been canceled.
 void onDragStart()
          Informs the draggable that it has started being dragged.
 void onDrop(DropTarget dropTarget)
          Informs the draggable that it has been dropped into the specified drop target.
 

Method Detail

getDraggedWidget

Widget getDraggedWidget()
Returns the widget to be dragged and dropped.


getDragHandle

HasAllMouseHandlers getDragHandle()
Returns the handle by which the object can be dragged. Note that the handle cannot be part of the dragged widget and must remain attached to the DOM and unmoved for the entire duration of the drag-and-drop gesture. This is because during the drag-and-drop gesture, the dragged widget is removed from its parent (if any) and added to the root panel where it is made to follow the mouse cursor. If the handle were part of the dragged widget we would not be able to continue receiving mouse events from it during the entire gesture.


getDragHandleOffset

PointView getDragHandleOffset()
Returns the offset of the drag handle from the dragged widget when not in the middle of a drag-and-drop gesture.


onDragStart

void onDragStart()
Informs the draggable that it has started being dragged.


onDrop

void onDrop(DropTarget dropTarget)
Informs the draggable that it has been dropped into the specified drop target. Note that the drop target can be null if the user performed a drag gesture but not into a valid drop target.


onDragCancel

void onDragCancel()
Informs the draggable that the drag-and-drop gesture has been canceled.