antsnest.datatransfer
Class AttributeListTransferHandler

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

public class AttributeListTransferHandler
extends TransferHandler

The handler that sets up data transfer on the attribute list

Author:
Chris Clohosy
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
AttributeListTransferHandler()
          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
 int getSourceActions(JComponent c)
          Informs what transfer actions are supported
 boolean importData(JComponent c, Transferable trans)
          Does the importing of the data into the list
 
Methods inherited from class javax.swing.TransferHandler
exportAsDrag, exportDone, 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

AttributeListTransferHandler

public AttributeListTransferHandler()
Constructs a new handler

Method Detail

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 list

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