com.dlsc.flexgantt.model.gantt

## Class DefaultRelationship<T>

- java.lang.Object
- - com.dlsc.flexgantt.model.gantt.DefaultRelationship<T>

- Type Parameters:
    `T` - the object type of the related timeline objects
  All Implemented Interfaces:
    IRelationship<T>
  Direct Known Subclasses:
    AbstractConstraint

      public class DefaultRelationship<T>
      extends Object
      implements IRelationship<T>

  The default implementation for relationships. For more information read the notes on `IRelationship`.
  Since:
    1.0
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultRelationship(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath)` Constructs a new relationship object.
    `DefaultRelationship(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath, RelationshipType type)` Constructs a new relationship object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getLabel(LabelType type)` Returns a label for the given type / purpose.
    `Object` | `getPopupObject(boolean extended)` Returns the object to be shown inside the popup window when the mouse cursor hovers over the relationship.
    `Object` | `getPopupTitleObject()` Returns the object used for storing the data that is needed for the popup title.
    `TimelineObjectPath<T>` | `getSourcePath()` Returns the tree path information that can be used to locate the row on which the source timeline object is displayed.
    `TimelineObjectPath<T>` | `getTargetPath()` Returns the tree path information that can be used to locate the row on which the target timeline object is displayed.
    `RelationshipType` | `getType()` The type of relationship expressed by the line drawn between two timeline objects.
    `boolean` | `isDeletable()` Determines if the user is allowed to delete the relationship.
    `boolean` | `isSelectable()` Determines if the user is allowed to select the relationship by clicking on it.
    `void` | `setDeletable(boolean b)` Specifies whether the relationship can be deleted by the user or not.
    `void` | `setLabel(String label, LabelType type)` Sets a new label for the given label type.
    `void` | `setPopupObject(Object popupObject, boolean extended)` Sets the object used for displaying popup information for the given relationship.
    `void` | `setPopupTitleObject(Object titleObject)` Sets the object used for storing the data that is needed for the popup title.
    `void` | `setSelectable(boolean b)` Specifies whether the relationship can be selected by the user or not.
    `void` | `setSourcePath(TimelineObjectPath<T> path)` Sets a new tree path that can be used to locate the row on which the source timeline object is displayed.
    `void` | `setTargetPath(TimelineObjectPath<T> path)` Sets a new tree path that can be used to locate the row on which the target timeline object is displayed.
    `void` | `setType(RelationshipType type)` Sets the relationship type expressed by the line drawn between two timeline objects.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultRelationship

          public DefaultRelationship(TimelineObjectPath<T> sourcePath,
                                     TimelineObjectPath<T> targetPath,
                                     RelationshipType type)

      Constructs a new relationship object.
      Parameters:
        `sourcePath` - the timeline object path used to locate the source timeline object
        `targetPath` - the timeline object path used to locate the target timeline object
        `type` - the type of relationship (start to end, end to start, start to start, end to end)
      Since:
        2.0

    - #### DefaultRelationship

          public DefaultRelationship(TimelineObjectPath<T> sourcePath,
                                     TimelineObjectPath<T> targetPath)

      Constructs a new relationship object.
      Parameters:
        `sourcePath` - the timeline object path used to locate the source timeline object
        `targetPath` - the timeline object path used to locate the target timeline object
      Since:
        1.0

  - ### Method Detail

    - #### setLabel

          public void setLabel(String label,
                               LabelType type)

      Sets a new label for the given label type. The `LabelType` enumerator specifies the context in which the label gets used: tooltip, popup, status bar.
      Parameters:
        `label` - the new label used for the given label type
        `type` - the label type designating where the label will be used
      Since:
        2.0

    - #### getLabel

          public String getLabel(LabelType type)

      Description copied from interface: `IRelationship`
      Returns a label for the given type / purpose.
      Specified by:
        `getLabel` in interface `IRelationship<T>`
      Parameters:
        `type` - the label type
      Returns:
        the text for the given label type

    - #### setSourcePath

          public void setSourcePath(TimelineObjectPath<T> path)

      Description copied from interface: `IRelationship`
      Sets a new tree path that can be used to locate the row on which the source timeline object is displayed.
      Specified by:
        `setSourcePath` in interface `IRelationship<T>`
      Parameters:
        `path` - the new source path

    - #### getSourcePath

          public TimelineObjectPath<T> getSourcePath()

      Description copied from interface: `IRelationship`
      Returns the tree path information that can be used to locate the row on which the source timeline object is displayed.
      Specified by:
        `getSourcePath` in interface `IRelationship<T>`
      Returns:
        the tree path to the row where the source object is located

    - #### setTargetPath

          public void setTargetPath(TimelineObjectPath<T> path)

      Description copied from interface: `IRelationship`
      Sets a new tree path that can be used to locate the row on which the target timeline object is displayed.
      Specified by:
        `setTargetPath` in interface `IRelationship<T>`
      Parameters:
        `path` - the new target path

    - #### getTargetPath

          public TimelineObjectPath<T> getTargetPath()

      Description copied from interface: `IRelationship`
      Returns the tree path information that can be used to locate the row on which the target timeline object is displayed.
      Specified by:
        `getTargetPath` in interface `IRelationship<T>`
      Returns:
        the tree path to the row where the target object is located

    - #### setSelectable

          public void setSelectable(boolean b)

      Specifies whether the relationship can be selected by the user or not.
      Parameters:
        `b` - if TRUE the user will be able to select the relationship
      Since:
        2.0
      See Also:
        `ISelectionPolicy.isSelectable(IRelationship, IGanttChartModel)`

    - #### isSelectable

          public boolean isSelectable()

      Description copied from interface: `IRelationship`
      Determines if the user is allowed to select the relationship by clicking on it.
      Specified by:
        `isSelectable` in interface `IRelationship<T>`
      Returns:
        TRUE if the user can select the relationship

    - #### isDeletable

          public boolean isDeletable()

      Description copied from interface: `IRelationship`
      Determines if the user is allowed to delete the relationship.
      Specified by:
        `isDeletable` in interface `IRelationship<T>`
      Returns:
        TRUE if the user is allowed to delete it

    - #### setDeletable

          public void setDeletable(boolean b)

      Specifies whether the relationship can be deleted by the user or not.
      Parameters:
        `b` - if TRUE the user will be able to delete the relationship
      Since:
        2.0
      See Also:
        `IRelationshipPolicy.isDeletable(IRelationship, IGanttChartModel)`

    - #### setPopupObject

          public void setPopupObject(Object popupObject,
                                     boolean extended)

      Sets the object used for displaying popup information for the given relationship.
      Parameters:
        `popupObject` -
        `extended` -
      Since:
        2.0

    - #### getPopupObject

          public Object getPopupObject(boolean extended)

      Description copied from interface: `IRelationship`
      Returns the object to be shown inside the popup window when the mouse cursor hovers over the relationship.
      Specified by:
        `getPopupObject` in interface `IRelationship<T>`
      Parameters:
        `extended` - if TRUE the user wants to see the extended popup information
      Returns:
        the popup input object

    - #### setPopupTitleObject

          public void setPopupTitleObject(Object titleObject)

      Sets the object used for storing the data that is needed for the popup title. In most cases this will simply be a string / text. However, customized popup renderers might require more information.
      Parameters:
        `titleObject` - the data object used for the popup title
      Since:
        2.0

    - #### getPopupTitleObject

          public Object getPopupTitleObject()

      Returns the object used for storing the data that is needed for the popup title.
      Specified by:
        `getPopupTitleObject` in interface `IRelationship<T>`
      Returns:
        the data object used for the popup title
      Since:
        2.0

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### setType

          public void setType(RelationshipType type)

      Description copied from interface: `IRelationship`
      Sets the relationship type expressed by the line drawn between two timeline objects.
      Specified by:
        `setType` in interface `IRelationship<T>`
      Parameters:
        `type` - the relationship type

    - #### getType

          public RelationshipType getType()

      Description copied from interface: `IRelationship`
      The type of relationship expressed by the line drawn between two timeline objects.
      Specified by:
        `getType` in interface `IRelationship<T>`
      Returns:
        the relationship type

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