org.mars_sim.msp.ui.standard.tool.monitor
Class EventTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.mars_sim.msp.ui.standard.tool.monitor.EventTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, HistoricalEventListener

public class EventTableModel
extends javax.swing.table.AbstractTableModel
implements HistoricalEventListener

This class provides a table model for use with the MonitorWindow that provides a mean to display the Historical Event. This is actually an Adapter onto the existing Event Manager.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
EventTableModel(HistoricalEventManager manager)
          Create a new Event model based on the specified event manager.
 
Method Summary
 void destroy()
          Prepares the model for deletion.
 void eventAdded(int index, HistoricalEvent event)
          A new event has been added at the specified manager.
 void eventsRemoved(int startIndex, int endIndex)
          A consequective sequence of events have been removed from the manager.
 java.lang.Class<?> getColumnClass(int columnIndex)
          Return the type of the column requested.
 int getColumnCount()
          Return the number of columns
 java.lang.String getColumnName(int columnIndex)
          Return the name of the column requested.
 java.lang.String getCountString()
          Gets the model count string.
 boolean getDisplayMalfunction()
          Checks if malfunction events are to be displayed.
 boolean getDisplayMedical()
          Checks if medical events are to be displayed.
 boolean getDisplayMission()
          Checks if mission events are to be displayed.
 boolean getDisplaySupply()
          Checks if supply events are to be displayed.
 boolean getDisplayTask()
          Checks if task events are to be displayed.
 java.lang.String getName()
          Get the name of the model.
 java.lang.Object getObject(int row)
          Get the unit at the specified row.
 boolean getOrdered()
          Is this model already ordered according to some external criteria.
 int getRowCount()
          Get the number of rows in the model.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Return the value of a Cell
 void setDisplayMalfunction(boolean display)
          Sets if malfunction events are to be displayed.
 void setDisplayMedical(boolean display)
          Sets if medical events are to be displayed.
 void setDisplayMission(boolean display)
          Sets if mission events are to be displayed.
 void setDisplaySupply(boolean display)
          Sets if supply events are to be displayed.
 void setDisplayTask(boolean display)
          Sets if task events are to be displayed.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

EventTableModel

public EventTableModel(HistoricalEventManager manager)
Create a new Event model based on the specified event manager.

Parameters:
manager - Manager to extract events from.
Method Detail

getColumnCount

public int getColumnCount()
Return the number of columns

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
column count.

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Return the type of the column requested.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - Index of column.
Returns:
Class of specified column.

getColumnName

public java.lang.String getColumnName(int columnIndex)
Return the name of the column requested.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - Index of column.
Returns:
name of specified column.

getName

public java.lang.String getName()
Get the name of the model.

Returns:
model name.

getRowCount

public int getRowCount()
Get the number of rows in the model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
the number of Events.

getObject

public java.lang.Object getObject(int row)
Get the unit at the specified row.

Parameters:
row - Indexes of Unit to retrieve.
Returns:
Unit associated with the Event as the specified position.

getOrdered

public boolean getOrdered()
Is this model already ordered according to some external criteria.

Returns:
TRUE as the events are time ordered.

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Return the value of a Cell

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - Row index of the cell.
columnIndex - Column index of the cell.

getCountString

public java.lang.String getCountString()
Gets the model count string.


eventAdded

public void eventAdded(int index,
                       HistoricalEvent event)
A new event has been added at the specified manager.

Specified by:
eventAdded in interface HistoricalEventListener
Parameters:
index - Index of new event in the manager.
event - The new event added.

eventsRemoved

public void eventsRemoved(int startIndex,
                          int endIndex)
A consequective sequence of events have been removed from the manager.

Specified by:
eventsRemoved in interface HistoricalEventListener
Parameters:
startIndex - First exclusive index of the event to be removed.
endIndex - Last exclusive index of the event to be removed..

getDisplayMalfunction

public boolean getDisplayMalfunction()
Checks if malfunction events are to be displayed.

Returns:
true if displayed

setDisplayMalfunction

public void setDisplayMalfunction(boolean display)
Sets if malfunction events are to be displayed.

Parameters:
display - true if displayed

getDisplayMedical

public boolean getDisplayMedical()
Checks if medical events are to be displayed.

Returns:
true if displayed

setDisplayMedical

public void setDisplayMedical(boolean display)
Sets if medical events are to be displayed.

Parameters:
display - true if displayed

getDisplayMission

public boolean getDisplayMission()
Checks if mission events are to be displayed.

Returns:
true if displayed

setDisplayMission

public void setDisplayMission(boolean display)
Sets if mission events are to be displayed.

Parameters:
display - true if displayed

getDisplayTask

public boolean getDisplayTask()
Checks if task events are to be displayed.

Returns:
true if displayed

setDisplayTask

public void setDisplayTask(boolean display)
Sets if task events are to be displayed.

Parameters:
display - true if displayed

getDisplaySupply

public boolean getDisplaySupply()
Checks if supply events are to be displayed.

Returns:
true if displayed

setDisplaySupply

public void setDisplaySupply(boolean display)
Sets if supply events are to be displayed.

Parameters:
display - true if displayed

destroy

public void destroy()
Prepares the model for deletion.