y.view.hierarchy
Class HierarchyTreeTransferHandler
java.lang.Object
javax.swing.TransferHandler
y.view.hierarchy.HierarchyTreeTransferHandler
- All Implemented Interfaces:
- java.io.Serializable
public class HierarchyTreeTransferHandler
- extends javax.swing.TransferHandler
A transfer handler for HierarchyJTree
that allows to reorganize the
hierarchical group structure by a drag and drop gesture on the tree elements.
The drag and drop mechanism will allow to drag selected elements and drop them on
another tree element. If the tree element represents the root graph, a group or a folder
node, then the dropped items will be re-parented to that item. If the tree element represents
a regular node, the dropped items will be re-parented to the parent of that regular node.
Usage:
HierarchyJTree tree = new HierarchyJTree(hierarchyManager);
tree.setDragEnabled(true);
tree.setTransferHandler(new HierarchyTreeTransferHandler(hierarchyManager));
- 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.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
|
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
|
int |
getSourceActions(javax.swing.JComponent c)
Returns TransferHandler.MOVE . |
boolean |
importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
|
Methods inherited from class javax.swing.TransferHandler |
canImport, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HierarchyTreeTransferHandler
public HierarchyTreeTransferHandler(HierarchyManager manager)
- Create a new instance of this class.
- Parameters:
manager
- HierarchyManager instance used to organize the nested graph
hierarchy that can be manipulated by this class.
createTransferable
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
- Overrides:
createTransferable
in class javax.swing.TransferHandler
getSourceActions
public int getSourceActions(javax.swing.JComponent c)
- Returns
TransferHandler.MOVE
.
- Overrides:
getSourceActions
in class javax.swing.TransferHandler
importData
public boolean importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
- Overrides:
importData
in class javax.swing.TransferHandler
canImport
public boolean canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
- Overrides:
canImport
in class javax.swing.TransferHandler