com.javadocking.drag
Class DynamicTabDragger

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

public class DynamicTabDragger
extends java.lang.Object
implements Dragger

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

One dockable can be dragged by dragging the tab. All the dockables can be dragged by dragging another part of the tabbed pane. A CompositeDockable is created with the dockables of the javax.swing.JTabbedPane.

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

With this class a tab of the javax.swing.JTabbedPane can also be dragged. This happens, when one tab is dragged, and the mouse is over the header of the JTabbedPane.

Author:
Heidi Rakels.

Constructor Summary
DynamicTabDragger()
           
 
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

DynamicTabDragger

public DynamicTabDragger()
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.