ca.sqlpower.architect.swingui
Class PlayPen.PlayPenDropListener

java.lang.Object
  extended by ca.sqlpower.architect.swingui.PlayPen.PlayPenDropListener
All Implemented Interfaces:
java.awt.dnd.DropTargetListener, java.util.EventListener
Enclosing class:
PlayPen

public class PlayPen.PlayPenDropListener
extends java.lang.Object
implements java.awt.dnd.DropTargetListener

Tracks incoming objects and adds successfully dropped objects at the current mouse position. Also retargets drops to the TablePanes when necessary.


Field Summary
protected  ContainerPane<?,?> tpTarget
          When the user moves over a container pane, its drop target's dragEnter method will be called, and this variable will reference it.
 
Constructor Summary
PlayPen.PlayPenDropListener()
           
 
Method Summary
 java.awt.datatransfer.DataFlavor bestImportFlavor(javax.swing.JComponent c, java.awt.datatransfer.DataFlavor[] flavors)
          Chooses the best import flavour from the flavors array for importing into c.
 boolean canImport(javax.swing.JComponent c, java.awt.datatransfer.DataFlavor[] flavors)
          This is set up this way because this DropTargetListener was derived from a TransferHandler.
 void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
          Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.
 void dragExit(java.awt.dnd.DropTargetEvent dte)
          Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener or escape has been pressed
 void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
          Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.
 void drop(java.awt.dnd.DropTargetDropEvent dtde)
          Processes the drop action on the PlayPen (the DropTarget) or current target TablePane if there is one.
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
          Called if the user has modified the current drop gesture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tpTarget

protected ContainerPane<?,?> tpTarget
When the user moves over a container pane, its drop target's dragEnter method will be called, and this variable will reference it. When the user moves off of a pane, its dragExit method will be called, and this variable will reference null (or a different table pane).

Constructor Detail

PlayPen.PlayPenDropListener

public PlayPen.PlayPenDropListener()
Method Detail

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent dte)
Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener or escape has been pressed

Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent dtde)
Processes the drop action on the PlayPen (the DropTarget) or current target TablePane if there is one.

Specified by:
drop in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
Called if the user has modified the current drop gesture.

Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

bestImportFlavor

public java.awt.datatransfer.DataFlavor bestImportFlavor(javax.swing.JComponent c,
                                                         java.awt.datatransfer.DataFlavor[] flavors)
Chooses the best import flavour from the flavors array for importing into c. The current implementation actually just chooses the first acceptable flavour.

Returns:
The first acceptable DataFlavor in the flavors list, or null if no acceptable flavours are present.

canImport

public boolean canImport(javax.swing.JComponent c,
                         java.awt.datatransfer.DataFlavor[] flavors)
This is set up this way because this DropTargetListener was derived from a TransferHandler. It works, so no sense in changing it.



Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca