antsnest.datatransfer
Class BuildTreeTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by antsnest.datatransfer.BuildTreeTransferHandler
All Implemented Interfaces:
Serializable

public class BuildTreeTransferHandler
extends TransferHandler

The handler that sets up data transfer on the build tree

Author:
Chris Clohosy
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
BuildTreeTransferHandler()
          Constructs a new handler
 
Method Summary
 boolean canImport(JComponent c, DataFlavor[] flavors)
          Tells whether a component can accept a data drop
protected  Transferable createTransferable(JComponent c)
          Creates a transferable from a list
 void exportAsDrag(JComponent c, InputEvent e, int action)
          Called when the transfer begins
 void exportDone(JComponent c, Transferable data, int action)
          Called when the data has been transferred
 int getSourceActions(JComponent c)
          Informs what transfer actions are supported
 boolean importData(JComponent c, Transferable trans)
          Does the importing of the data into the tree
 
Methods inherited from class javax.swing.TransferHandler
exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildTreeTransferHandler

public BuildTreeTransferHandler()
Constructs a new handler

Method Detail

exportAsDrag

public void exportAsDrag(JComponent c,
                         InputEvent e,
                         int action)
Called when the transfer begins

Overrides:
exportAsDrag in class TransferHandler
Parameters:
c - the component being dragged from
e - the event that triggered the transfer
action - the kind of transfer occuring

exportDone

public void exportDone(JComponent c,
                       Transferable data,
                       int action)
Called when the data has been transferred

Overrides:
exportDone in class TransferHandler
Parameters:
c - the component that was dragged from
data - the data that was transferred
action - the kind of transfer occuring

createTransferable

protected Transferable createTransferable(JComponent c)
Creates a transferable from a list

Overrides:
createTransferable in class TransferHandler
Parameters:
c - the list that holds the Ant attributes
Returns:
a Transferable, the class that handles the data transfer

getSourceActions

public int getSourceActions(JComponent c)
Informs what transfer actions are supported

Overrides:
getSourceActions in class TransferHandler
Parameters:
c - the component using this handler
Returns:
an int, the actions supported

canImport

public boolean canImport(JComponent c,
                         DataFlavor[] flavors)
Tells whether a component can accept a data drop

Overrides:
canImport in class TransferHandler
Parameters:
c - the component receiving the drop
flavors - the data flavors the drop can come in
Returns:
a boolean, whether it can accept the drop

importData

public boolean importData(JComponent c,
                          Transferable trans)
Does the importing of the data into the tree

Overrides:
importData in class TransferHandler
Parameters:
c - the component receiving the drop
trans - the transferable encapsulating the data
Returns:
a boolean, whether the drop was successful