public abstract class AbstractDragController extends java.lang.Object implements DragController
DragController which performs the bare essentials such as adding/removing styles,
maintaining collections, adding mouse listeners, etc.
Extend this class to implement specialized drag capabilities such table column or panel
resizing. For classic drag-and-drop functionality, i.e. the ability to pickup, move around and
drop widgets, use PickupDragController.
| Modifier and Type | Field and Description |
|---|---|
protected DragContext |
context
The drag controller's drag context.
|
| Constructor and Description |
|---|
AbstractDragController(com.google.gwt.user.client.ui.AbsolutePanel boundaryPanel)
Create a new drag-and-drop controller.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDragHandler(DragHandler handler)
Register a drag handler which will listen for
DragStartEvents and and
DragEndEvents. |
void |
clearSelection()
All currently selected widgets are deselected.
|
void |
dragEnd()
Callback method for
MouseDragHandler. |
void |
dragStart()
Callback method for
MouseDragHandler when a drag operation is initiated for this drag
controller. |
boolean |
getBehaviorCancelDocumentSelections()
Whether or not any selected regions should be unselected by dragging.
|
boolean |
getBehaviorConstrainedToBoundaryPanel()
Determine whether or not drag operations are constrained to the boundary panel.
|
int |
getBehaviorDragStartSensitivity()
Gets the number of pixels the mouse must be moved to initiate a drag operation.
|
boolean |
getBehaviorMultipleSelection()
Determines whether multiple widget selection behavior is enabled.
|
boolean |
getBehaviorScrollIntoView()
Determines whether containing panels and the browser window should be scrolled during dragging
in order to keep draggable widgets visible.
|
com.google.gwt.user.client.ui.AbsolutePanel |
getBoundaryPanel()
Get the boundary panel provided in the constructor.
|
void |
makeDraggable(com.google.gwt.user.client.ui.Widget draggable)
Attaches a
MouseDragHandler to the widget, applies styles to the draggable and the
handle. |
void |
makeDraggable(com.google.gwt.user.client.ui.Widget draggable,
com.google.gwt.user.client.ui.Widget dragHandle)
Similar to
makeDraggable(Widget), but allow separate, child to be specified as the
drag handle by which the first widget can be dragged. |
void |
makeNotDraggable(com.google.gwt.user.client.ui.Widget draggable)
Performs the reverse of
makeDraggable(Widget), detaching the MouseDragHandler
from the widget and removing any styling which was applied when making the widget draggable. |
void |
previewDragEnd()
Callback method for
MouseDragHandler. |
void |
previewDragStart()
Callback method for
MouseDragHandler. |
void |
removeDragHandler(DragHandler handler)
Unregister drag handler.
|
void |
resetCache()
Reset the internal drop controller (drop target) cache which is initialized primarily by
dragStart(). |
void |
setBehaviorCancelDocumentSelections(boolean cancelDocumentSelections)
Set whether or not document selections should be canceled by dragging.
|
void |
setBehaviorConstrainedToBoundaryPanel(boolean constrainedToBoundaryPanel)
Set whether or not movable widget is to be constrained to the boundary panel during dragging.
|
void |
setBehaviorDragStartSensitivity(int pixels)
Sets the number of pixels the mouse must be moved in either horizontal or vertical direction in
order to initiate a drag operation.
|
void |
setBehaviorMultipleSelection(boolean multipleSelectionAllowed)
Sets whether multiple widgets can be selected for dragging at one time via
CTRL/
META-click. |
void |
setBehaviorScrollIntoView(boolean scrollIntoView)
Set whether or not to scroll containing panels and the browser window during drag operations in
order to keep the draggable widgets visible.
|
void |
setConstrainWidgetToBoundaryPanel(boolean constrainWidgetToBoundaryPanel) |
void |
toggleSelection(com.google.gwt.user.client.ui.Widget draggable)
Toggle the selection of the specified widget.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdragMoveprotected final DragContext context
public AbstractDragController(com.google.gwt.user.client.ui.AbsolutePanel boundaryPanel)
boundaryPanel - the desired boundary panel or RootPanel.get() if entire
document body is to be the boundarypublic final void addDragHandler(DragHandler handler)
DragControllerDragStartEvents and and
DragEndEvents.addDragHandler in interface DragControlleraddDragHandler in interface FiresDragEventshandler - the drag handler to registerDragController.removeDragHandler(DragHandler)public void clearSelection()
DragControllerclearSelection in interface DragControllerpublic void dragEnd()
DragControllerMouseDragHandler.dragEnd in interface DragControllerpublic void dragStart()
DragControllerMouseDragHandler when a drag operation is initiated for this drag
controller.dragStart in interface DragControllerpublic boolean getBehaviorCancelDocumentSelections()
DragControllergetBehaviorCancelDocumentSelections in interface DragControllertrue if cancel selections behavior in onpublic boolean getBehaviorConstrainedToBoundaryPanel()
DragControllergetBehaviorConstrainedToBoundaryPanel in interface DragControllertrue if drags are constrained to the boundary panelpublic int getBehaviorDragStartSensitivity()
DragControllergetBehaviorDragStartSensitivity in interface DragController0 (zero) if mouse down starts the dragpublic boolean getBehaviorMultipleSelection()
DragControllergetBehaviorMultipleSelection in interface DragControllertrue if multiple widget selection behavior is enabledpublic boolean getBehaviorScrollIntoView()
DragControllergetBehaviorScrollIntoView in interface DragControllertrue if containing panels and the browser window are to be scrolled during
dragging to keep draggable widgets visiblepublic final com.google.gwt.user.client.ui.AbsolutePanel getBoundaryPanel()
DragControllergetBoundaryPanel in interface DragControllerpublic void makeDraggable(com.google.gwt.user.client.ui.Widget draggable)
MouseDragHandler to the widget, applies styles to the draggable and the
handle.makeDraggable in interface DragControllerdraggable - the widget to be made draggablemakeDraggable(Widget, Widget),
HasDragHandlepublic void makeDraggable(com.google.gwt.user.client.ui.Widget draggable,
com.google.gwt.user.client.ui.Widget dragHandle)
makeDraggable(Widget), but allow separate, child to be specified as the
drag handle by which the first widget can be dragged.makeDraggable in interface DragControllerdraggable - the widget to be made draggabledragHandle - the widget by which widget can be draggedpublic void makeNotDraggable(com.google.gwt.user.client.ui.Widget draggable)
makeDraggable(Widget), detaching the MouseDragHandler
from the widget and removing any styling which was applied when making the widget draggable.makeNotDraggable in interface DragControllerdraggable - the widget to no longer be draggablepublic void previewDragEnd()
throws VetoDragException
DragControllerMouseDragHandler.previewDragEnd in interface DragControllerVetoDragException - if the proposed operation is unacceptablepublic void previewDragStart()
throws VetoDragException
DragControllerMouseDragHandler.previewDragStart in interface DragControllerVetoDragException - if the proposed operation is unacceptablepublic final void removeDragHandler(DragHandler handler)
DragControllerremoveDragHandler in interface DragControllerremoveDragHandler in interface FiresDragEventshandler - the drag handler to removeDragController.addDragHandler(DragHandler)public void resetCache()
DragControllerdragStart(). This method should be called when a drop target's
size and/or location changes, or when drop target eligibility changes.resetCache in interface DragControllerpublic void setBehaviorCancelDocumentSelections(boolean cancelDocumentSelections)
DragControllertrue.setBehaviorCancelDocumentSelections in interface DragControllercancelDocumentSelections - true if dragging should cancel document selectionspublic void setBehaviorConstrainedToBoundaryPanel(boolean constrainedToBoundaryPanel)
DragControllersetBehaviorConstrainedToBoundaryPanel in interface DragControllerconstrainedToBoundaryPanel - whether or not to constrain to the boundary panelpublic void setBehaviorDragStartSensitivity(int pixels)
DragController0 (zero). Use a value of at least
1 (one) in order to allow registered click listeners to receive click events.setBehaviorDragStartSensitivity in interface DragControllerpixels - number of pixels or 0 (zero) to start dragging on mouse downpublic void setBehaviorMultipleSelection(boolean multipleSelectionAllowed)
DragControllerCTRL/
META-click. Defaults to true.setBehaviorMultipleSelection in interface DragControllermultipleSelectionAllowed - whether multiple selections are enabledpublic void setBehaviorScrollIntoView(boolean scrollIntoView)
DragControllertrue.setBehaviorScrollIntoView in interface DragControllerscrollIntoView - whether or not to scroll panels and browser window to keep draggable
widgets visiblepublic void setConstrainWidgetToBoundaryPanel(boolean constrainWidgetToBoundaryPanel)
public void toggleSelection(com.google.gwt.user.client.ui.Widget draggable)
DragControllertoggleSelection in interface DragControllerdraggable - the widget whose selection is to be toggled