com.javadocking.drag
Class DynamicDragger

java.lang.Object
  extended by com.javadocking.drag.DynamicDragger
All Implemented Interfaces:
Dragger

public class DynamicDragger
extends java.lang.Object
implements Dragger

This is a class for dragging all the dockables in a LeafDock dynamically. The dockables will be removed from the old dock and placed in a new dock while the user is dragging.

If there is only one Dockable in the leaf dock, then the dockable is dragged, else a CompositeDockable is created with all the dockables of the leaf dock.

The Docks that are used in the application should inherit from the java.awt.Component class.

Author:
Heidi Rakels.

Constructor Summary
DynamicDragger()
          Constructs a dynamic dragger for the dockables of a dock.
DynamicDragger(Dockable fixedDockable)
          Constructs a dynamic dragger for the given dockable.
 
Method Summary
 void cancelDragging(java.awt.event.MouseEvent mouseEvent)
          It is not possible to cancel previous changes.
 void drag(java.awt.event.MouseEvent mouseEvent)
          Searches the dock, where the dockable can be docked for the current mouse location.
protected  java.awt.Cursor retrieveCanDockCursor()
          Gets the cursor that is used for dragging a dockable, when the dockable can be docked in an underlying dock.
 void showPopupMenu(java.awt.event.MouseEvent mouseEvent)
          Shows the popup menu for the selected dockable or the selected composite dockable.
 boolean startDragging(java.awt.event.MouseEvent mouseEvent)
           Tries to start the dragging of a Dockable from a source Dock to a destination dock.
 void stopDragging(java.awt.event.MouseEvent mouseEvent)
           Finishes the dragging of a Dockable object from a source Dock to a destination dock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicDragger

public DynamicDragger()
Constructs a dynamic dragger for the dockables of a dock.


DynamicDragger

public DynamicDragger(Dockable fixedDockable)
Constructs a dynamic dragger for the given dockable.

Parameters:
fixedDockable - The only dockable that is dragged by this dragger.
Method Detail

startDragging

public boolean startDragging(java.awt.event.MouseEvent mouseEvent)
Description copied from interface: Dragger

Tries to start the dragging of a Dockable from a source Dock to a destination dock.

The dockable that should be dragged is searched for the given mouse position.

Specified by:
startDragging in interface Dragger
Parameters:
mouseEvent - The mouse event that was triggered.
Returns:
True if the dragging of a dockable could be started, false otherwise.

drag

public void drag(java.awt.event.MouseEvent mouseEvent)
Searches the dock, where the dockable can be docked for the current mouse location. The dockable is docked immediately in this location. If we cannot dock for the current location, the 'cannot dock' cursor is shown.

Specified by:
drag in interface Dragger
Parameters:
mouseEvent - The new mouse event that was triggered.

cancelDragging

public void cancelDragging(java.awt.event.MouseEvent mouseEvent)
It is not possible to cancel previous changes. The dockable remains, where it is. The dragging process is only stopped.

Specified by:
cancelDragging in interface Dragger
Parameters:
mouseEvent - The last mouse event that was triggered.

stopDragging

public void stopDragging(java.awt.event.MouseEvent mouseEvent)
Description copied from interface: Dragger

Finishes the dragging of a Dockable object from a source Dock to a destination dock.

Static draggers typically do the docking now: the destination dock is searched for the given mouse location. They try to remove the dockable from its current dock and add it to its destination dock. If the destination dock is the same dock as the origin, they can move the dockable to a new position.

Dynamic draggers typically only clean up now.

Specified by:
stopDragging in interface Dragger
Parameters:
mouseEvent - The last mouse event that was triggered.

showPopupMenu

public void showPopupMenu(java.awt.event.MouseEvent mouseEvent)
Description copied from interface: Dragger
Shows the popup menu for the selected dockable or the selected composite dockable.

Specified by:
showPopupMenu in interface Dragger
Parameters:
mouseEvent - The last mouse event that was triggered.

retrieveCanDockCursor

protected java.awt.Cursor retrieveCanDockCursor()
Gets the cursor that is used for dragging a dockable, when the dockable can be docked in an underlying dock.

Returns:
The cursor that is used for dragging a dockable, when the dockable can be docked in an underlying dock.