jist.runtime.guilog
Class GuiLog.EventTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jist.runtime.guilog.GuiLog.EventTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Enclosing class:
GuiLog

public static class GuiLog.EventTableModel
extends javax.swing.table.AbstractTableModel

The EventTableModel class is the data model for the JTable.

See Also:
Serialized Form

Field Summary
private  GuiLog.EventNode[] events
          Array containing the Events.
private  int numEvents
          Number of Events.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
GuiLog.EventTableModel()
          The EventTableModel's constructor initializes the two members.
 
Method Summary
 void add(Event ev, Event parent)
          Add an event to the table's data model.
 void del(Event ev)
          Delete an event from the table's data model.
private  void ensureCapacity()
          If events[] is too small, increase the size.
 GuiLog.EventNode findNode(Event ev)
          Given an Event, returns the corresponding EventNode in the events[] array.
 int findNodeIndex(Event ev)
          Given an Event, returns the index of the events[] array where that Event is located.
 int getChildIndex(int index, int childNum)
          Given an EventNode's index and a Child number, returns the specified Child EventNode's index in the events[] array.
 int getColumnCount()
          Returns the number of columns in the table.
 int getParentIndex(int index)
          Given an EventNode's index, returns the Parent EventNode's index in the events[] array.
 int getRowCount()
          Returns the number of rows in the table.
 java.lang.Object getValueAt(int row, int col)
          Returns the EventNode corresponding to the requested row.
 boolean isCellEditable(int row, int col)
          Returns whether the cell at (row,col) is editable or not.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

events

private GuiLog.EventNode[] events
Array containing the Events.


numEvents

private int numEvents
Number of Events.

Constructor Detail

GuiLog.EventTableModel

public GuiLog.EventTableModel()
The EventTableModel's constructor initializes the two members.

Method Detail

findNode

public GuiLog.EventNode findNode(Event ev)
Given an Event, returns the corresponding EventNode in the events[] array.

Parameters:
ev - Event The Event being located.
Returns:
EventNode The desired EventNode containing the Event.

findNodeIndex

public int findNodeIndex(Event ev)
Given an Event, returns the index of the events[] array where that Event is located.

Parameters:
ev - Event The desired Event.
Returns:
int The index of the events[] array where the desired Event is located.

getParentIndex

public int getParentIndex(int index)
Given an EventNode's index, returns the Parent EventNode's index in the events[] array. This is also equivalent to the table row number.

Parameters:
index - int The index of the EventNode.
Returns:
int The index of the EventNode's Parent EventNode.

getChildIndex

public int getChildIndex(int index,
                         int childNum)
Given an EventNode's index and a Child number, returns the specified Child EventNode's index in the events[] array. This is also equivalent to the table row number.

Parameters:
index - int The index of the EventNode.
childNum - int The number of the desired Child EventNode.
Returns:
int The specified Child EventNode's index in the events[] array.

add

public void add(Event ev,
                Event parent)
Add an event to the table's data model.

Parameters:
ev - Event The Event that is being added.
parent - Event The Event's Parent Event.

del

public void del(Event ev)
Delete an event from the table's data model.

Parameters:
ev - Event The Event that is being deleted.

ensureCapacity

private void ensureCapacity()
If events[] is too small, increase the size.


getRowCount

public int getRowCount()
Returns the number of rows in the table. Overrided to comply with AbstractTableModel Class.

Returns:
int

getColumnCount

public int getColumnCount()
Returns the number of columns in the table. Overrided to comply with AbstractTableModel Class.

Returns:
int

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Returns the EventNode corresponding to the requested row. This method is called internally by the TableCellRenderer Class. Overrided to comply with AbstractTableModel Class.

Parameters:
row - int
col - int
Returns:
Object The EventNode corresponding to the requested row.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Returns whether the cell at (row,col) is editable or not. Overrided to comply with AbstractTableModel Class.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - int
col - int
Returns:
boolean