y.view.hierarchy
Class HierarchyTreeTransferHandler
java.lang.Object
javax.swing.TransferHandler
y.view.hierarchy.HierarchyTreeTransferHandler
- All Implemented Interfaces:
- Serializable
public class HierarchyTreeTransferHandler
- extends 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
| 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 Transferable createTransferable(JComponent c)
- Overrides:
createTransferable in class TransferHandler
getSourceActions
public int getSourceActions(JComponent c)
- Returns
TransferHandler.MOVE.
- Overrides:
getSourceActions in class TransferHandler
importData
public boolean importData(JComponent c,
Transferable t)
- Overrides:
importData in class TransferHandler
canImport
public boolean canImport(JComponent c,
DataFlavor[] flavors)
- Overrides:
canImport in class TransferHandler