com.dlsc.flexgantt.swing.layer.timeline
Class DefaultTimelineObjectLayerSelectionModel

java.lang.Object
  extended by com.dlsc.flexgantt.swing.layer.timeline.DefaultTimelineObjectLayerSelectionModel
All Implemented Interfaces:
ITimelineObjectLayerSelectionModel

public class DefaultTimelineObjectLayerSelectionModel
extends java.lang.Object
implements ITimelineObjectLayerSelectionModel

The default implementation of the timeline object layer selection model. For more information please refer to the interface documentation.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
LayerContainer.getSelectionModel(ILayer)

Constructor Summary
DefaultTimelineObjectLayerSelectionModel(ILayer layer)
          Constructs a new selection model.
 
Method Summary
 void addSelection(java.util.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 addTimelineLayerSelectionModelListener(ITimelineObjectLayerSelectionListener l)
          Adds a listener to the model.
 void clearSelection()
          Clears the current selection.
 void clearSelection(javax.swing.tree.TreePath node)
          Clears the current selection for the given path (clears the selection within a specific row).
protected  void fireValueChanged(TimelineObjectSelectionEvent.ID id, java.util.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.
 java.util.Iterator<TimelineObjectPath> getSelection()
          Returns all timeline objects that are currently selected.
 java.util.Iterator<TimelineObjectPath> getSelection(javax.swing.tree.TreePath node)
          Returns all timeline objects for the given node that are currently selected.
 java.util.Iterator<TimelineObjectPath> getSelection(javax.swing.tree.TreePath path, ITimeSpan span)
          Returns all timeline objects for the given node and time span that are currently selected.
 java.util.Iterator<javax.swing.tree.TreePath> getSelectionPaths()
          Returns all tree paths that reference hierarchy objects on which a selection exists / on which timeline objects are selected.
 boolean isSelected(TimelineObjectPath path)
          Determines if the timeline object referenced by the given timeline object path is currently selected.
 void removeSelection(java.util.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 removeTimelineLayerSelectionModelListener(ITimelineObjectLayerSelectionListener 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

DefaultTimelineObjectLayerSelectionModel

public DefaultTimelineObjectLayerSelectionModel(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: ITimelineObjectLayerSelectionModel
Clears the current selection. No timeline object will be marked as selected any more.

Specified by:
clearSelection in interface ITimelineObjectLayerSelectionModel

clearSelection

public void clearSelection(javax.swing.tree.TreePath node)
Description copied from interface: ITimelineObjectLayerSelectionModel
Clears the current selection for the given path (clears the selection within a specific row).

Specified by:
clearSelection in interface ITimelineObjectLayerSelectionModel
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: ITimelineObjectLayerSelectionModel
Adds a selection / a selected timeline object to the model.

Specified by:
addSelection in interface ITimelineObjectLayerSelectionModel
Parameters:
path - the path to the timeline object

addSelection

public void addSelection(java.util.Collection<TimelineObjectPath> paths)
Description copied from interface: ITimelineObjectLayerSelectionModel
Adds several timeline objects to the selection at the same time.

Specified by:
addSelection in interface ITimelineObjectLayerSelectionModel
Parameters:
paths - a collection of timeline object paths

removeSelection

public void removeSelection(TimelineObjectPath path)
Description copied from interface: ITimelineObjectLayerSelectionModel
Removes a selection / a selected timeline object from the model.

Specified by:
removeSelection in interface ITimelineObjectLayerSelectionModel
Parameters:
path - the path to the timeline object

removeSelection

public void removeSelection(java.util.Collection<TimelineObjectPath> paths)
Description copied from interface: ITimelineObjectLayerSelectionModel
Removes several timeline objects from the selection at the same time.

Specified by:
removeSelection in interface ITimelineObjectLayerSelectionModel
Parameters:
paths - a collection of timeline object paths

getSelection

public java.util.Iterator<TimelineObjectPath> getSelection(javax.swing.tree.TreePath path,
                                                           ITimeSpan span)
Description copied from interface: ITimelineObjectLayerSelectionModel
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 ITimelineObjectLayerSelectionModel
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:
ITimelineObjectLayerSelectionModel.getSelection(), ITimelineObjectLayerSelectionModel.getSelection(TreePath)

getSelection

public java.util.Iterator<TimelineObjectPath> getSelection(javax.swing.tree.TreePath node)
Description copied from interface: ITimelineObjectLayerSelectionModel
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 ITimelineObjectLayerSelectionModel
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:
ITimelineObjectLayerSelectionModel.getSelection(TreePath, ITimeSpan), ITimelineObjectLayerSelectionModel.getSelection()

getSelection

public java.util.Iterator<TimelineObjectPath> getSelection()
Description copied from interface: ITimelineObjectLayerSelectionModel
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 ITimelineObjectLayerSelectionModel
Returns:
an iterator for iterating over the list of selected timeline objects for the given node and time span
See Also:
ITimelineObjectLayerSelectionModel.getSelection(TreePath), ITimelineObjectLayerSelectionModel.getSelection(TreePath, ITimeSpan)

isSelected

public boolean isSelected(TimelineObjectPath path)
Description copied from interface: ITimelineObjectLayerSelectionModel
Determines if the timeline object referenced by the given timeline object path is currently selected.

Specified by:
isSelected in interface ITimelineObjectLayerSelectionModel
Parameters:
path - the path to the checked timeline object
Returns:
TRUE if the referenced timeline object is selected

getSelectionPaths

public java.util.Iterator<javax.swing.tree.TreePath> getSelectionPaths()
Description copied from interface: ITimelineObjectLayerSelectionModel
Returns all tree paths that reference hierarchy objects on which a selection exists / on which timeline objects are selected.

Specified by:
getSelectionPaths in interface ITimelineObjectLayerSelectionModel
Returns:
all tree paths referencing hierarchy objects with selections

addTimelineLayerSelectionModelListener

public void addTimelineLayerSelectionModelListener(ITimelineObjectLayerSelectionListener l)
Description copied from interface: ITimelineObjectLayerSelectionModel
Adds a listener to the model. The listener will be informed if selections are added to or removed from the model.

Specified by:
addTimelineLayerSelectionModelListener in interface ITimelineObjectLayerSelectionModel
Parameters:
l - the listener to add

removeTimelineLayerSelectionModelListener

public void removeTimelineLayerSelectionModelListener(ITimelineObjectLayerSelectionListener l)
Description copied from interface: ITimelineObjectLayerSelectionModel
Removes a listener from the model.

Specified by:
removeTimelineLayerSelectionModelListener in interface ITimelineObjectLayerSelectionModel
Parameters:
l - the listener to remove

fireValueChanged

protected void fireValueChanged(TimelineObjectSelectionEvent.ID id,
                                java.util.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