com.allen_sauer.gwt.dnd.client
Class PickupDragController

java.lang.Object
  extended by com.allen_sauer.gwt.dnd.client.AbstractDragController
      extended by com.allen_sauer.gwt.dnd.client.PickupDragController
All Implemented Interfaces:
DragController, FiresDragEvents
Direct Known Subclasses:
SwtDragController

public class PickupDragController
extends AbstractDragController


Field Summary
 
Fields inherited from class com.allen_sauer.gwt.dnd.client.AbstractDragController
context
 
Constructor Summary
PickupDragController(com.google.gwt.user.client.ui.AbsolutePanel boundaryPanel, boolean allowDroppingOnBoundaryPanel)
          Create a new pickup-and-move style drag controller.
 
Method Summary
 void dragEnd()
          Callback method for MouseDragHandler.
 void dragMove()
          Callback method for MouseDragHandler.
 void dragStart()
          Callback method for MouseDragHandler when a drag operation is initiated for this drag controller.
 boolean getBehaviorBoundaryPanelDrop()
          Whether or not dropping on the boundary panel is permitted.
 boolean getBehaviorDragProxy()
          Determine whether or not this controller automatically creates a drag proxy for each drag operation.
protected  com.google.gwt.user.client.ui.Widget getDragProxy()
           
protected  java.util.ArrayList<DropController> getDropControllerList()
           
 java.lang.Iterable<com.google.gwt.user.client.ui.Widget> getSelectedWidgets()
          Retrieve currently selected widgets.
protected  BoundaryDropController newBoundaryDropController(com.google.gwt.user.client.ui.AbsolutePanel boundaryPanel, boolean allowDroppingOnBoundaryPanel)
          Create a new BoundaryDropController to manage our boundary panel as a drop target.
protected  com.google.gwt.user.client.ui.Widget newDragProxy(DragContext context)
          Called by dragStart() to allow subclasses to provide their own drag proxies.
 void previewDragEnd()
          Callback method for MouseDragHandler.
 void registerDropController(DropController dropController)
          Register a new DropController, representing a new drop target, with this drag controller.
 void resetCache()
          Reset the internal drop controller (drop target) cache which is initialized primarily by AbstractDragController.dragStart().
protected  void restoreSelectedWidgetsLocation()
          Restore the selected widgets to their original location.
protected  void restoreSelectedWidgetsStyle()
          Restore the selected widgets with their original style.
protected  void restoreWidgetLocation(com.google.gwt.user.client.ui.Widget widget, SavedWidgetInfo info)
           
protected  void saveSelectedWidgetsLocationAndStyle()
          Save the selected widgets' current location in case they much be restored due to a cancelled drop.
protected  SavedWidgetInfo saveWidget(com.google.gwt.user.client.ui.Widget widget)
           
 void setBehaviorBoundaryPanelDrop(boolean allowDroppingOnBoundaryPanel)
          Set whether or not widgets may be dropped anywhere on the boundary panel.
 void setBehaviorDragProxy(boolean dragProxyEnabled)
          Set whether or not this controller should automatically create a drag proxy for each drag operation.
 void unregisterDropController(DropController dropController)
          Unregister a DropController from this drag controller.
 void unregisterDropControllers()
          Unregister all DropControllers from this drag controller.
 
Methods inherited from class com.allen_sauer.gwt.dnd.client.AbstractDragController
addDragHandler, clearSelection, getBehaviorCancelDocumentSelections, getBehaviorConstrainedToBoundaryPanel, getBehaviorDragStartSensitivity, getBehaviorMultipleSelection, getBehaviorScrollIntoView, getBoundaryPanel, getMouseDragHandler, makeDraggable, makeDraggable, makeNotDraggable, previewDragStart, removeDragHandler, setBehaviorCancelDocumentSelections, setBehaviorConstrainedToBoundaryPanel, setBehaviorDragStartSensitivity, setBehaviorMultipleSelection, setBehaviorScrollIntoView, setConstrainWidgetToBoundaryPanel, toggleSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PickupDragController

public PickupDragController(com.google.gwt.user.client.ui.AbsolutePanel boundaryPanel,
                            boolean allowDroppingOnBoundaryPanel)
Create a new pickup-and-move style drag controller. Allows widgets or a suitable proxy to be temporarily picked up and moved around the specified boundary panel.

Note: An implicit BoundaryDropController is created and registered automatically.

Parameters:
boundaryPanel - the desired boundary panel or RootPanel.get() (read http://code.google.com/p/gwt-dnd/wiki/GettingStarted) if entire document body is to be the boundary
allowDroppingOnBoundaryPanel - whether or not boundary panel should allow dropping
Method Detail

dragEnd

public void dragEnd()
Description copied from interface: DragController
Callback method for MouseDragHandler.

Specified by:
dragEnd in interface DragController
Overrides:
dragEnd in class AbstractDragController

dragMove

public void dragMove()
Description copied from interface: DragController
Callback method for MouseDragHandler.


dragStart

public void dragStart()
Description copied from interface: DragController
Callback method for MouseDragHandler when a drag operation is initiated for this drag controller.

Specified by:
dragStart in interface DragController
Overrides:
dragStart in class AbstractDragController

getBehaviorBoundaryPanelDrop

public boolean getBehaviorBoundaryPanelDrop()
Whether or not dropping on the boundary panel is permitted.

Returns:
true if dropping on the boundary panel is allowed

getBehaviorDragProxy

public boolean getBehaviorDragProxy()
Determine whether or not this controller automatically creates a drag proxy for each drag operation.

Returns:
true if drag proxy behavior is enabled

getSelectedWidgets

public java.lang.Iterable<com.google.gwt.user.client.ui.Widget> getSelectedWidgets()
Retrieve currently selected widgets.

Returns:
iterator of currently selected widgets

previewDragEnd

public void previewDragEnd()
                    throws VetoDragException
Description copied from interface: DragController
Callback method for MouseDragHandler.

Specified by:
previewDragEnd in interface DragController
Overrides:
previewDragEnd in class AbstractDragController
Throws:
VetoDragException - if the proposed operation is unacceptable

registerDropController

public void registerDropController(DropController dropController)
Register a new DropController, representing a new drop target, with this drag controller.

Parameters:
dropController - the controller to register
See Also:
unregisterDropController(DropController)

resetCache

public void resetCache()
Description copied from interface: DragController
Reset the internal drop controller (drop target) cache which is initialized primarily by AbstractDragController.dragStart(). This method should be called when a drop target's size and/or location changes, or when drop target eligibility changes.

Specified by:
resetCache in interface DragController
Overrides:
resetCache in class AbstractDragController

setBehaviorBoundaryPanelDrop

public void setBehaviorBoundaryPanelDrop(boolean allowDroppingOnBoundaryPanel)
Set whether or not widgets may be dropped anywhere on the boundary panel. Set to false when you only want explicitly registered drop controllers to accept drops. Defaults to true.

Parameters:
allowDroppingOnBoundaryPanel - true to allow dropping

setBehaviorDragProxy

public void setBehaviorDragProxy(boolean dragProxyEnabled)
Set whether or not this controller should automatically create a drag proxy for each drag operation.

Parameters:
dragProxyEnabled - true to enable drag proxy behavior

unregisterDropController

public void unregisterDropController(DropController dropController)
Unregister a DropController from this drag controller.

Parameters:
dropController - the controller to register
See Also:
registerDropController(DropController), unregisterDropControllers()

unregisterDropControllers

public void unregisterDropControllers()
Unregister all DropControllers from this drag controller.

See Also:
registerDropController(DropController), unregisterDropController(DropController)

newBoundaryDropController

protected BoundaryDropController newBoundaryDropController(com.google.gwt.user.client.ui.AbsolutePanel boundaryPanel,
                                                           boolean allowDroppingOnBoundaryPanel)
Create a new BoundaryDropController to manage our boundary panel as a drop target. To ensure that draggable widgets can only be dropped on registered drop targets, set allowDroppingOnBoundaryPanel to false.

Parameters:
boundaryPanel - the panel to which our drag-and-drop operations are constrained
allowDroppingOnBoundaryPanel - whether or not dropping is allowed on the boundary panel
Returns:
the new BoundaryDropController

newDragProxy

protected com.google.gwt.user.client.ui.Widget newDragProxy(DragContext context)
Called by dragStart() to allow subclasses to provide their own drag proxies.

Parameters:
context - the current drag context
Returns:
a new drag proxy

restoreSelectedWidgetsLocation

protected void restoreSelectedWidgetsLocation()
Restore the selected widgets to their original location.

See Also:
saveSelectedWidgetsLocationAndStyle(), restoreSelectedWidgetsStyle()

restoreSelectedWidgetsStyle

protected void restoreSelectedWidgetsStyle()
Restore the selected widgets with their original style.

See Also:
saveSelectedWidgetsLocationAndStyle(), restoreSelectedWidgetsLocation()

saveSelectedWidgetsLocationAndStyle

protected void saveSelectedWidgetsLocationAndStyle()
Save the selected widgets' current location in case they much be restored due to a cancelled drop.

See Also:
restoreSelectedWidgetsLocation()

restoreWidgetLocation

protected void restoreWidgetLocation(com.google.gwt.user.client.ui.Widget widget,
                                     SavedWidgetInfo info)

saveWidget

protected SavedWidgetInfo saveWidget(com.google.gwt.user.client.ui.Widget widget)

getDropControllerList

protected java.util.ArrayList<DropController> getDropControllerList()

getDragProxy

protected com.google.gwt.user.client.ui.Widget getDragProxy()


Copyright © 2011 Sage Software, Inc. All rights reserved.