JIDE 3.5.15

com.jidesoft.gantt
Class DefaultGanttModel<T,S extends GanttEntry<T>>

java.lang.Object
  extended by com.jidesoft.gantt.AbstractGanttModel<T,S>
      extended by com.jidesoft.gantt.DefaultGanttModel<T,S>
Type Parameters:
T - The type of the bases unit of the scale, for example Date or Integer.
S - The type of the GanttEntry in the model.
All Implemented Interfaces:
GanttModel<T,S>, Serializable

public class DefaultGanttModel<T,S extends GanttEntry<T>>
extends AbstractGanttModel<T,S>

DefaultGanttModel is an implementation of GanttModel that uses a TreeTableModel to store the gantt entries. For the GanttEntryRelationModel, it uses DefaultGanttEntryRelationModel. For the ScaleMode, user can set it using setter.

The range of the DefaultGanttModel is calculated automatically by default based on its gantt entries. However user can call setAutoUpdateRange(boolean) and set it to false if he/she wants to set the range manually.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jidesoft.gantt.AbstractGanttModel
listenerList
 
Constructor Summary
DefaultGanttModel()
           
DefaultGanttModel(ITreeTableModel<S> treeTableModel)
           
 
Method Summary
 void addGanttEntry(S entry)
           
protected  DefaultGanttEntryRelationModel<S> createGanttEntryRelationModel()
           
 GanttEntryRelationModel<S> getGanttEntryRelationModel()
          Gets the model that defines the relationship among gantt entries.
 Range<T> getRange()
          Gets the range of the GanttModel.
 ScaleModel<T> getScaleModel()
          Gets the ScaleModel.
 ITreeTableModel<S> getTreeTableModel()
          Returns the TreeTableModel instance.
 boolean isAutoUpdateRange()
           
protected  boolean isRangeColumn(int columnIndex)
          Checks if the column index is a range column such as range start or range end or any other column that will affect the calculation of the range.
 void removeGanttEntry(S entry)
           
 void setAutoUpdateRange(boolean autoUpdateRanged)
          Whether the GanttModel Range should be automatically updated to fit the GanttEntry Ranges.
 void setGanttEntryRelationModel(GanttEntryRelationModel<S> ganttEntryRelationModel)
           
 void setRange(Range<T> range)
           
 void setScaleModel(ScaleModel<T> scaleModel)
           
 void setTreeTableModel(ITreeTableModel<S> treeTableModel)
           
static
<T> void
union(Range<T> targetRange, Expandable parent)
          NOTE: This method will do nothing if the current Range is null!
static
<T> void
union(Range<T> targetRange, Expandable parent, GanttEntry<T> child)
          NOTE: This method will do nothing if the current Range is null!
protected  void updateRange(TableModelEvent e)
          Updates the Range to the union of all the root child GanttEntries.
 
Methods inherited from class com.jidesoft.gantt.AbstractGanttModel
addGanttModelListener, fireGanttChanged, fireGanttDataChanged, fireGanttEntriesDeleted, fireGanttEntriesInserted, fireGanttEntriesUpdated, getEntryAt, getEntryCount, getGanttModelListeners, getIndexOf, removeGanttModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGanttModel

public DefaultGanttModel()

DefaultGanttModel

public DefaultGanttModel(ITreeTableModel<S> treeTableModel)
Method Detail

createGanttEntryRelationModel

protected DefaultGanttEntryRelationModel<S> createGanttEntryRelationModel()

getTreeTableModel

public ITreeTableModel<S> getTreeTableModel()
Description copied from interface: GanttModel
Returns the TreeTableModel instance.

The returned model should also be a TableModel instance! Enforcing this through the type system would introduce another generic type.

Returns:
The TreeTableModel to be displayed in the TreeTable of the GanttChartPane.

setTreeTableModel

public void setTreeTableModel(ITreeTableModel<S> treeTableModel)

isRangeColumn

protected boolean isRangeColumn(int columnIndex)
Checks if the column index is a range column such as range start or range end or any other column that will affect the calculation of the range.

Parameters:
columnIndex - the column index.
Returns:
true if the specified column index is related to the range.

updateRange

protected void updateRange(TableModelEvent e)
Updates the Range to the union of all the root child GanttEntries.

Parameters:
e - the TableModelEvent

setAutoUpdateRange

public void setAutoUpdateRange(boolean autoUpdateRanged)
Whether the GanttModel Range should be automatically updated to fit the GanttEntry Ranges. Defaults to true.

Parameters:
autoUpdateRanged - true to automatically update the Range.

isAutoUpdateRange

public boolean isAutoUpdateRange()

getRange

public Range<T> getRange()
Description copied from interface: GanttModel
Gets the range of the GanttModel. It is the union of the ranges in all the gantt entries.

Returns:
the range.

setRange

public void setRange(Range<T> range)

getScaleModel

public ScaleModel<T> getScaleModel()
Description copied from interface: GanttModel
Gets the ScaleModel.

Returns:
the ScaleModel.

setScaleModel

public void setScaleModel(ScaleModel<T> scaleModel)

getGanttEntryRelationModel

public GanttEntryRelationModel<S> getGanttEntryRelationModel()
Description copied from interface: GanttModel
Gets the model that defines the relationship among gantt entries.

Returns:
the GanttEntryRelationModel.

setGanttEntryRelationModel

public void setGanttEntryRelationModel(GanttEntryRelationModel<S> ganttEntryRelationModel)

addGanttEntry

public void addGanttEntry(S entry)

removeGanttEntry

public void removeGanttEntry(S entry)

union

public static <T> void union(Range<T> targetRange,
                             Expandable parent,
                             GanttEntry<T> child)
NOTE: This method will do nothing if the current Range is null!

Type Parameters:
T - The type of the bases unit of the scale, for example Date or Integer.
Parameters:
targetRange - the target range.
parent - the parent
child - the child

union

public static <T> void union(Range<T> targetRange,
                             Expandable parent)
NOTE: This method will do nothing if the current Range is null!

Type Parameters:
T - The type of the bases unit of the scale, for example Date or Integer.
Parameters:
targetRange - the target range
parent - the parent

JIDE 3.5.15