com.dlsc.flexgantt.model.eventline
Class DefaultEventlineModel<T extends IEventlineObject>

java.lang.Object
  extended by com.dlsc.flexgantt.model.eventline.DefaultEventlineModel<T>
Type Parameters:
T - the type of the eventline objects
All Implemented Interfaces:
IEventlineModel<T>

public class DefaultEventlineModel<T extends IEventlineObject>
extends java.lang.Object
implements IEventlineModel<T>

A default implementation of the eventline model that internally manages instances of IEventlineObject in a ArrayList.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultEventlineModel()
           
 
Method Summary
 void addEventlineModelListener(IEventlineModelListener l)
          Adds an eventline model listener.
 void addEventlineObject(T eventlineObject)
          Adds a single object to the model.
 void addEventlineObjects(java.util.Collection<T> eventlineObjects)
          Adds a collection of eventline objects to the model.
 void clearEventlineObjects()
          Removes all eventline objects from the model.
protected  void fireEventlineModelEvent(EventlineModelEvent evt)
          Fires the given event by passing it to all listeners.
 java.util.List<T> getEventlineObjects()
          Returns the internal data structure used to store the eventline objects.
 java.util.Iterator<T> getEventlineObjectsIterator(ITimeSpan span)
          Returns an iterator for those eventline objects that are placed on the eventline during the given span.
 ITimeSpan getTimeSpan(T eventlineObject)
          Returns the time span allocated to the given object.
 void removeEventlineModelListener(IEventlineModelListener l)
          Removes a listener from the eventline model.
 void removeEventlineObject(T eventlineObject)
          Removes a single object from the model.
 void removeEventlineObjects(java.util.Collection<T> eventlineObjects)
          Removes a collection of eventline objects from the model.
 void setTimeSpan(T eventlineObject, ITimeSpan span)
          Sets a new time span on the given eventline object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventlineModel

public DefaultEventlineModel()
Method Detail

getEventlineObjectsIterator

public java.util.Iterator<T> getEventlineObjectsIterator(ITimeSpan span)
Description copied from interface: IEventlineModel
Returns an iterator for those eventline objects that are placed on the eventline during the given span.

Specified by:
getEventlineObjectsIterator in interface IEventlineModel<T extends IEventlineObject>
Parameters:
span - the time span for which to return the timeline objects
Returns:
an iterator for timeline objects on the eventline (for the given time span)

getTimeSpan

public ITimeSpan getTimeSpan(T eventlineObject)
Description copied from interface: IEventlineModel
Returns the time span allocated to the given object.

Specified by:
getTimeSpan in interface IEventlineModel<T extends IEventlineObject>
Parameters:
eventlineObject - the timeline object
Returns:
a time span for the given object

setTimeSpan

public void setTimeSpan(T eventlineObject,
                        ITimeSpan span)
Sets a new time span on the given eventline object.

Parameters:
eventlineObject - the eventline object that will get a new time span allocation
span - the new time span
Since:
1.0

addEventlineObject

public void addEventlineObject(T eventlineObject)
Adds a single object to the model. This is a convenience method, which delegates its call to addEventlineObjects(Collection).

Parameters:
eventlineObject - the object to add
Since:
1.0

addEventlineObjects

public void addEventlineObjects(java.util.Collection<T> eventlineObjects)
Description copied from interface: IEventlineModel
Adds a collection of eventline objects to the model.

Specified by:
addEventlineObjects in interface IEventlineModel<T extends IEventlineObject>
See Also:
IEventlineModel.removeEventlineObjects(Collection)

removeEventlineObject

public void removeEventlineObject(T eventlineObject)
Removes a single object from the model. This is a convenience method, which delegates its call to removeEventlineObjects(Collection).

Parameters:
eventlineObject - the object to remove
Since:
1.0

removeEventlineObjects

public void removeEventlineObjects(java.util.Collection<T> eventlineObjects)
Description copied from interface: IEventlineModel
Removes a collection of eventline objects from the model.

Specified by:
removeEventlineObjects in interface IEventlineModel<T extends IEventlineObject>
See Also:
IEventlineModel.addEventlineObjects(Collection)

clearEventlineObjects

public void clearEventlineObjects()
Removes all eventline objects from the model.

Since:
1.0

getEventlineObjects

public java.util.List<T> getEventlineObjects()
Returns the internal data structure used to store the eventline objects.

Returns:
a list of all eventline objects
Since:
1.0
See Also:
addEventlineObjects(Collection), removeEventlineObjects(Collection)

addEventlineModelListener

public void addEventlineModelListener(IEventlineModelListener l)
Description copied from interface: IEventlineModel
Adds an eventline model listener.

Specified by:
addEventlineModelListener in interface IEventlineModel<T extends IEventlineObject>
Parameters:
l - the listener to add
See Also:
IEventlineModel.removeEventlineModelListener(IEventlineModelListener)

removeEventlineModelListener

public void removeEventlineModelListener(IEventlineModelListener l)
Description copied from interface: IEventlineModel
Removes a listener from the eventline model.

Specified by:
removeEventlineModelListener in interface IEventlineModel<T extends IEventlineObject>
Parameters:
l - the listener to remove
See Also:
IEventlineModel.addEventlineModelListener(IEventlineModelListener)

fireEventlineModelEvent

protected void fireEventlineModelEvent(EventlineModelEvent evt)
Fires the given event by passing it to all listeners.

Parameters:
evt - the eventline model event
Since:
1.0
See Also:
addEventlineModelListener(IEventlineModelListener), removeEventlineModelListener(IEventlineModelListener)