com.dlsc.flexgantt.policy.treetable
Class DefaultNodeDragAndDropPolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by com.dlsc.flexgantt.policy.treetable.DefaultNodeDragAndDropPolicy
All Implemented Interfaces:
IPolicy, INodeDragAndDropPolicy

public class DefaultNodeDragAndDropPolicy
extends AbstractPolicy
implements INodeDragAndDropPolicy

The default implementation of the drag and drop policy for tree table nodes. For a general description of the purpose of this policy please refer to INodeDragAndDropPolicy.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultNodeDragAndDropPolicy()
           
 
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).
 
Methods inherited from class com.dlsc.flexgantt.policy.AbstractPolicy
assertClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNodeDragAndDropPolicy

public DefaultNodeDragAndDropPolicy()
Method Detail

getDragActions

public int getDragActions(java.lang.Object node,
                          ITreeTableModel model)
Description copied from interface: INodeDragAndDropPolicy
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.

Specified by:
getDragActions in interface INodeDragAndDropPolicy
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)

getDropActions

public int getDropActions(java.lang.Object draggedNode,
                          java.lang.Object draggedNodeParent,
                          ITreeTableModel draggedNodeModel,
                          java.lang.Object newParentNode,
                          ITreeTableModel newModel)
Description copied from interface: INodeDragAndDropPolicy
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.

Specified by:
getDropActions in interface INodeDragAndDropPolicy
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)

getDragAndDropCommand

public ICommand getDragAndDropCommand(java.lang.Object droppedNode,
                                      java.lang.Object oldParent,
                                      ITreeTableModel oldModel,
                                      int oldChildIndex,
                                      java.lang.Object newParent,
                                      ITreeTableModel newModel,
                                      int newChildIndex,
                                      int dropAction)
Description copied from interface: INodeDragAndDropPolicy
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.

Specified by:
getDragAndDropCommand in interface INodeDragAndDropPolicy
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