com.dlsc.flexgantt.policy.layer

## Class DefaultEditTimelineObjectPolicy

- java.lang.Object
- - com.dlsc.flexgantt.policy.AbstractPolicy
  - - com.dlsc.flexgantt.policy.layer.DefaultEditTimelineObjectPolicy

- All Implemented Interfaces:
    IPolicy, IEditTimelineObjectPolicy

      public class DefaultEditTimelineObjectPolicy
      extends AbstractPolicy
      implements IEditTimelineObjectPolicy

  The default implmementation of the edit policy for timeline objects. For a general description of this policy please refer to the policy interface `IEditTimelineObjectPolicy`.
  Since:
    1.0
  Version:
    $Revision: 1.10 $
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultEditTimelineObjectPolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ICommand` | `getChangeTimeSpanCommand(TimelineObjectPath path, IGanttChartModel model, ITimeSpan span, int dropAction)` Returns a command object that will perform the actual change of the timeline object's time span.
    `ICommand` | `getChangeTimeSpansCommand(IGanttChartModel model, List<TimelineObjectPath> timelineObjects, List<ITimeSpan> timeSpans, int dropAction)` Returns a command object that will perform the actual change of the timeline objects' time spans.
    `ICommand` | `getCreateCommand(Object node, IGanttChartModel model, ILayer layer, ITimeSpan span, int lineIndex)` Returns a command object that will perform the creation of a new timeline object.
    `ICommand` | `getDeleteCommand(IGanttChartModel model, Collection<TimelineObjectPath> timelineObjects)` Returns a command object that will perform the deletion of the given timeline objects.
    `boolean` | `isCreatable(Object node, IGanttChartModel model, ILayer layer, ITimeSpan span)` Decides whether a timeline object can be created for the given node, model, and time span.
    `boolean` | `isDeletable(TimelineObjectPath path, IGanttChartModel model)` Decides whether the timeline object may be deleted.
    `boolean` | `isDurationChangeable(TimelineObjectPath path, IGanttChartModel model)` Decides whether the duration of a timeline object may be edited / changed.
    `boolean` | `isInPlaceEditable(TimelineObjectPath path, IGanttChartModel model)` Decides whether a timeline object can be edited with an editor where the editor is usually an instance of `ITimelineObjectEditor`.
    `boolean` | `isStartTimeChangeable(TimelineObjectPath path, IGanttChartModel model)` Decides whether the start time of a timeline object may be edited / changed.

    - ### 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

    - #### DefaultEditTimelineObjectPolicy

          public DefaultEditTimelineObjectPolicy()

  - ### Method Detail

    - #### isInPlaceEditable

          public boolean isInPlaceEditable(TimelineObjectPath path,
                                           IGanttChartModel model)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Decides whether a timeline object can be edited with an editor where the editor is usually an instance of `ITimelineObjectEditor`.
      Specified by:
        `isInPlaceEditable` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `path` - the path to the timeline object that gets checked for its editing ability
        `model` - the model to which the timeline object belongs
      Returns:
        TRUE if the timeline object may be edited by the user

    - #### isStartTimeChangeable

          public boolean isStartTimeChangeable(TimelineObjectPath path,
                                               IGanttChartModel model)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Decides whether the start time of a timeline object may be edited / changed.
      Specified by:
        `isStartTimeChangeable` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `path` - the path to the timeline object that gets checked for its time span editing ability
        `model` - the model to which the timeline object belongs
      Returns:
        TRUE if the start time of the timeline object may be edited

    - #### isDurationChangeable

          public boolean isDurationChangeable(TimelineObjectPath path,
                                              IGanttChartModel model)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Decides whether the duration of a timeline object may be edited / changed.
      Specified by:
        `isDurationChangeable` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `path` - the path to the timeline object that gets checked for its time span editing ability
        `model` - the model to which the timeline object belongs
      Returns:
        TRUE if the duration of the timeline object may be edited

    - #### isCreatable

          public boolean isCreatable(Object node,
                                     IGanttChartModel model,
                                     ILayer layer,
                                     ITimeSpan span)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Decides whether a timeline object can be created for the given node, model, and time span.
      Specified by:
        `isCreatable` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `node` - the tree node that will own the new timeline object
        `model` - the model to which the timeline object will be added
        `layer` - the layer where the timeline object will be added
        `span` - the time span where the new timeline object shall be created
      Returns:
        TRUE if the eventline object may be deleted

    - #### isDeletable

          public boolean isDeletable(TimelineObjectPath path,
                                     IGanttChartModel model)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Decides whether the timeline object may be deleted.
      Specified by:
        `isDeletable` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `path` - the path to the timeline object that gets checked
        `model` - the model to which the timeline object belongs
      Returns:
        TRUE if the eventline object may be deleted

    - #### getChangeTimeSpanCommand

          public ICommand getChangeTimeSpanCommand(TimelineObjectPath path,
                                                   IGanttChartModel model,
                                                   ITimeSpan span,
                                                   int dropAction)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Returns a command object that will perform the actual change of the timeline object's time span.
      Specified by:
        `getChangeTimeSpanCommand` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `path` - the path to the timeline object that receives a new time span
        `model` - the data source of the tree node and the timeline object
        `span` - the new time span for the timeline object
        `dropAction` - the type of drag that was executed by the user (COPY or MOVE, the possible values are listed in `DnDConstants`).
      Returns:
        a command that will modify the timeline object's time span

    - #### getChangeTimeSpansCommand

          public ICommand getChangeTimeSpansCommand(IGanttChartModel model,
                                                    List<TimelineObjectPath> timelineObjects,
                                                    List<ITimeSpan> timeSpans,
                                                    int dropAction)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Returns a command object that will perform the actual change of the timeline objects' time spans. The command must be capable of changing the time spans of several timeline objects at the same time. The list of timeline objects and the list of time spans are in synch, which means that the first timeline object in the list of timeline objects belongs to the first time span in the list of time spans.
      Specified by:
        `getChangeTimeSpansCommand` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `model` - the data source of the tree node and the timeline object
        `timelineObjects` - the timeline objects that receives the new time span
        `timeSpans` - the new time spans for the timeline objects
        `dropAction` - the type of drag that was executed by the user (COPY or MOVE, the possible values are listed in `DnDConstants`).
      Returns:
        a command that will modify the timeline object's time span

    - #### getCreateCommand

          public ICommand getCreateCommand(Object node,
                                           IGanttChartModel model,
                                           ILayer layer,
                                           ITimeSpan span,
                                           int lineIndex)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Returns a command object that will perform the creation of a new timeline object.
      Specified by:
        `getCreateCommand` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `node` - the tree node that will own the new timeline object
        `model` - the data source of the tree node
        `layer` - the layer to which the newly created timeline object will be added
        `span` - the time span where the new timeline object will be placed
        `lineIndex` - the index of the line (see `ILinePolicy`) where the new timeline object gets created (-1 if no specific inner line is used)
      Returns:
        a command that will modify the timeline object's time span

    - #### getDeleteCommand

          public ICommand getDeleteCommand(IGanttChartModel model,
                                           Collection<TimelineObjectPath> timelineObjects)

      Description copied from interface: `IEditTimelineObjectPolicy`
      Returns a command object that will perform the deletion of the given timeline objects. Only deletable timeline objects are passed to this method.
      Specified by:
        `getDeleteCommand` in interface `IEditTimelineObjectPolicy`
      Parameters:
        `model` - the data source of the tree node and the timeline object
        `timelineObjects` - the timeline objects that gets deleted
      Returns:
        a command that will modify the timeline object's time span

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