T
- the type of the hierarchy (Gantt chart) nodesS
- the type of the timeline objectspublic class DefaultGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject> extends DefaultTreeTableModel<T> implements IGanttChartModel<T,S>
IGanttChartModel
.asksAllowsChildren, listenerList, root
Constructor and Description |
---|
DefaultGanttChartModel(T node)
Constructs a new Gantt chart model.
|
DefaultGanttChartModel(T node,
boolean asksAllowsChildren)
Constructs a new Gantt chart model.
|
Modifier and Type | Method and Description |
---|---|
void |
addGanttChartModelListener(IGanttChartModelListener l)
Adds a listener to the model.
|
void |
addLayer(ILayer layer)
Adds a layer to the model.
|
void |
addRelationship(IRelationship<S> relationship)
Adds a single relationship to the model.
|
void |
addRelationships(Collection<IRelationship<S>> relationships)
Adds a collection of relationships to the model.
|
void |
addSpreadsheet(ISpreadsheet spreadsheet)
Adds a spreadsheet to the model.
|
void |
addTimelineObject(T node,
ILayer layer,
S timelineObject)
Adds a single timeline object to the timeline of the given tree node.
|
void |
addTimelineObjects(T node,
ILayer layer,
Collection<S> timelineObjects)
Adds a collection of objects to the timeline of the given tree node.
|
void |
clearRelationships()
Removes all relationships from the model.
|
void |
clearTimelineObjects()
Removes all timeline objects from all nodes and all layers.
|
void |
clearTimelineObjects(ILayer layer)
Removes all timeline objects from the given layer for all nodes.
|
void |
clearTimelineObjects(T node)
Removes all timeline objects from the given tree node from all layers.
|
void |
clearTimelineObjects(T node,
ILayer layer)
Removes all timeline objects from the given tree node and layer.
|
void |
fireGanttChartChanged(GanttChartModelEvent evt)
Fires the given event to the model listeners.
|
Iterator<S> |
getChildrenTimelineObjects(S parent)
Returns an iterator over the children of the given parent timeline
object.
|
Iterator<ILayer> |
getLayers()
Returns an iterator over the layers used by the model.
|
Iterator<IRelationship<S>> |
getRelationships()
Returns all relationships so that they can be visualized by the
RelationshipLayer . |
Iterator<IRelationship<S>> |
getRelationships(S obj)
Returns those relationships that have the given timeline object either as
a source or as a target object.
|
Iterator<ISpreadsheet> |
getSpreadsheets()
Returns an iterator over the spreadsheets used by the model.
|
Object |
getSpreadsheetValue(ISpreadsheet spreadsheet,
T node,
ITimeSpan span)
Returns an object for the given tree node, the given spreadsheet and the
given time span.
|
Class |
getSpreadsheetValueType(ISpreadsheet spreadsheet,
T node,
ITimeSpan span)
Returns the type of the object shown within the specified spreadsheet
cell (specification via tree node, spreadsheet, time span).
|
TimelineObjectPath |
getTimelineObjectPath(T node,
S timelineObject,
ILayer layer)
Returns a timeline object path for the given node and object.
|
Iterator<S> |
getTimelineObjectsIterator(T node,
ILayer layer,
ITimeSpan span)
Returns an
Iterator that can be used to iterate over all timeline
objects stored on the given node and layer within the given time span. |
ITimeSpan |
getTimeSpan(S timelineObject)
Returns the time span of the given timeline object.
|
boolean |
isParentTimelineObject(S timelineObject)
Determines whether the given timeline object is a parent timeline object.
|
void |
removeGanttChartModelListener(IGanttChartModelListener l)
Removes a listener from the model.
|
void |
removeLayer(ILayer layer)
Removes a layer from the model.
|
void |
removeRelationship(IRelationship relationship)
Removes a single relationship from the model.
|
void |
removeRelationships(Collection<IRelationship> rel)
Removes a collection of relationships from the model.
|
void |
removeSpreadsheet(ISpreadsheet spreadsheet)
Removes a spreadsheet from the model.
|
void |
removeTimelineObject(T node,
ILayer layer,
S timelineObject)
Removes a single timeline object from the given node and layer.
|
void |
removeTimelineObjects(T node,
ILayer layer,
Collection<S> timelineObjects)
Removes a collection of objects from the given tree node and layer.
|
void |
setRelationships(Collection<IRelationship<S>> relationships)
Sets all relationships at once.
|
void |
setSpreadsheetValue(T node,
ISpreadsheet spreadsheet,
ITimeSpan span,
Object value)
Sets an object/value in a spreadsheet cell where the cell is specified by
the combination of the given tree table node, the spreadsheet and the
time span.
|
void |
setTimeSpan(S timelineObject,
ITimeSpan span)
Sets a new time span on the given timeline object.
|
void |
timelineObjectChanged(S timelineObject)
Triggers a
GanttChartModelEvent that informs listeners that the
given timeline object has been changed. |
addTreeTableModelListener, fireTreeNodeKeyChanged, fireTreeNodeValuesChanged, getColumnValue, getKey, getRoot, getRowHeaderValue, removeTreeTableModelListener, setColumnValue, setKey, setRoot, setRoot, setRowHeaderValue, sort, sort, sort, sort
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, valueForPathChanged
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTreeTableModelListener, getColumnValue, getKey, getRowHeaderValue, removeTreeTableModelListener, setColumnValue, setKey, sort
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
public DefaultGanttChartModel(T node, boolean asksAllowsChildren)
node
- the root nodeasksAllowsChildren
- if true, the node is allowed to have child nodes -- otherwise,
it is always a leaf nodepublic DefaultGanttChartModel(T node)
node
- the root nodepublic void addLayer(ILayer layer)
layer
- the layer to addpublic void removeLayer(ILayer layer)
layer
- the layer to removepublic Iterator<ILayer> getLayers()
IGanttChartModel
TimelineObjectLayer
for each layer
model definition.getLayers
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
IGanttChartModel.getTimelineObjectsIterator(Object, ILayer, ITimeSpan)
public void addGanttChartModelListener(IGanttChartModelListener l)
IGanttChartModel
addGanttChartModelListener
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
l
- the new listenerIGanttChartModel.removeGanttChartModelListener(IGanttChartModelListener)
,
GanttChartModelEvent
public void removeGanttChartModelListener(IGanttChartModelListener l)
IGanttChartModel
removeGanttChartModelListener
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
l
- the listener to removeIGanttChartModel.addGanttChartModelListener(IGanttChartModelListener)
public void fireGanttChartChanged(GanttChartModelEvent evt)
evt
- the model event to be issued to the listenersaddGanttChartModelListener(IGanttChartModelListener)
,
removeGanttChartModelListener(IGanttChartModelListener)
public void addTimelineObject(T node, ILayer layer, S timelineObject)
GanttChartModelEvent
to be fired where the ID of the event is
equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_ADDED
.node
- the tree node on which to add objectslayer
- the layer where the objects shall appeartimelineObject
- the object to addremoveTimelineObjects(IGanttChartNode, ILayer, Collection)
,
clearTimelineObjects(IGanttChartNode, ILayer)
,
getTimelineObjectsIterator(IGanttChartNode, ILayer, ITimeSpan)
public void addTimelineObjects(T node, ILayer layer, Collection<S> timelineObjects)
GanttChartModelEvent
to be fired where the ID of the event is
equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_ADDED
.node
- the tree node on which to add objectslayer
- the layer where the objects shall appeartimelineObjects
- the objects to addremoveTimelineObjects(IGanttChartNode, ILayer, Collection)
,
clearTimelineObjects(IGanttChartNode, ILayer)
,
getTimelineObjectsIterator(IGanttChartNode, ILayer, ITimeSpan)
public void clearTimelineObjects(T node, ILayer layer)
GanttChartModelEvent
to be fired with
the ID equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_REMOVED
.node
- the node on which to remove all timeline objectslayer
- the layer on which to remove all timeline objectsremoveTimelineObjects(IGanttChartNode, ILayer, Collection)
,
clearTimelineObjects()
,
clearTimelineObjects(ILayer)
,
clearTimelineObjects(IGanttChartNode)
public void clearTimelineObjects(T node)
GanttChartModelEvent
to be fired
with the ID equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_REMOVED
.node
- the node on which to remove all timeline objectsremoveTimelineObjects(IGanttChartNode, ILayer, Collection)
,
clearTimelineObjects()
,
clearTimelineObjects(ILayer)
,
clearTimelineObjects(IGanttChartNode, ILayer)
public void clearTimelineObjects(ILayer layer)
GanttChartModelEvent
to be fired with
the ID equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_REMOVED
.layer
- the layer on which to remove all timeline objectsremoveTimelineObjects(IGanttChartNode, ILayer, Collection)
,
clearTimelineObjects()
,
clearTimelineObjects(IGanttChartNode)
,
clearTimelineObjects(IGanttChartNode, ILayer)
public void clearTimelineObjects()
GanttChartModelEvent
to be fired with
the ID equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_REMOVED
.public Iterator<S> getTimelineObjectsIterator(T node, ILayer layer, ITimeSpan span)
IGanttChartModel
Iterator
that can be used to iterate over all timeline
objects stored on the given node and layer within the given time span.
This method is not allowed to return NULL.getTimelineObjectsIterator
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
node
- the tree node for which to return an iteratorlayer
- the layer for which to return an iteratorspan
- the time span for which to return an iteratorpublic ITimeSpan getTimeSpan(S timelineObject)
IGanttChartModel
DefaultGanttChartModel
does store the span on the internally used IGanttChartNode
instances.getTimeSpan
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
timelineObject
- the object for which to return the time spanpublic void removeTimelineObject(T node, ILayer layer, S timelineObject)
GanttChartModelEvent
to be fired with ID
equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_REMOVED
.node
- the tree node from which to remove objectslayer
- the layer from which to remove objectstimelineObject
- the object that will be removedremoveTimelineObjects(IGanttChartNode, ILayer, Collection)
public void removeTimelineObjects(T node, ILayer layer, Collection<S> timelineObjects)
GanttChartModelEvent
to be fired
with ID equal to GanttChartModelEvent.ID.TIMELINE_OBJECTS_REMOVED
.node
- the tree node from which to remove objectslayer
- the layer from which to remove objectstimelineObjects
- the objects that will be removedaddTimelineObjects(IGanttChartNode, ILayer, Collection)
,
clearTimelineObjects(IGanttChartNode, ILayer)
public void setTimeSpan(S timelineObject, ITimeSpan span)
GanttChartModelEvent
to be fired where the ID is
equal to GanttChartModelEvent.ID.TIMELINE_OBJECT_CHANGED
.timelineObject
- the target timeline objectspan
- the new time spangetTimeSpan(ITimelineObject)
public void addRelationship(IRelationship<S> relationship)
RelationshipLayer
to draw the lines and arrows between timeline
objects. Calling this method will cause a GanttChartModelEvent
to
be thrown (ID equals GanttChartModelEvent.ID.RELATIONSHIP_ADDED
).relationship
- the relationship object to addaddRelationships(Collection)
public void addRelationships(Collection<IRelationship<S>> relationships)
RelationshipLayer
to draw the lines and arrows
between timeline objects. Calling this method will cause a
GanttChartModelEvent
to be thrown where the ID is equal to
GanttChartModelEvent.ID.RELATIONSHIP_ADDED
.relationships
- the relationships that need to be addedremoveRelationships(Collection)
,
clearRelationships()
public void clearRelationships()
GanttChartModelEvent
to be thrown where the ID is equal to
GanttChartModelEvent.ID.RELATIONSHIP_REMOVED
.getRelationships()
,
addRelationships(Collection)
,
removeRelationships(Collection)
public Iterator<IRelationship<S>> getRelationships()
IGanttChartModel
RelationshipLayer
.getRelationships
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
public void setRelationships(Collection<IRelationship<S>> relationships)
relationships
- the new relationsips to usepublic Iterator<IRelationship<S>> getRelationships(S obj)
IGanttChartModel
RelationshipLayer
wants to
figure out which lines need to be drawn.getRelationships
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
obj
- the object for which to return relationshipspublic void removeRelationship(IRelationship relationship)
relationship
- the relationship to removeremoveRelationships(Collection)
public void removeRelationships(Collection<IRelationship> rel)
GanttChartModelEvent
to be thrown where the ID is
equal to GanttChartModelEvent.ID.RELATIONSHIP_REMOVED
.rel
- the relationships to removegetRelationships()
,
addRelationships(Collection)
,
clearRelationships()
public void timelineObjectChanged(S timelineObject)
GanttChartModelEvent
that informs listeners that the
given timeline object has been changed.timelineObject
- the object that was modifiedpublic TimelineObjectPath getTimelineObjectPath(T node, S timelineObject, ILayer layer)
node
- the Gantt chart nodetimelineObject
- the timeline objectlayer
- the layer on which the timeline object is displayedpublic Iterator<S> getChildrenTimelineObjects(S parent)
IGanttChartModel
getChildrenTimelineObjects
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
parent
- the parent timeline objectpublic boolean isParentTimelineObject(S timelineObject)
IGanttChartModel
isParentTimelineObject
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
timelineObject
- the timeline object to checkIGanttChartModel.getChildrenTimelineObjects(Object)
public void addSpreadsheet(ISpreadsheet spreadsheet)
spreadsheet
- the spreadsheet to addpublic void removeSpreadsheet(ISpreadsheet spreadsheet)
spreadsheet
- the spreadsheet to removepublic Iterator<ISpreadsheet> getSpreadsheets()
IGanttChartModel
SpreadsheetLayer
which is
capable of displaying one spreadsheet at a time.getSpreadsheets
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
public Object getSpreadsheetValue(ISpreadsheet spreadsheet, T node, ITimeSpan span)
IGanttChartModel
getSpreadsheetValue
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
spreadsheet
- the spreadsheet for which to return a value for the given node
and time spannode
- a node within the tree table on the left-hand side of the
Gantt chartspan
- the time span for which to return a value (the span is usually
a whole day, month, week ...)IGanttChartModel.getSpreadsheetValueType(ISpreadsheet, Object, ITimeSpan)
public Class getSpreadsheetValueType(ISpreadsheet spreadsheet, T node, ITimeSpan span)
IGanttChartModel
getSpreadsheetValueType
in interface IGanttChartModel<T extends IGanttChartNode<S>,S extends ITimelineObject>
spreadsheet
- the spreadsheet for which to return a value typenode
- a node within the tree table on the left-hand side of the
Gantt chartspan
- the time span for which to return a value type (the span is
usually a whole day, month, week ...)IGanttChartModel.getSpreadsheetValue(ISpreadsheet, Object, ITimeSpan)
public void setSpreadsheetValue(T node, ISpreadsheet spreadsheet, ITimeSpan span, Object value)
GanttChartModelEvent
to
be fired (ID = GanttChartModelEvent.ID.SPREADSHEET_VALUE_CHANGED
.node
- a node within the tree table on the left-hand side of the
Gantt chartspreadsheet
- the spreadsheet where the value gets editedspan
- the time span for which to set a value (usually a whole day,
month, week ...)value
- the new object/value for the spreadsheet cellCopyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.