com.dlsc.flexgantt.swing.treetable

## Class TreeTableDragAndDropManager

- java.lang.Object
- - com.dlsc.flexgantt.swing.treetable.TreeTableDragAndDropManager

- All Implemented Interfaces:
    ICommandStackListener, DragGestureListener, DragSourceListener, DropTargetListener, PropertyChangeListener, EventListener

      public class TreeTableDragAndDropManager
      extends Object
      implements DragSourceListener, DropTargetListener, DragGestureListener, ICommandStackListener, PropertyChangeListener

  A manager for the tree table that deals with anything related to drag and drop operations within or between tree tables. The manager listens for drag gestures, drag source events, and drop target events.
  Since:
    1.0
  Version:
    $Revision: 1.8 $
  Author:
    Dirk Lemmermann
  See Also:
    `INodeDragAndDropPolicy.getDragActions(Object, ITreeTableModel)`, `INodeDragAndDropPolicy.getDropActions(Object, Object, ITreeTableModel, Object, ITreeTableModel)`, `INodeDragAndDropPolicy.getDragAndDropCommand(Object, Object, ITreeTableModel, int, Object, ITreeTableModel, int, int)`, `ITreeTableNode.getDragActions()`, `ITreeTableNode.getDropActions(ITreeTableNode)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TreeTableDragAndDropManager(TreeTable table)` Constructs a new drag and drop manager for the given table.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `commandStackChanged(CommandStackEvent e)` Gets called whenever the command stack changed.
    `protected Image` | `createDragImage(TreeTableNode node)` Creates a drag image for the given tree table node.
    `void` | `dragDropEnd(DragSourceDropEvent e)`
    `void` | `dragEnter(DragSourceDragEvent e)`
    `void` | `dragEnter(DropTargetDragEvent dtde)`
    `void` | `dragExit(DragSourceEvent dse)`
    `void` | `dragExit(DropTargetEvent dte)`
    `void` | `dragGestureRecognized(DragGestureEvent dge)`
    `void` | `dragOver(DragSourceDragEvent dsde)`
    `void` | `dragOver(DropTargetDragEvent dtde)`
    `void` | `drop(DropTargetDropEvent dtde)`
    `void` | `dropActionChanged(DragSourceDragEvent dsde)`
    `void` | `dropActionChanged(DropTargetDragEvent dtde)`
    `TreeTableNode` | `getDraggedNode()` Returns the dragged tree table node.
    `Point` | `getDragLocation()` Returns the current drag location.
    `int` | `getDropRow()` Returns the row where the drop will occure when the user finishes the drop.
    `TreeTable` | `getTreeTable()` Returns the tree table that is being managed by the DnD manager.
    `boolean` | `isDragOK(DropTargetDragEvent dtde)` Performs all the necessary checks in order to find out whether the given drop target event specifies a valid drop location.
    `boolean` | `isValidDropLocation()` Determines whether the current drag location is a valid drop location.
    `void` | `propertyChange(PropertyChangeEvent evt)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TreeTableDragAndDropManager

          public TreeTableDragAndDropManager(TreeTable table)

      Constructs a new drag and drop manager for the given table.
      Parameters:
        `table` - the table that will be managed
      Since:
        1.0

  - ### Method Detail

    - #### getTreeTable

          public TreeTable getTreeTable()

      Returns the tree table that is being managed by the DnD manager.
      Returns:
        the managed tree table
      Since:
        1.0

    - #### dragEnter

          public void dragEnter(DragSourceDragEvent e)

      Specified by:
        `dragEnter` in interface `DragSourceListener`

    - #### dragOver

          public void dragOver(DragSourceDragEvent dsde)

      Specified by:
        `dragOver` in interface `DragSourceListener`

    - #### dropActionChanged

          public void dropActionChanged(DragSourceDragEvent dsde)

      Specified by:
        `dropActionChanged` in interface `DragSourceListener`

    - #### dragExit

          public void dragExit(DragSourceEvent dse)

      Specified by:
        `dragExit` in interface `DragSourceListener`

    - #### dragDropEnd

          public void dragDropEnd(DragSourceDropEvent e)

      Specified by:
        `dragDropEnd` in interface `DragSourceListener`

    - #### 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`

    - #### dragExit

          public void dragExit(DropTargetEvent dte)

      Specified by:
        `dragExit` in interface `DropTargetListener`

    - #### drop

          public void drop(DropTargetDropEvent dtde)

      Specified by:
        `drop` in interface `DropTargetListener`

    - #### dragGestureRecognized

          public void dragGestureRecognized(DragGestureEvent dge)

      Specified by:
        `dragGestureRecognized` in interface `DragGestureListener`

    - #### getDropRow

          public int getDropRow()

      Returns the row where the drop will occure when the user finishes the drop.
      Returns:
        the drop row
      Since:
        1.0

    - #### getDraggedNode

          public TreeTableNode getDraggedNode()

      Returns the dragged tree table node.
      Returns:
        the dragged node
      Since:
        1.0

    - #### getDragLocation

          public Point getDragLocation()

      Returns the current drag location.
      Returns:
        the drag location
      Since:
        1.0

    - #### createDragImage

          protected Image createDragImage(TreeTableNode node)

      Creates a drag image for the given tree table node. Some operating systems (e.g. MacOS X) support drag images that are shown at the cursor location during a drag and drop operation. Usually the image shows the dragged object. This method will look up the standard renderer for the key value of the dragged node. The renderer will be invoked with `Integer.MIN_VALUE` for the column index so that the renderer knows that it is rendering the drag image.
      Parameters:
        `node` - the node that is being dragged
      Returns:
        an image representation of the dragged node
      Since:
        1.0
      See Also:
        `DragSource.isDragImageSupported()`

    - #### commandStackChanged

          public void commandStackChanged(CommandStackEvent e)

      Description copied from interface: `ICommandStackListener`
      Gets called whenever the command stack changed. The event object that is passed to this method contains information about the type of event and a reference to the command that caused the event.
      Specified by:
        `commandStackChanged` in interface `ICommandStackListener`
      Parameters:
        `e` - the event issued by the command stack

    - #### propertyChange

          public void propertyChange(PropertyChangeEvent evt)

      Specified by:
        `propertyChange` in interface `PropertyChangeListener`

    - #### isDragOK

          public boolean isDragOK(DropTargetDragEvent dtde)

      Performs all the necessary checks in order to find out whether the given drop target event specifies a valid drop location. The method will return FALSE if the drop row equals -1, if the dragged node equals the node at the drop location, or if the user drop action is not supported by the drop location.
      Parameters:
        `dtde` - the drop target drag event
      Returns:
        TRUE if the drag is OK and the node can be dropped
      Since:
        1.0

    - #### isValidDropLocation

          public boolean isValidDropLocation()

      Determines whether the current drag location is a valid drop location. The tree table can use this information to provide visual feedback about the validity of a drag location.
      Returns:
        TRUE if the current drag location is a valid drop location
      Since:
        1.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.