com.dlsc.flexgantt.policy.layer
Interface IDragAndDropPolicy

All Superinterfaces:
IPolicy
All Known Implementing Classes:
DefaultDragAndDropPolicy

public interface IDragAndDropPolicy
extends IPolicy

A policy used in the context of drag & drop operations related to timeline objects. The policy determines which objects can be dragged and where they can be dropped. Additionally it provides the command objects that will perform the actual drag & drop (removing the timeline object from one node and adding it to another if the user attempts a reassignment, changing the time span if the user attempts a simple move).

Since:
1.0
Author:
Dirk Lemmermann
See Also:
DefaultDragAndDropCommand

Method Summary
 int getDragActions(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model)
          Determines how the given timeline object can be dragged (copy, move, copy or move, none).
 ICommand getDragAndDropCommand(java.lang.Object node, java.lang.Object droppedTimelineObject, IGanttChartModel model, java.lang.Object newNode, IGanttChartModel newModel, long newStartTime, java.lang.Object[] timelineObjects, ILayer layer, int dropAction)
          Returns a command object that will be used to make the necessary modifications to the models when the user dragged several timeline objects from one row to another at the same time.
 int getDropActions(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model, java.lang.Object newNode, IGanttChartModel newModel, long newStartTime)
          Determines whether the new location as specified by the new tree node, new model and new time span can be used as a drop location for the given timeline object.
 

Method Detail

getDragActions

int getDragActions(java.lang.Object node,
                   java.lang.Object timelineObject,
                   IGanttChartModel model)
Determines how the given timeline object 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 tree node that owns the timeline object
timelineObject - the timeline object that has to participate in a drag and drop operation
model - the data source of the tree node and the timeline object
Returns:
a drag and drop constant, which specifies what kind of drag and drop operations can be performed
Since:
1.0

getDropActions

int getDropActions(java.lang.Object node,
                   java.lang.Object timelineObject,
                   IGanttChartModel model,
                   java.lang.Object newNode,
                   IGanttChartModel newModel,
                   long newStartTime)
Determines whether the new location as specified by the new tree node, new model and new time span can be used as a drop location for the given timeline object.

Parameters:
node - the tree node that owns the timeline object
timelineObject - the timeline object that has to participate in a drag and drop operation
model - the data source of the tree node and the timeline object
newNode - the tree node that will be the new owner of the timeline object
newModel - the data source of the new tree node owner
newStartTime - the time point that will be the new start time of the timeline object
Returns:
a drag and drop action, which specifies what kind of drop operation can be performed on the given node and time point (possible values are defined in DnDConstants
Since:
1.0

getDragAndDropCommand

ICommand getDragAndDropCommand(java.lang.Object node,
                               java.lang.Object droppedTimelineObject,
                               IGanttChartModel model,
                               java.lang.Object newNode,
                               IGanttChartModel newModel,
                               long newStartTime,
                               java.lang.Object[] timelineObjects,
                               ILayer layer,
                               int dropAction)
Returns a command object that will be used to make the necessary modifications to the models when the user dragged several timeline objects from one row to another at the same time.

Parameters:
node - the tree node that owns the timeline objects
droppedTimelineObject - the timeline object that was dragged and dropped
model - the data source of the tree node and the timeline objects
newNode - the tree node that will be the new owner of the timeline objects
newModel - the data source of the new tree node owner
newStartTime - the time point that will be the new start time of the timeline object
timelineObjects - the timeline objects that might have to participate in a drag and drop operation because they were selected at the same time
layer - the layer on which the drag and drop operation takes place
dropAction - an value used to distinguish between different types of drop operations (possible values listed in DnDConstants
Returns:
a command object that has to make the necessary model changes
Since:
1.0