com.dlsc.flexgantt.policy.treetable
Class DefaultNodeDragAndDropPolicy
java.lang.Object
com.dlsc.flexgantt.policy.AbstractPolicy
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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultNodeDragAndDropPolicy
public DefaultNodeDragAndDropPolicy()
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 capabilitymodel
- 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 nodedraggedNodeParent
- the parent to which the dragged node belongsdraggedNodeModel
- the model to which the node belongsnewParentNode
- the candidate node for being the new parent of the dragged
nodenewModel
- 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 nodeoldParent
- the parent to which the dragged node belongsoldModel
- the model to which the node belongsoldChildIndex
- the location of the dragged node inside the list of children
nodes of its current parentnewParent
- the candidate node for being the new parent of the dragged
nodenewModel
- the model to which the new parent belongsnewChildIndex
- the location of the dragged node inside the list of children
nodes of its new parentdropAction
- 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