org.jurvis.swing.table
Class JvDefaultObjectTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.jurvis.swing.table.JvAbstractObjectTableModel
          extended by org.jurvis.swing.table.JvDefaultObjectTableModel
All Implemented Interfaces:
Serializable, TableModel, JvObjectTableModel

public class JvDefaultObjectTableModel
extends JvAbstractObjectTableModel

A JvObjectTableModel is a TableModel in which each row is actually a single object (which implements JvObjectTableRow. The columns of a row typically represent different fields of the row object.

Use JvMappedObjectTableModel instead of this class because JvMappedObjectTableModel does not need a a JvObjectTableRow object needed for each row.

Author:
Neil W. Weber
See Also:
JvObjectTableRow, Serialized Form

Field Summary
protected  List rowData
          The List of JvObjectTableRow objects.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
JvDefaultObjectTableModel(List rowData)
          Construct a JvObjectTableModel with the given row data.
 
Method Summary
 void addRow(JvObjectTableRow row)
          Adds a row to the end of the model.
protected  JvObjectTableRow getRowAt(int row)
          Return the JvObjectTableRow for the specified row.
 int getRowCount()
          Returns the number of rows in this data table.
 void remove(int row, int col)
          Method called when the drop operation is MOVE.
 void removeRow(int row)
          Removes the row at row from the model.
 
Methods inherited from class org.jurvis.swing.table.JvAbstractObjectTableModel
getColumnClass, getColumnCount, getEmptyCollection, getObjectAt, getValueAt, isCellEditable, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
 
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, getColumnName, removeTableModelListener
 

Field Detail

rowData

protected List rowData
The List of JvObjectTableRow objects.

Constructor Detail

JvDefaultObjectTableModel

public JvDefaultObjectTableModel(List rowData)
Construct a JvObjectTableModel with the given row data.

Parameters:
rowData - the List containing the data of this model
Method Detail

getRowAt

protected final JvObjectTableRow getRowAt(int row)
Return the JvObjectTableRow for the specified row.

Specified by:
getRowAt in class JvAbstractObjectTableModel
Parameters:
row - the index of the desired row
Returns:
the JvObjectTableRow for the specified row

getRowCount

public int getRowCount()
Returns the number of rows in this data table.

Returns:
the number of rows in the model

addRow

public void addRow(JvObjectTableRow row)
Adds a row to the end of the model. Notification of the row being added will be generated.

Parameters:
row - data of the row being added

removeRow

public void removeRow(int row)
Removes the row at row from the model. Notification of the row being removed will be sent to all the listeners.

Parameters:
row - the row index of the row to be removed

remove

public void remove(int row,
                   int col)
Method called when the drop operation is MOVE. For a JvObjectTableModel, each row corresponds to a single object, so the column index is ignored and removeRow(int) is called.

Parameters:
row - the row index of the data that will be removed
col - the column index of the data that will be removed


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.