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
  Version:
    $Revision: 1.13 $
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultDragAndDropPolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDragActions(TimelineObjectPath path, IGanttChartModel model)` Determines how the given timeline object can be dragged (copy, move, copy or move, none).
    `ICommand` | `getDragAndDropCommand(TimelineObjectPath path, IGanttChartModel model, Object newNode, IGanttChartModel newModel, long newStartTime, 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(TimelineObjectPath path, IGanttChartModel model, 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 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

    - #### DefaultDragAndDropPolicy

          public DefaultDragAndDropPolicy()

  - ### Method Detail

    - #### getDragActions

          public int getDragActions(TimelineObjectPath path,
                                    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:
        `path` - the path to 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

    - #### getDropActions

          public int getDropActions(TimelineObjectPath path,
                                    IGanttChartModel model,
                                    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:
        `path` - the path to 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`

    - #### getDragAndDropCommand

          public ICommand getDragAndDropCommand(TimelineObjectPath path,
                                                IGanttChartModel model,
                                                Object newNode,
                                                IGanttChartModel newModel,
                                                long newStartTime,
                                                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:
        `path` - the path to 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

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.