Package org.apache.batik.apps.svgbrowser
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 int
Insert node after the current node.private static final int
Insert node before the current node.private static final int
Insert node as a child of the current node.private TreePath
The tree path that is being dragged over.private Point
The end point of the 'visual tip' line.private Timer
The timer that controls the delay of expanding the tree path that is being dragged over.private int
The delay for expanding.private Component
The original glass pane of the tree is stored here.private int
Indicates the potential drop position relative to the current node where the dragged nodes are to be inserted.private Point
The start point of the 'visual tip' line.private DOMDocumentTree.TransferData
The associated transfer data.private TreePath
The tree path that is scheduled for expand.protected JPanel
Glasspane where 'visual tip' line is drawnprivate int
The vertical offset where to catch the 'visual tips' of the tree node items rectangle.private int
The thickness of the visual tip. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Adds the onAutoscroll listener.void
dragEnter
(DropTargetDragEvent dtde) void
dragExit
(DropTargetEvent dte) void
dragOver
(DropTargetDragEvent dtde) void
drop
(DropTargetDropEvent dtde) void
private Timer
getExpandTreeTimer
(JTree tree) Gets the timer for treepath expand.private TreeNode
getNode
(DropTargetDragEvent dtde) Gets the TreeNode from the DropTargetDragEventprivate TreeNode
getNodeForPath
(TreePath path) Gets the TreeNode from the given TreePath.private TreePath
getParentPathForPosition
(TreePath currentPath) Finds the parent TreePath of the given current path, according to the position indicator, where the dragged nodes should be appended.private TreePath
getSiblingPathForPosition
(TreePath currentPath) Finds the TreePath that is going to be next sibling to the nodes that are being dragged.private void
scheduleExpand
(TreePath treePath, JTree tree) Schedules the expand of the given treePath on a tree.private void
setOriginalGlassPane
(JTree tree) Sets the original glass pane.private void
Sets the position indicator according to the current cursor location.private void
updateVisualTipLine
(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:
dragEnter
in interfaceDropTargetListener
-
dragOver
- Specified by:
dragOver
in interfaceDropTargetListener
-
dropActionChanged
- Specified by:
dropActionChanged
in interfaceDropTargetListener
-
drop
- Specified by:
drop
in interfaceDropTargetListener
-
dragExit
- Specified by:
dragExit
in 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
Finds the TreePath that is going to be next sibling to the nodes that are being dragged.- Parameters:
currentPath
- The current path (the items are dragged over this path)- Returns:
- sibling TreePath
-
getNodeForPath
Gets the TreeNode from the given TreePath.- Parameters:
path
- The given TreePath- Returns:
- The TreeNode
-
getNode
Gets the TreeNode from the DropTargetDragEvent- Parameters:
dtde
- The DropTargetDragEvent- Returns:
- Associated TreeNode or null
-
updateVisualTipLine
Draws the 'visual tip' line on the glass pane.- Parameters:
tree
- The treepath
- The path to get the bounds
-
addOnAutoscrollListener
Adds the onAutoscroll listener.- Parameters:
tree
- The DOMDocumentTree
-
setOriginalGlassPane
Sets the original glass pane.- Parameters:
dte
- DropTargetEvent to get the tree
-
scheduleExpand
Schedules the expand of the given treePath on a tree.- Parameters:
treePath
- The treePath to expandtree
- The JTree
-
getExpandTreeTimer
Gets the timer for treepath expand.- Parameters:
tree
- The JTree- Returns:
- Timer
-