com.dlsc.flexgantt.policy.treetable
Interface INodeDragAndDropPolicy

All Superinterfaces:
IPolicy
All Known Implementing Classes:
DefaultNodeDragAndDropPolicy

public interface INodeDragAndDropPolicy
extends IPolicy

A policy used for controlling the drag & drop operations within the tree table. A tree node has to be a drag source in order to be draggable. The node on which the user wants to drop the node has to be a possible drop target for the dragged node.

Since:
1.0
Author:
Dirk Lemmermann

Method Summary
 int getDragActions(java.lang.Object node, ITreeTableModel model)
          Determines how the given node can be dragged (copy, move, copy or move, none).
 ICommand getDragAndDropCommand(java.lang.Object droppedNode, java.lang.Object oldParent, ITreeTableModel oldModel, int oldChildIndex, java.lang.Object newParent, ITreeTableModel newModel, int newChildIndex, int dropAction)
          Returns the command object that will perform the actual changes required in order to detach the node from its current parent and attach it to its new parent.
 int getDropActions(java.lang.Object draggedNode, java.lang.Object draggedNodeParent, ITreeTableModel draggedNodeModel, java.lang.Object newParentNode, ITreeTableModel newModel)
          Determines how the given dragged node can be dropped onto the given new parent node (copy, move, copy or move, none).
 

Method Detail

getDragActions

int getDragActions(java.lang.Object node,
                   ITreeTableModel model)
Determines how the given node can be dragged (copy, move, copy or move, none). The possible values for the return value are defined as constants in the DnDConstants class.

Parameters:
node - the node to check for its drag capability
model - the model to which the node belongs
Returns:
one or more drag action identifiers (possible values listed in DnDConstants)
Since:
1.0

getDropActions

int getDropActions(java.lang.Object draggedNode,
                   java.lang.Object draggedNodeParent,
                   ITreeTableModel draggedNodeModel,
                   java.lang.Object newParentNode,
                   ITreeTableModel newModel)
Determines how the given dragged node can be dropped onto the given new parent node (copy, move, copy or move, none). The possible values for the dragActions argument and the return value are defined as constants in the DnDConstants class.

Parameters:
draggedNode - the dragged node
draggedNodeParent - the parent to which the dragged node belongs
draggedNodeModel - the model to which the node belongs
newParentNode - the candidate node for being the new parent of the dragged node
newModel - the model to which the new parent belongs
Returns:
one or more drop action identifiers (possible values listed in DnDConstants)
Since:
1.0

getDragAndDropCommand

ICommand getDragAndDropCommand(java.lang.Object droppedNode,
                               java.lang.Object oldParent,
                               ITreeTableModel oldModel,
                               int oldChildIndex,
                               java.lang.Object newParent,
                               ITreeTableModel newModel,
                               int newChildIndex,
                               int dropAction)
Returns the command object that will perform the actual changes required in order to detach the node from its current parent and attach it to its new parent.

Parameters:
droppedNode - the droppedNode node
oldParent - the parent to which the dragged node belongs
oldModel - the model to which the node belongs
oldChildIndex - the location of the dragged node inside the list of children nodes of its current parent
newParent - the candidate node for being the new parent of the dragged node
newModel - the model to which the new parent belongs
newChildIndex - the location of the dragged node inside the list of children nodes of its new parent
dropAction - contains drop action identifier (possible values listed in DnDConstants).
Returns:
the command object that will perform the necessary operations for dropping the dragged node onto the new parent
Since:
1.0