com.sun.faban.common
Class TableModel

java.lang.Object
  extended by com.sun.faban.common.TableModel
Direct Known Subclasses:
SortableTableModel

public class TableModel
extends Object

A table model used for representing table results both in the Faban results and in the web interface.

Author:
akara

Constructor Summary
TableModel(int columns)
          Constructs a TableModel.
TableModel(int columns, int rowInitCapacity)
          Constructs a TableModel.
 
Method Summary
 int columns()
          Obtains the number of columns the table is defined for.
 Comparable getField(int row, int column)
          Obtains the field at the given row and column index.
 String getHeader(int column)
          Obtains the header for a given column.
 String[] getHeaders()
          Obtains all column headers.
 Comparable[] getRow(int row)
          Ontains all fields in a given row.
 Comparable[] newRow()
          Adds a new row to the table model.
 int rows()
          Obtains the number of rows currently in the table.
 void setHeader(int column, String header)
          Sets the header for a given column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModel

public TableModel(int columns)
Constructs a TableModel.

Parameters:
columns - The number of columns in the table

TableModel

public TableModel(int columns,
                  int rowInitCapacity)
Constructs a TableModel.

Parameters:
columns - The number of columns in the table
rowInitCapacity - The initial row capacity of the table
Method Detail

columns

public int columns()
Obtains the number of columns the table is defined for.

Returns:
The number of columns in the table

getField

public Comparable getField(int row,
                           int column)
Obtains the field at the given row and column index.

Parameters:
row - The row index
column - The column index
Returns:
The field at the given location

getHeader

public String getHeader(int column)
Obtains the header for a given column.

Parameters:
column - The column to get the header
Returns:
The header at that column

getHeaders

public String[] getHeaders()
Obtains all column headers.

Returns:
All column headers, as an array

getRow

public Comparable[] getRow(int row)
Ontains all fields in a given row.

Parameters:
row - The row
Returns:
The fields, as an array

newRow

public Comparable[] newRow()
Adds a new row to the table model.

Returns:
The modifyable array representing the row

rows

public int rows()
Obtains the number of rows currently in the table.

Returns:
The number of rows in the table

setHeader

public void setHeader(int column,
                      String header)
Sets the header for a given column.

Parameters:
column - The column
header - The header