de.uni_tuebingen.sfb.lichtenstein.UI
Class FormulaTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by de.uni_tuebingen.sfb.lichtenstein.UI.FormulaTransferHandler
All Implemented Interfaces:
Serializable

public class FormulaTransferHandler
extends TransferHandler

A transfer handler for formulas. Based on Sun’s Swing DnD tutorial.

Author:
Hendrik Maryns
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport
 
Field Summary
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
 
Constructor Summary
FormulaTransferHandler()
          Initialize the formula transfer handler.
 
Method Summary
 boolean canImport(TransferHandler.TransferSupport info)
          
protected  Transferable createTransferable(JComponent c)
           Puts the selected formulas from the list (c has to be a JList) into a DataHandler as a local JVM object.
protected  void exportDone(JComponent c, Transferable data, int action)
           Remove the formulas moved.
 int getSourceActions(JComponent c)
          
 boolean importData(TransferHandler.TransferSupport info)
           Put the formulas at the drop location in the order of the list.
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormulaTransferHandler

public FormulaTransferHandler()
Initialize the formula transfer handler. Sets the supported flavors. For now these are:

Method Detail

createTransferable

protected Transferable createTransferable(JComponent c)

Puts the selected formulas from the list (c has to be a JList) into a DataHandler as a local JVM object.

Overrides:
createTransferable in class TransferHandler
Parameters:
c - Has to be a JList.

canImport

public boolean canImport(TransferHandler.TransferSupport info)

Overrides:
canImport in class TransferHandler
Returns:
Only drops of Formulas are allowed.

getSourceActions

public int getSourceActions(JComponent c)

Overrides:
getSourceActions in class TransferHandler
Returns:
Support both COPY and MOVE.

importData

public boolean importData(TransferHandler.TransferSupport info)

Put the formulas at the drop location in the order of the list. If the location is invalid, put them at the beginning.

Overrides:
importData in class TransferHandler

exportDone

protected void exportDone(JComponent c,
                          Transferable data,
                          int action)

Remove the formulas moved. Due to a bug in Swing, this method is complex. Simplify it if the bug is fixed.

Overrides:
exportDone in class TransferHandler


© Copyright 2008 Hendrik Maryns   Creative Commons License