Class DOMDocumentTree.TreeDropTargetListener
java.lang.Object
org.apache.batik.apps.svgbrowser.DOMDocumentTree.TreeDropTargetListener
- All Implemented Interfaces:
DropTargetListener, EventListener
- Enclosing class:
DOMDocumentTree
Tree as a drop target listener.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intInsert node after the current node.private static final intInsert node before the current node.private static final intInsert node as a child of the current node.private TreePathThe tree path that is being dragged over.private PointThe end point of the 'visual tip' line.private TimerThe timer that controls the delay of expanding the tree path that is being dragged over.private intThe delay for expanding.private ComponentThe original glass pane of the tree is stored here.private intIndicates the potential drop position relative to the current node where the dragged nodes are to be inserted.private PointThe start point of the 'visual tip' line.private DOMDocumentTree.TransferDataThe associated transfer data.private TreePathThe tree path that is scheduled for expand.protected JPanelGlasspane where 'visual tip' line is drawnprivate intThe vertical offset where to catch the 'visual tips' of the tree node items rectangle.private intThe thickness of the visual tip. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidAdds the onAutoscroll listener.voiddragEnter(DropTargetDragEvent dtde) voiddragExit(DropTargetEvent dte) voiddragOver(DropTargetDragEvent dtde) voiddrop(DropTargetDropEvent dtde) voidprivate TimergetExpandTreeTimer(JTree tree) Gets the timer for treepath expand.private TreeNodegetNode(DropTargetDragEvent dtde) Gets the TreeNode from the DropTargetDragEventprivate TreeNodegetNodeForPath(TreePath path) Gets the TreeNode from the given TreePath.private TreePathgetParentPathForPosition(TreePath currentPath) Finds the parent TreePath of the given current path, according to the position indicator, where the dragged nodes should be appended.private TreePathgetSiblingPathForPosition(TreePath currentPath) Finds the TreePath that is going to be next sibling to the nodes that are being dragged.private voidscheduleExpand(TreePath treePath, JTree tree) Schedules the expand of the given treePath on a tree.private voidsetOriginalGlassPane(JTree tree) Sets the original glass pane.private voidSets the position indicator according to the current cursor location.private voidupdateVisualTipLine(JTree tree, TreePath path) Draws the 'visual tip' line on the glass pane.
-
Field Details
-
BEFORE
private static final int BEFOREInsert node before the current node.- See Also:
-
AFTER
private static final int AFTERInsert node after the current node.- See Also:
-
CURRENT
private static final int CURRENTInsert node as a child of the current node.- See Also:
-
transferData
The associated transfer data. -
originalGlassPane
The original glass pane of the tree is stored here. -
visualTipOffset
private int visualTipOffsetThe vertical offset where to catch the 'visual tips' of the tree node items rectangle. -
visualTipThickness
private int visualTipThicknessThe thickness of the visual tip. -
positionIndicator
private int positionIndicatorIndicates the potential drop position relative to the current node where the dragged nodes are to be inserted. -
startPoint
The start point of the 'visual tip' line. -
endPoint
The end point of the 'visual tip' line. -
visualTipGlassPane
Glasspane where 'visual tip' line is drawn -
expandControlTimer
The timer that controls the delay of expanding the tree path that is being dragged over. -
expandTimeout
private int expandTimeoutThe delay for expanding. -
dragOverTreePath
The tree path that is being dragged over. -
treePathToExpand
The tree path that is scheduled for expand.
-
-
Constructor Details
-
TreeDropTargetListener
Constructor.
-
-
Method Details
-
dragEnter
- Specified by:
dragEnterin interfaceDropTargetListener
-
dragOver
- Specified by:
dragOverin interfaceDropTargetListener
-
dropActionChanged
- Specified by:
dropActionChangedin interfaceDropTargetListener
-
drop
- Specified by:
dropin interfaceDropTargetListener
-
dragExit
- Specified by:
dragExitin interfaceDropTargetListener
-
updatePositionIndicator
Sets the position indicator according to the current cursor location.- Parameters:
dtde- DropTargetDragEvent
-
getParentPathForPosition
Finds the parent TreePath of the given current path, according to the position indicator, where the dragged nodes should be appended.- Parameters:
currentPath- The current path (the items are dragged over this path)positionIndicator- AFTER or BEFORE - nodes should be appended to the parent path of the given path, as siblings of the current path CURRENT - nodes should be appended to the current path, as its children- Returns:
- TreePath where dragged nodes are to be inserted
-
getSiblingPathForPosition
-
getNodeForPath
-
getNode
Gets the TreeNode from the DropTargetDragEvent- Parameters:
dtde- The DropTargetDragEvent- Returns:
- Associated TreeNode or null
-
updateVisualTipLine
-
addOnAutoscrollListener
Adds the onAutoscroll listener.- Parameters:
tree- The DOMDocumentTree
-
setOriginalGlassPane
Sets the original glass pane.- Parameters:
dte- DropTargetEvent to get the tree
-
scheduleExpand
-
getExpandTreeTimer
-