net.sourceforge.bee
Class ChapterTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by net.sourceforge.bee.ChapterTableModel
All Implemented Interfaces:
Serializable, TableModel

public class ChapterTableModel
extends AbstractTableModel

A TableModel for displaying all the questions in a chapter.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ChapterTableModel(Question[] arr)
          Creates a new ChapterTableModel instance.
 
Method Summary
 Class getColumnClass(int i)
          Describe getColumnClass method here.
 int getColumnCount()
          Returns number of columns for table.
 String getColumnName(int i)
          Returns user-readable column names for JTable.
 int getRowCount()
          Returns number of questions in chapter.
 Object getValueAt(int row, int col)
          Picks the appropriate value out of the list of questions to display in the JTable.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Implemented to always return true.
 void setValueAt(Object val, int row, int col)
          Sets the appropriate value in the question corresponding to the edited row.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChapterTableModel

public ChapterTableModel(Question[] arr)
Creates a new ChapterTableModel instance.

Parameters:
arr[] - a Question value
Method Detail

getColumnClass

public Class getColumnClass(int i)
Describe getColumnClass method here.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
i - an int value
Returns:
a Class value

getColumnCount

public int getColumnCount()
Returns number of columns for table.

Returns:
an int value

getRowCount

public int getRowCount()
Returns number of questions in chapter.

Returns:
an int value

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Implemented to always return true.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
rowIndex - an int value
columnIndex - an int value
Returns:
a boolean value

getValueAt

public Object getValueAt(int row,
                         int col)
Picks the appropriate value out of the list of questions to display in the JTable.

Parameters:
row - an int value
col - an int value
Returns:
an Object value

setValueAt

public void setValueAt(Object val,
                       int row,
                       int col)
Sets the appropriate value in the question corresponding to the edited row.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
val - an Object value
row - an int value
col - an int value

getColumnName

public String getColumnName(int i)
Returns user-readable column names for JTable.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
i - an int value
Returns:
a String value