edu.upenn.crimson
Class ModelTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by edu.upenn.crimson.ModelTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class ModelTableModel
extends javax.swing.table.AbstractTableModel

ModelTableModel. This is a TableModel that is used by ModelManager to list the models. It is maintained here so that it can be updated easily whenever the model list is rebuilt.

Version:
$Id: ModelTableModel.java,v 1.3 2007/05/16 18:55:58 fisher Exp $
See Also:
Serialized Form

Field Summary
private  java.lang.String[] columnNames
           
private  java.util.ArrayList models
          Stores the Models that are in the table.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ModelTableModel()
           
 
Method Summary
 void addRow(Model model)
          Append a new row to the end of the table.
 void addRowAt(Model model, int row)
          Add new row to table.
 int getColumnCount()
           
 java.lang.String getColumnName(int col)
           
 Model getRow(int row)
          Returns the Model that represents the specified row in the table.
 int getRowCount()
           
 java.lang.Object getValueAt(int row, int col)
          "ID", "Notes"
 void removeAllRows()
          Removes all rows from the table.
 void removeRow(int row)
          Removes the Model that represents the specified row in the table.
 void removeRows(int[] rows)
          Removes the Models that represent the rows specified.
 void removeRows(int minRow, int maxRow)
          Removes the Models that represent the specified row in the table.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

models

private java.util.ArrayList models
Stores the Models that are in the table.


columnNames

private java.lang.String[] columnNames
Constructor Detail

ModelTableModel

public ModelTableModel()
Method Detail

addRow

public void addRow(Model model)
Append a new row to the end of the table.


addRowAt

public void addRowAt(Model model,
                     int row)
Add new row to table. If row index is '-1' then add to end of table.


getRow

public Model getRow(int row)
Returns the Model that represents the specified row in the table.


removeRow

public void removeRow(int row)
Removes the Model that represents the specified row in the table.


removeRows

public void removeRows(int[] rows)
Removes the Models that represent the rows specified.


removeRows

public void removeRows(int minRow,
                       int maxRow)
Removes the Models that represent the specified row in the table. If the row is -1 then will clear the entire table.


removeAllRows

public void removeAllRows()
Removes all rows from the table.


getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

getColumnName

public java.lang.String getColumnName(int col)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
"ID", "Notes"




Copyright 2006 Stephen Fisher, Susan Davidson, and Junhyong Kim, University of Pennsylvania.