com.dlsc.flexgantt.policy.layer

## Interface IRelationshipPolicy

- All Superinterfaces:
    IPolicy
  All Known Implementing Classes:
    DefaultConstraintPolicy, DefaultRelationshipPolicy

      public interface IRelationshipPolicy
      extends IPolicy

  A policy that supports the creation of relationships between timeline objects. The policy determines which objects can be linked and how the linking gets executed (the relationship command).
  Since:
    1.0
  Version:
    $Revision: 1.5 $
  Author:
    Dirk Lemmermann

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ICommand` | `getCreateRelationshipCommand(TimelineObjectPath sourcePath, TimelineObjectPath targetPath, RelationshipType type, IGanttChartModel model)` Returns a command object that will perform the actual linking of the source and target timeline objects by making the appropriate changes in the model.
    `ICommand` | `getDeleteRelationshipsCommand(Collection<IRelationship> relationships, IGanttChartModel model)` Returns a command object that will perform the actual deletion of several relationship objects from the given model.
    `RelationshipType[]` | `getSupportedRelationshipTypes(TimelineObjectPath path, IGanttChartModel model)` Determines the types of relationships that are supported by the given timeline object (end to start, start to end, start to start, end to end).
    `boolean` | `isDeletable(IRelationship relationship, IGanttChartModel model)` Determines whether the given relationship object is deletable.
    `boolean` | `isRelationshipSource(TimelineObjectPath path, IGanttChartModel model)` Determines whether the given timeline object can be used for creating a relationship to another object.
    `boolean` | `isRelationshipTarget(TimelineObjectPath sourcePath, TimelineObjectPath targetPath, IGanttChartModel model)` Determines whether the given source timeline object can be linked to the given target timeline object.

- - ### Method Detail

    - #### isRelationshipSource

          boolean isRelationshipSource(TimelineObjectPath path,
                                       IGanttChartModel model)

      Determines whether the given timeline object can be used for creating a relationship to another object.
      Parameters:
        `path` - the source timeline object path
        `model` - the model of the node and timeline object
      Returns:
        TRUE if the given timeline object can be used for a relationship object
      Since:
        1.0
      See Also:
        `isRelationshipTarget(TimelineObjectPath, TimelineObjectPath, IGanttChartModel)`

    - #### isRelationshipTarget

          boolean isRelationshipTarget(TimelineObjectPath sourcePath,
                                       TimelineObjectPath targetPath,
                                       IGanttChartModel model)

      Determines whether the given source timeline object can be linked to the given target timeline object.
      Parameters:
        `sourcePath` - the source timeline object
        `targetPath` - the target timeline object
        `model` - the model of the nodes and timeline objects
      Returns:
        TRUE if the given source timeline object can be linked with the given target timeline object
      Since:
        1.0
      See Also:
        `isRelationshipSource(TimelineObjectPath, IGanttChartModel)`

    - #### getSupportedRelationshipTypes

          RelationshipType[] getSupportedRelationshipTypes(TimelineObjectPath path,
                                                           IGanttChartModel model)

      Determines the types of relationships that are supported by the given timeline object (end to start, start to end, start to start, end to end).
      Parameters:
        `path` - the path to the timeline object
        `targetPath` - the target tree node
        `model` - the model of the nodes and timeline objects
      Returns:
        the supported relationship types
      Since:
        2.0

    - #### isDeletable

          boolean isDeletable(IRelationship relationship,
                              IGanttChartModel model)

      Determines whether the given relationship object is deletable. This method delegates to `IRelationship.isDeletable()`.
      Parameters:
        `relationship` - the relationship to check
        `model` - the model to which the relationship belongs
      Returns:
        TRUE if the user can delete the relationship
      Since:
        2.0

    - #### getCreateRelationshipCommand

          ICommand getCreateRelationshipCommand(TimelineObjectPath sourcePath,
                                                TimelineObjectPath targetPath,
                                                RelationshipType type,
                                                IGanttChartModel model)

      Returns a command object that will perform the actual linking of the source and target timeline objects by making the appropriate changes in the model.
      Parameters:
        `sourcePath` - the path to the source timeline object
        `targetPath` - the path to the target timeline object
        `type` - the type of relationship that the user wants to create (end to start, start to end, start to start, end to end)
        `model` - the source model of the node and timeline object
      Returns:
        a command that will create a relationship between the timeline objects
      Since:
        1.0
      See Also:
        `IRelationship`, `DefaultCreateRelationshipCommand`

    - #### getDeleteRelationshipsCommand

          ICommand getDeleteRelationshipsCommand(Collection<IRelationship> relationships,
                                                 IGanttChartModel model)

      Returns a command object that will perform the actual deletion of several relationship objects from the given model.
      Parameters:
        `relationships` - the relationships to delete
        `model` - the model to which the relationship belongs objects
      Returns:
        a command that will delete the given relationship object from its model
      Since:
        2.0
      See Also:
        `IRelationship`, `DefaultDeleteMultipleRelationshipsCommand`

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