JIDE 3.5.15

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

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

public abstract class AbstractGanttModel<T,S extends GanttEntry<T>>
extends Object
implements GanttModel<T,S>, Serializable

This abstract class provides default implementations for most of the methods in the GanttModel interface. It takes care of the management of listeners and provides some conveniences for generating GanttModelEvents and dispatching them to the listeners. To create a concrete GanttModel as a subclass of AbstractGanttModel you need only provide implementations for the following four methods:

 public ITreeTableModel getTreeTableModel();
 public Range getRange();
 public ScaleModel getScaleModel();
 public GanttEntryRelationModel getGanttEntryRelationModel();
 

See Also:
Serialized Form

Field Summary
protected  EventListenerList listenerList
          List of listeners
 
Constructor Summary
protected AbstractGanttModel()
           
 
Method Summary
 void addGanttModelListener(GanttModelListener l)
          Adds a listener to the list that's notified each time a change to the gantt model occurs.
 void fireGanttChanged(GanttModelEvent e)
          Forwards the given notification event to all GanttModelListeners that registered themselves as listeners for this gantt model.
 void fireGanttDataChanged()
          Notifies all listeners that all gantt enties may have changed.
 void fireGanttEntriesDeleted(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.
 void fireGanttEntriesInserted(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.
 void fireGanttEntriesUpdated(int firstRow, int lastRow)
          Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.
 S getEntryAt(int index)
          Gets the entry at the entry index.
 int getEntryCount()
          Gets the total entry count.
 GanttModelListener[] getGanttModelListeners()
          Returns an array of all the gantt model listeners registered on this model.
 int getIndexOf(S entry)
          Gets the index of the entry.
 void removeGanttModelListener(GanttModelListener l)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.gantt.GanttModel
getGanttEntryRelationModel, getRange, getScaleModel, getTreeTableModel
 

Field Detail

listenerList

protected EventListenerList listenerList
List of listeners

Constructor Detail

AbstractGanttModel

protected AbstractGanttModel()
Method Detail

getEntryCount

public int getEntryCount()
Description copied from interface: GanttModel
Gets the total entry count.

Please note, if an entry has children and the entry itself is collapsed, the children will not be included in the total entry count.

Specified by:
getEntryCount in interface GanttModel<T,S extends GanttEntry<T>>
Returns:
the total entry count.

getEntryAt

public S getEntryAt(int index)
Description copied from interface: GanttModel
Gets the entry at the entry index.

Specified by:
getEntryAt in interface GanttModel<T,S extends GanttEntry<T>>
Parameters:
index - the entry index.
Returns:
Returns the GanttEntry at the index or null if the index is out of bounds.

getIndexOf

public int getIndexOf(S entry)
Description copied from interface: GanttModel
Gets the index of the entry.

Specified by:
getIndexOf in interface GanttModel<T,S extends GanttEntry<T>>
Parameters:
entry - the entry
Returns:
the index.

addGanttModelListener

public void addGanttModelListener(GanttModelListener l)
Adds a listener to the list that's notified each time a change to the gantt model occurs.

Specified by:
addGanttModelListener in interface GanttModel<T,S extends GanttEntry<T>>
Parameters:
l - the GanttModelListener

removeGanttModelListener

public void removeGanttModelListener(GanttModelListener l)
Removes a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeGanttModelListener in interface GanttModel<T,S extends GanttEntry<T>>
Parameters:
l - the GanttModelListener

getGanttModelListeners

public GanttModelListener[] getGanttModelListeners()
Returns an array of all the gantt model listeners registered on this model.

Returns:
all of this model's GanttModelListeners or an empty array if no gantt model listeners are currently registered
See Also:
addGanttModelListener(com.jidesoft.gantt.GanttModelListener), removeGanttModelListener(com.jidesoft.gantt.GanttModelListener)

fireGanttDataChanged

public void fireGanttDataChanged()
Notifies all listeners that all gantt enties may have changed. The number of gantt enties may also have changed and the GanttChart should redraw the chart from scratch.

See Also:
GanttModelEvent, EventListenerList

fireGanttEntriesInserted

public void fireGanttEntriesInserted(int firstRow,
                                     int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.

Parameters:
firstRow - the first row
lastRow - the last row
See Also:
GanttModelEvent, EventListenerList

fireGanttEntriesUpdated

public void fireGanttEntriesUpdated(int firstRow,
                                    int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.

Parameters:
firstRow - the first row
lastRow - the last row
See Also:
GanttModelEvent, EventListenerList

fireGanttEntriesDeleted

public void fireGanttEntriesDeleted(int firstRow,
                                    int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.

Parameters:
firstRow - the first row
lastRow - the last row
See Also:
GanttModelEvent, EventListenerList

fireGanttChanged

public void fireGanttChanged(GanttModelEvent e)
Forwards the given notification event to all GanttModelListeners that registered themselves as listeners for this gantt model.

Parameters:
e - the event to be forwarded
See Also:
addGanttModelListener(com.jidesoft.gantt.GanttModelListener), GanttModelEvent, EventListenerList

JIDE 3.5.15