treebolic.generator.tree
Class TreeTransferHandler
java.lang.Object
javax.swing.TransferHandler
treebolic.generator.tree.TreeTransferHandler
- All Implemented Interfaces:
- java.io.Serializable
public class TreeTransferHandler
- extends javax.swing.TransferHandler
Transfer handler for drag and drop operations
- Author:
- Bernard Bou
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.TransferHandler |
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport |
| Fields inherited from class javax.swing.TransferHandler |
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
|
Method Summary |
boolean |
canImport(javax.swing.TransferHandler.TransferSupport thisSupport)
|
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent thisSourceComponent)
|
protected void |
exportDone(javax.swing.JComponent thisComponent,
java.awt.datatransfer.Transferable data,
int action)
|
private Pair<javax.swing.tree.TreePath,javax.swing.tree.TreePath> |
getNodes(javax.swing.TransferHandler.TransferSupport thisSupport)
Get pair of source tree and destination treepaths |
int |
getSourceActions(javax.swing.JComponent c)
|
boolean |
importData(javax.swing.TransferHandler.TransferSupport thisSupport)
|
private boolean |
move(Tree thisTree,
javax.swing.tree.TreePath thisSource,
javax.swing.tree.TreePath thisDestination)
Move source node as child of destination node |
private boolean |
testMove(javax.swing.tree.TreePath thisSource,
javax.swing.tree.TreePath thisDestination)
Whether source node can drag and drop to destination node |
| 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 |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
theFlavor
private static java.awt.datatransfer.DataFlavor theFlavor
- Data flavour
TreeTransferHandler
public TreeTransferHandler()
getSourceActions
public int getSourceActions(javax.swing.JComponent c)
- Overrides:
getSourceActions in class javax.swing.TransferHandler
createTransferable
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent thisSourceComponent)
- Overrides:
createTransferable in class javax.swing.TransferHandler
canImport
public boolean canImport(javax.swing.TransferHandler.TransferSupport thisSupport)
- Overrides:
canImport in class javax.swing.TransferHandler
importData
public boolean importData(javax.swing.TransferHandler.TransferSupport thisSupport)
- Overrides:
importData in class javax.swing.TransferHandler
exportDone
protected void exportDone(javax.swing.JComponent thisComponent,
java.awt.datatransfer.Transferable data,
int action)
- Overrides:
exportDone in class javax.swing.TransferHandler
getNodes
private Pair<javax.swing.tree.TreePath,javax.swing.tree.TreePath> getNodes(javax.swing.TransferHandler.TransferSupport thisSupport)
- Get pair of source tree and destination treepaths
- Parameters:
thisSupport - transfer support
- Returns:
- source tree and destination treepaths
testMove
private boolean testMove(javax.swing.tree.TreePath thisSource,
javax.swing.tree.TreePath thisDestination)
- Whether source node can drag and drop to destination node
- Parameters:
thisSource - source nodethisDestination - destination node
- Returns:
- true if source node can drag and drop to destination node
move
private boolean move(Tree thisTree,
javax.swing.tree.TreePath thisSource,
javax.swing.tree.TreePath thisDestination)
- Move source node as child of destination node
- Parameters:
thisSource - source nodethisDestination - destination node
- Returns:
- true if successful