|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.generic.dndTabs.DnDTabHandler
public class DnDTabHandler
This class provides the necessary infrastructure for handling Drag-and-Drop features of a Tab from one TabbedPane to another. In other words, this class enables a user to move tabs from one tab to another within the same application. This implementation has been adapted from the code examples provided in the Java Swing text book.
Nested Class Summary | |
---|---|
class |
DnDTabHandler.TransferableTab
This inner class provides a wrapper that impelements Transferable interface to simply provide a place holder for DnD operations. |
Field Summary | |
---|---|
private static java.awt.Cursor[] |
ArrowCursors
The 4 block arrow cursors that are internally used by this DnD handler. |
private static java.awt.Component |
componentMoved
The tab (JComponent) to be moved via this DnD handler. |
private static java.awt.dnd.DragSourceContext |
dragContext
This instance variable is filled in by the source pane when a drag operation is started and reset to null once the drag operation is completed. |
private java.awt.dnd.DragSource |
dragSource
The drag source object associated with this DnD handler. |
static java.awt.datatransfer.DataFlavor |
TAB_FLAVOR
The only DataFlavor that is currently supported by all of the DnD related classes and methods in this class. |
private static javax.swing.Icon |
tabIcon
The icon for the tab currently being moved. |
private static java.lang.String |
tabName
The name of the tab currently being moved. |
private DnDTabbedPane |
tabPane
This member object hold a reference to the JTabbedPane with which this DnD handler is associated. |
Constructor Summary | |
---|---|
DnDTabHandler(DnDTabbedPane tab)
The constructor. |
Method Summary | |
---|---|
private static void |
createCursors(DnDTabbedPane tabPane)
This is a helper method that is used to create some of the custom cursors used by this class. |
void |
dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)
This method is a part of the DragSourceListener interface. |
void |
dragEnter(java.awt.dnd.DragSourceDragEvent dsde)
This method is a part of the DragSourceListener interface. |
void |
dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
This method is part of the DropTargetListener. |
void |
dragExit(java.awt.dnd.DragSourceEvent dse)
This method is a part of the DragSourceListener interface. |
void |
dragExit(java.awt.dnd.DropTargetEvent dte)
This method is part of the DropTargetListener. |
void |
dragGestureRecognized(java.awt.dnd.DragGestureEvent dge)
This method is a part of the DragGestureListener interface. |
void |
dragMouseMoved(java.awt.dnd.DragSourceDragEvent dsde)
This method is part of the DragSourceMotionListener method. |
void |
dragOver(java.awt.dnd.DragSourceDragEvent dsde)
This method is a part of the DragSourceListener interface. |
void |
dragOver(java.awt.dnd.DropTargetDragEvent dtde)
This method is part of the DropTargetListener. |
void |
drop(java.awt.dnd.DropTargetDropEvent dtde)
This method is part of the DropTargetListener interface. |
void |
dropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)
This method is a part of the DragSourceListener interface. |
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
This method is part of the DropTargetListener. |
protected DnDTabbedPane.Location |
getLocation(int x,
int y)
Helper method used to determine where a given x and y coordinates (typically the mouse pointer positions) is with respect to the DnDTabbedPane that owns this handler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.datatransfer.DataFlavor TAB_FLAVOR
private final DnDTabbedPane tabPane
private java.awt.dnd.DragSource dragSource
private static transient java.awt.Component componentMoved
private static transient java.lang.String tabName
private static transient javax.swing.Icon tabIcon
private static transient java.awt.dnd.DragSourceContext dragContext
private static transient java.awt.Cursor[] ArrowCursors
Constructor Detail |
---|
public DnDTabHandler(DnDTabbedPane tab)
tab
- The DnDTabbedPane this DnD handler is associated.Method Detail |
---|
public void dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)
dragDropEnd
in interface java.awt.dnd.DragSourceListener
dsde
- The source drop event to be processed.public void dragMouseMoved(java.awt.dnd.DragSourceDragEvent dsde)
dragMouseMoved
in interface java.awt.dnd.DragSourceMotionListener
public void dragEnter(java.awt.dnd.DragSourceDragEvent dsde)
dragEnter
in interface java.awt.dnd.DragSourceListener
dsde
- The source drag event to be processed.public void dragOver(java.awt.dnd.DragSourceDragEvent dsde)
dragOver
in interface java.awt.dnd.DragSourceListener
dsde
- The source drag event to be processed.public void dropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)
dropActionChanged
in interface java.awt.dnd.DragSourceListener
dsde
- This parameter is not used.public void dragExit(java.awt.dnd.DragSourceEvent dse)
dragExit
in interface java.awt.dnd.DragSourceListener
dse
- The source drag event to be processed.public void dragGestureRecognized(java.awt.dnd.DragGestureEvent dge)
dragGestureRecognized
in interface java.awt.dnd.DragGestureListener
dge
- The drag gesture event to be processed.public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
dragEnter
in interface java.awt.dnd.DropTargetListener
dtde
- The drop target event to be processed.protected DnDTabbedPane.Location getLocation(int x, int y)
Note: The return value from this method is meaningful only when the mouse pointer is within the bounds of the owning tabbed pane.
x
- The x-coordinate to test.y
- The y-coordinate to test
public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
dragOver
in interface java.awt.dnd.DropTargetListener
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
dropActionChanged
in interface java.awt.dnd.DropTargetListener
dtde
- This parameter is not used.public void dragExit(java.awt.dnd.DropTargetEvent dte)
dragExit
in interface java.awt.dnd.DropTargetListener
dte
- This parameter is not used.public void drop(java.awt.dnd.DropTargetDropEvent dtde)
drop
in interface java.awt.dnd.DropTargetListener
dtde
- The drop event to be processed.private static void createCursors(DnDTabbedPane tabPane)
tabPane
- The tabbed pane to operate on
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |