com.dlsc.flexgantt.swing.layer
Class DefaultLayerContainerSelectionModel

java.lang.Object
  extended by com.dlsc.flexgantt.swing.layer.DefaultLayerContainerSelectionModel
All Implemented Interfaces:
ILayerContainerSelectionModel

public class DefaultLayerContainerSelectionModel
extends java.lang.Object
implements ILayerContainerSelectionModel

The default implementation of ILayerContainerSelectionModel.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultLayerContainerSelectionModel()
           
 
Method Summary
 void addLayerContainerSelectionModelListener(ILayerContainerSelectionModelListener l)
          Adds a listener to the selection model.
 void addSelectedTimeSpan(java.lang.Object node, ITimeSpan span)
          Adds a time span to the list of selected time spans of the given tree table node object.
 void clearSelectedTimeSpans()
          Removes all selected time spans from the selection model.
 void clearSelectedTimeSpans(java.lang.Object node)
          Removes all of those selected time spans that belong to the given tree node object.
protected  void fireTimeSpansAdded(java.lang.Object node, java.util.List<ITimeSpan> spans)
          Sends a TimeSpanSelectionEvent to all listeners informing them that time spans have been added to the selection model.
protected  void fireTimeSpansRemoved(java.lang.Object node, java.util.List<ITimeSpan> spans)
          Sends a TimeSpanSelectionEvent to all listeners informing them that time spans have been removed from the selection model.
 java.util.Iterator<ITimeSpan> getSelectedTimeSpans(java.lang.Object owner, ITimeSpan span)
          Returns an iterator for iterating over the list of selected time spans of the given node within the given time span.
 boolean isEmpty()
          Checks whether the selection model contains any selections at all.
 boolean isEmpty(java.lang.Object node)
          Checks whether the selection model contains any selections for the given tree node object.
 boolean isSelected(java.lang.Object node, ITimeSpan span)
          Returns TRUE if the given time span is currently selected on the given tree table node.
 void removeLayerContainerSelectionModelListener(ILayerContainerSelectionModelListener l)
          Removes a listener from the selection model.
 void removeSelectedTimeSpan(java.lang.Object node, ITimeSpan removedSpan)
          Removes a time span from the list of selected time spans of the given tree table node object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLayerContainerSelectionModel

public DefaultLayerContainerSelectionModel()
Method Detail

isEmpty

public boolean isEmpty()
Description copied from interface: ILayerContainerSelectionModel
Checks whether the selection model contains any selections at all.

Specified by:
isEmpty in interface ILayerContainerSelectionModel
Returns:
TRUE if the selection model does not have any selections

isEmpty

public boolean isEmpty(java.lang.Object node)
Description copied from interface: ILayerContainerSelectionModel
Checks whether the selection model contains any selections for the given tree node object.

Specified by:
isEmpty in interface ILayerContainerSelectionModel
Parameters:
node - the node to check for selections
Returns:
TRUE if the selection model does not have any selections for the given tree node object

clearSelectedTimeSpans

public void clearSelectedTimeSpans()
Description copied from interface: ILayerContainerSelectionModel
Removes all selected time spans from the selection model.

Specified by:
clearSelectedTimeSpans in interface ILayerContainerSelectionModel
See Also:
ILayerContainerSelectionModel.clearSelectedTimeSpans(Object), ILayerContainerSelectionModel.removeSelectedTimeSpan(Object, ITimeSpan)

clearSelectedTimeSpans

public void clearSelectedTimeSpans(java.lang.Object node)
Description copied from interface: ILayerContainerSelectionModel
Removes all of those selected time spans that belong to the given tree node object.

Specified by:
clearSelectedTimeSpans in interface ILayerContainerSelectionModel
Parameters:
node - the tree table node object
See Also:
ILayerContainerSelectionModel.clearSelectedTimeSpans(), ILayerContainerSelectionModel.removeSelectedTimeSpan(Object, ITimeSpan)

addSelectedTimeSpan

public void addSelectedTimeSpan(java.lang.Object node,
                                ITimeSpan span)
Description copied from interface: ILayerContainerSelectionModel
Adds a time span to the list of selected time spans of the given tree table node object.

Specified by:
addSelectedTimeSpan in interface ILayerContainerSelectionModel
Parameters:
node - the tree table node object
span - the time span to add
See Also:
ILayerContainerSelectionModel.removeSelectedTimeSpan(Object, ITimeSpan)

removeSelectedTimeSpan

public void removeSelectedTimeSpan(java.lang.Object node,
                                   ITimeSpan removedSpan)
Description copied from interface: ILayerContainerSelectionModel
Removes a time span from the list of selected time spans of the given tree table node object.

Specified by:
removeSelectedTimeSpan in interface ILayerContainerSelectionModel
Parameters:
node - the tree table node object
removedSpan - the time span to remove
See Also:
ILayerContainerSelectionModel.addSelectedTimeSpan(Object, ITimeSpan)

getSelectedTimeSpans

public java.util.Iterator<ITimeSpan> getSelectedTimeSpans(java.lang.Object owner,
                                                          ITimeSpan span)
Description copied from interface: ILayerContainerSelectionModel
Returns an iterator for iterating over the list of selected time spans of the given node within the given time span.

Specified by:
getSelectedTimeSpans in interface ILayerContainerSelectionModel
Parameters:
owner - the tree table node object
span - the time span for which an iterator gets created
Returns:
a time span iterator

isSelected

public boolean isSelected(java.lang.Object node,
                          ITimeSpan span)
Description copied from interface: ILayerContainerSelectionModel
Returns TRUE if the given time span is currently selected on the given tree table node. A time span is considered selected if it is completely contained within one of the selected time spans.

Specified by:
isSelected in interface ILayerContainerSelectionModel
Parameters:
node - the tree table node object
span - the time span to check
Returns:
TRUE if the time span is currently selected
See Also:
ITimeSpan.contains(ITimeSpan)

addLayerContainerSelectionModelListener

public void addLayerContainerSelectionModelListener(ILayerContainerSelectionModelListener l)
Description copied from interface: ILayerContainerSelectionModel
Adds a listener to the selection model.

Specified by:
addLayerContainerSelectionModelListener in interface ILayerContainerSelectionModel
Parameters:
l - the listener to add
See Also:
ILayerContainerSelectionModel.removeLayerContainerSelectionModelListener(ILayerContainerSelectionModelListener)

removeLayerContainerSelectionModelListener

public void removeLayerContainerSelectionModelListener(ILayerContainerSelectionModelListener l)
Description copied from interface: ILayerContainerSelectionModel
Removes a listener from the selection model.

Specified by:
removeLayerContainerSelectionModelListener in interface ILayerContainerSelectionModel
Parameters:
l - the listener to remove
See Also:
ILayerContainerSelectionModel.addLayerContainerSelectionModelListener(ILayerContainerSelectionModelListener)

fireTimeSpansAdded

protected void fireTimeSpansAdded(java.lang.Object node,
                                  java.util.List<ITimeSpan> spans)
Sends a TimeSpanSelectionEvent to all listeners informing them that time spans have been added to the selection model.

Parameters:
node - the tree node on which time spans were added to the selection
spans - the time spans that were added
Since:
1.0

fireTimeSpansRemoved

protected void fireTimeSpansRemoved(java.lang.Object node,
                                    java.util.List<ITimeSpan> spans)
Sends a TimeSpanSelectionEvent to all listeners informing them that time spans have been removed from the selection model.

Parameters:
node - the tree node on which time spans were removed from the selection
spans - the time spans that were removed
Since:
1.0