com.dlsc.flexgantt.policy.layer
Class DefaultDragAndDropPolicy
java.lang.Object
com.dlsc.flexgantt.policy.AbstractPolicy
com.dlsc.flexgantt.policy.layer.DefaultDragAndDropPolicy
- All Implemented Interfaces:
- IPolicy, IDragAndDropPolicy
public class DefaultDragAndDropPolicy
- extends AbstractPolicy
- implements IDragAndDropPolicy
The default implmementation of the drag & drop policy. For a general
description of this policy please refer to the policy interface
IDragAndDropPolicy
.
- Since:
- 1.0
- Author:
- Dirk Lemmermann
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultDragAndDropPolicy
public DefaultDragAndDropPolicy()
getDragActions
public int getDragActions(java.lang.Object node,
java.lang.Object timelineObject,
IGanttChartModel model)
- Description copied from interface:
IDragAndDropPolicy
- 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.
- Specified by:
getDragActions
in interface IDragAndDropPolicy
- Parameters:
node
- the tree node that owns the timeline objecttimelineObject
- the timeline object that has to participate in a drag and drop
operationmodel
- 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
getDropActions
public int getDropActions(java.lang.Object node,
java.lang.Object timelineObject,
IGanttChartModel model,
java.lang.Object newNode,
IGanttChartModel newModel,
long newStartTime)
- Description copied from interface:
IDragAndDropPolicy
- 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.
- Specified by:
getDropActions
in interface IDragAndDropPolicy
- Parameters:
node
- the tree node that owns the timeline objecttimelineObject
- the timeline object that has to participate in a drag and drop
operationmodel
- the data source of the tree node and the timeline objectnewNode
- the tree node that will be the new owner of the timeline
objectnewModel
- the data source of the new tree node ownernewStartTime
- 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
getDragAndDropCommand
public 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)
- Description copied from interface:
IDragAndDropPolicy
- 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.
- Specified by:
getDragAndDropCommand
in interface IDragAndDropPolicy
- Parameters:
node
- the tree node that owns the timeline objectsdroppedTimelineObject
- the timeline object that was dragged and droppedmodel
- the data source of the tree node and the timeline objectsnewNode
- the tree node that will be the new owner of the timeline
objectsnewModel
- the data source of the new tree node ownernewStartTime
- the time point that will be the new start time of the timeline
objecttimelineObjects
- the timeline objects that might have to participate in a drag
and drop operation because they were selected at the same timelayer
- the layer on which the drag and drop operation takes placedropAction
- 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