com.dlsc.flexgantt.swing.layer.timeline

## Class DefaultTimelineObjectSelectionModel

- java.lang.Object
- - com.dlsc.flexgantt.swing.layer.timeline.DefaultTimelineObjectSelectionModel

- All Implemented Interfaces:
    ITimelineObjectSelectionModel

      public class DefaultTimelineObjectSelectionModel
      extends Object
      implements ITimelineObjectSelectionModel

  The default implementation of the timeline object layer selection model. For more information please refer to the interface documentation.
  Since:
    1.0
  Version:
    $Revision: 1.7 $
  Author:
    Dirk Lemmermann
  See Also:
    `LayerContainer.getSelectionModel(ILayer)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultTimelineObjectSelectionModel(ILayer layer)` Constructs a new selection model.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSelection(Collection<TimelineObjectPath> paths)` Adds several timeline objects to the selection at the same time.
    `void` | `addSelection(TimelineObjectPath path)` Adds a selection / a selected timeline object to the model.
    `void` | `addTimelineObjectSelectionModelListener(ITimelineObjectSelectionListener l)` Adds a listener to the model.
    `void` | `clearSelection()` Clears the current selection.
    `void` | `clearSelection(TreePath node)` Clears the current selection for the given path (clears the selection within a specific row).
    `protected void` | `fireValueChanged(TimelineObjectSelectionEvent.ID id, Collection<TimelineObjectPath> paths)` Fires an event with the given ID to all listeners that are currently attached to the model.
    `ILayer` | `getLayer()` Returns the layer to which the selection model belongs.
    `Iterator<TimelineObjectPath>` | `getSelection()` Returns all timeline objects that are currently selected.
    `Iterator<TimelineObjectPath>` | `getSelection(TreePath node)` Returns all timeline objects for the given node that are currently selected.
    `Iterator<TimelineObjectPath>` | `getSelection(TreePath path, ITimeSpan span)` Returns all timeline objects for the given node and time span that are currently selected.
    `Iterator<TreePath>` | `getSelectionPaths()` Returns all tree paths that reference hierarchy objects on which a selection exists / on which timeline objects are selected.
    `boolean` | `isEmpty()` Determines if the current selection is empty.
    `boolean` | `isSelected(TimelineObjectPath path)` Determines if the timeline object referenced by the given timeline object path is currently selected.
    `void` | `removeSelection(Collection<TimelineObjectPath> paths)` Removes several timeline objects from the selection at the same time.
    `void` | `removeSelection(TimelineObjectPath path)` Removes a selection / a selected timeline object from the model.
    `void` | `removeTimelineObjectSelectionModelListener(ITimelineObjectSelectionListener l)` Removes a listener from the model.

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

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

- - ### Constructor Detail

    - #### DefaultTimelineObjectSelectionModel

          public DefaultTimelineObjectSelectionModel(ILayer layer)

      Constructs a new selection model.
      Parameters:
        `layer` - the model layer for which the selection model will track the selected timeline objects
      Since:
        1.0

  - ### Method Detail

    - #### getLayer

          public ILayer getLayer()

      Returns the layer to which the selection model belongs.
      Returns:
        the selection model's layer
      Since:
        1.0

    - #### clearSelection

          public void clearSelection()

      Description copied from interface: `ITimelineObjectSelectionModel`
      Clears the current selection. No timeline object will be marked as selected any more.
      Specified by:
        `clearSelection` in interface `ITimelineObjectSelectionModel`

    - #### clearSelection

          public void clearSelection(TreePath node)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Clears the current selection for the given path (clears the selection within a specific row).
      Specified by:
        `clearSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `node` - the path to the hierarchy node for which the selection will be cleared

    - #### addSelection

          public void addSelection(TimelineObjectPath path)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Adds a selection / a selected timeline object to the model.
      Specified by:
        `addSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `path` - the path to the timeline object

    - #### addSelection

          public void addSelection(Collection<TimelineObjectPath> paths)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Adds several timeline objects to the selection at the same time.
      Specified by:
        `addSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `paths` - a collection of timeline object paths

    - #### removeSelection

          public void removeSelection(TimelineObjectPath path)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Removes a selection / a selected timeline object from the model.
      Specified by:
        `removeSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `path` - the path to the timeline object

    - #### removeSelection

          public void removeSelection(Collection<TimelineObjectPath> paths)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Removes several timeline objects from the selection at the same time.
      Specified by:
        `removeSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `paths` - a collection of timeline object paths

    - #### getSelection

          public Iterator<TimelineObjectPath> getSelection(TreePath path,
                                                           ITimeSpan span)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Returns all timeline objects for the given node and time span that are currently selected. The method returns an `Iterator` in order to hide the actual data structure used to store the objects.
      Specified by:
        `getSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `path` - the path to the hierarchy node for which to return the selected timeline objects
        `span` - the time span for which to return the selected timeline objects
      Returns:
        an iterator for iterating over the list of selected timeline objects for the given node and time span
      See Also:
        `ITimelineObjectSelectionModel.getSelection()`, `ITimelineObjectSelectionModel.getSelection(TreePath)`

    - #### getSelection

          public Iterator<TimelineObjectPath> getSelection(TreePath node)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Returns all timeline objects for the given node that are currently selected. The method returns an `Iterator` in order to hide the actual data structure used to store the objects.
      Specified by:
        `getSelection` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `node` - the path to the hierarchy node for which to return the selected timeline objects
      Returns:
        an iterator for iterating over the list of selected timeline objects for the given node and time span
      See Also:
        `ITimelineObjectSelectionModel.getSelection(TreePath, ITimeSpan)`, `ITimelineObjectSelectionModel.getSelection()`

    - #### getSelection

          public Iterator<TimelineObjectPath> getSelection()

      Description copied from interface: `ITimelineObjectSelectionModel`
      Returns all timeline objects that are currently selected. The method returns an `Iterator` in order to hide the actual data structure used to store the objects.
      Specified by:
        `getSelection` in interface `ITimelineObjectSelectionModel`
      Returns:
        an iterator for iterating over the list of selected timeline objects for the given node and time span
      See Also:
        `ITimelineObjectSelectionModel.getSelection(TreePath)`, `ITimelineObjectSelectionModel.getSelection(TreePath, ITimeSpan)`

    - #### isSelected

          public boolean isSelected(TimelineObjectPath path)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Determines if the timeline object referenced by the given timeline object path is currently selected.
      Specified by:
        `isSelected` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `path` - the path to the checked timeline object
      Returns:
        TRUE if the referenced timeline object is selected

    - #### getSelectionPaths

          public Iterator<TreePath> getSelectionPaths()

      Description copied from interface: `ITimelineObjectSelectionModel`
      Returns all tree paths that reference hierarchy objects on which a selection exists / on which timeline objects are selected.
      Specified by:
        `getSelectionPaths` in interface `ITimelineObjectSelectionModel`
      Returns:
        all tree paths referencing hierarchy objects with selections

    - #### addTimelineObjectSelectionModelListener

          public void addTimelineObjectSelectionModelListener(ITimelineObjectSelectionListener l)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Adds a listener to the model. The listener will be informed if selections are added to or removed from the model.
      Specified by:
        `addTimelineObjectSelectionModelListener` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `l` - the listener to add

    - #### removeTimelineObjectSelectionModelListener

          public void removeTimelineObjectSelectionModelListener(ITimelineObjectSelectionListener l)

      Description copied from interface: `ITimelineObjectSelectionModel`
      Removes a listener from the model.
      Specified by:
        `removeTimelineObjectSelectionModelListener` in interface `ITimelineObjectSelectionModel`
      Parameters:
        `l` - the listener to remove

    - #### fireValueChanged

          protected void fireValueChanged(TimelineObjectSelectionEvent.ID id,
                                          Collection<TimelineObjectPath> paths)

      Fires an event with the given ID to all listeners that are currently attached to the model.
      Parameters:
        `id` - the event ID
        `paths` - the timeline object paths that have been added to or removed from the model
      Since:
        1.0

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `ITimelineObjectSelectionModel`
      Determines if the current selection is empty.
      Specified by:
        `isEmpty` in interface `ITimelineObjectSelectionModel`
      Returns:
        TRUE if at least one timeline object is selected

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