Class DOMDocumentTree.TreeDropTargetListener

java.lang.Object
org.apache.batik.apps.svgbrowser.DOMDocumentTree.TreeDropTargetListener
All Implemented Interfaces:
DropTargetListener, EventListener
Enclosing class:
DOMDocumentTree

public class DOMDocumentTree.TreeDropTargetListener extends Object implements DropTargetListener
Tree as a drop target listener.
  • Field Details

    • BEFORE

      private static final int BEFORE
      Insert node before the current node.
      See Also:
    • AFTER

      private static final int AFTER
      Insert node after the current node.
      See Also:
    • CURRENT

      private static final int CURRENT
      Insert node as a child of the current node.
      See Also:
    • transferData

      private DOMDocumentTree.TransferData transferData
      The associated transfer data.
    • originalGlassPane

      private Component originalGlassPane
      The original glass pane of the tree is stored here.
    • visualTipOffset

      private int visualTipOffset
      The vertical offset where to catch the 'visual tips' of the tree node items rectangle.
    • visualTipThickness

      private int visualTipThickness
      The thickness of the visual tip.
    • positionIndicator

      private int positionIndicator
      Indicates the potential drop position relative to the current node where the dragged nodes are to be inserted.
    • startPoint

      private Point startPoint
      The start point of the 'visual tip' line.
    • endPoint

      private Point endPoint
      The end point of the 'visual tip' line.
    • visualTipGlassPane

      protected JPanel visualTipGlassPane
      Glasspane where 'visual tip' line is drawn
    • expandControlTimer

      private Timer expandControlTimer
      The timer that controls the delay of expanding the tree path that is being dragged over.
    • expandTimeout

      private int expandTimeout
      The delay for expanding.
    • dragOverTreePath

      private TreePath dragOverTreePath
      The tree path that is being dragged over.
    • treePathToExpand

      private TreePath treePathToExpand
      The tree path that is scheduled for expand.
  • Constructor Details

    • TreeDropTargetListener

      public TreeDropTargetListener(DOMDocumentTree tree)
      Constructor.
  • Method Details

    • dragEnter

      public void dragEnter(DropTargetDragEvent dtde)
      Specified by:
      dragEnter in interface DropTargetListener
    • dragOver

      public void dragOver(DropTargetDragEvent dtde)
      Specified by:
      dragOver in interface DropTargetListener
    • dropActionChanged

      public void dropActionChanged(DropTargetDragEvent dtde)
      Specified by:
      dropActionChanged in interface DropTargetListener
    • drop

      public void drop(DropTargetDropEvent dtde)
      Specified by:
      drop in interface DropTargetListener
    • dragExit

      public void dragExit(DropTargetEvent dte)
      Specified by:
      dragExit in interface DropTargetListener
    • updatePositionIndicator

      private void updatePositionIndicator(DropTargetDragEvent dtde)
      Sets the position indicator according to the current cursor location.
      Parameters:
      dtde - DropTargetDragEvent
    • getParentPathForPosition

      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.
      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

      private TreePath getSiblingPathForPosition(TreePath currentPath)
      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

      private TreeNode getNodeForPath(TreePath path)
      Gets the TreeNode from the given TreePath.
      Parameters:
      path - The given TreePath
      Returns:
      The TreeNode
    • getNode

      private TreeNode getNode(DropTargetDragEvent dtde)
      Gets the TreeNode from the DropTargetDragEvent
      Parameters:
      dtde - The DropTargetDragEvent
      Returns:
      Associated TreeNode or null
    • updateVisualTipLine

      private void updateVisualTipLine(JTree tree, TreePath path)
      Draws the 'visual tip' line on the glass pane.
      Parameters:
      tree - The tree
      path - The path to get the bounds
    • addOnAutoscrollListener

      private void addOnAutoscrollListener(DOMDocumentTree tree)
      Adds the onAutoscroll listener.
      Parameters:
      tree - The DOMDocumentTree
    • setOriginalGlassPane

      private void setOriginalGlassPane(JTree tree)
      Sets the original glass pane.
      Parameters:
      dte - DropTargetEvent to get the tree
    • scheduleExpand

      private void scheduleExpand(TreePath treePath, JTree tree)
      Schedules the expand of the given treePath on a tree.
      Parameters:
      treePath - The treePath to expand
      tree - The JTree
    • getExpandTreeTimer

      private Timer getExpandTreeTimer(JTree tree)
      Gets the timer for treepath expand.
      Parameters:
      tree - The JTree
      Returns:
      Timer