charvax.swing.table

Class AbstractTableModel

Implemented Interfaces:
TableModel
Known Direct Subclasses:
DefaultTableModel

public abstract class AbstractTableModel
extends java.lang.Object
implements TableModel

This abstract class provides default implementations for most of the methods in the TableModel class. It takes care of the management of listeners, and provides some convenience methods for generating TableModeEvents and dispatching them to the listeners. To implement a concrete TableModel as a subclass of AbstractTableModel, you only need to provide implementations of the following methods:
 public int getRowCount();
 public int getColumnCount();
 public Object getValueAt(int row, int column);
 

Method Summary

void
addTableModelListener(TableModelListener l)
Adds a listener that will be notified each time the data model changes.
void
fireTableCellUpdated(int row_, int column_)
Notifies all listeners that the value at [row, column] has been updated.
void
fireTableChanged(TableModelEvent evt_)
Forwards the specified event to all TableModelListeners that registered themselves as listeners for this TableModel.
void
fireTableDataChanged()
Notifies all listeners that all cell values in the table may have changed.
void
fireTableRowsDeleted(int firstRow_, int lastRow_)
Notifies all listeners that rows in the range [firstRow_, lastRow_], inclusive, have been deleted.
void
fireTableRowsInserted(int firstRow_, int lastRow_)
Notifies all listeners that rows in the range [firstRow_, lastRow_], inclusive, have been inserted.
String
getColumnName(int column_)
Returns a default name for the column using spreadsheet conventions: A, B, C...
abstract int
getRowCount()
Get the number of rows in the model.
void
removeTableModelListener(TableModelListener l)
Removes the specified listener from the list of listeners.
void
setValueAt(Object value_, int row_, int column_)
This empty implementation is provided so that users don't have to provide their own implementation if their table is not editable.

Method Details

addTableModelListener

public void addTableModelListener(TableModelListener l)
Adds a listener that will be notified each time the data model changes.
Specified by:
addTableModelListener in interface TableModel

fireTableCellUpdated

public void fireTableCellUpdated(int row_,
                                 int column_)
Notifies all listeners that the value at [row, column] has been updated.

fireTableChanged

public void fireTableChanged(TableModelEvent evt_)
Forwards the specified event to all TableModelListeners that registered themselves as listeners for this TableModel.
Specified by:
fireTableChanged in interface TableModel

fireTableDataChanged

public void fireTableDataChanged()
Notifies all listeners that all cell values in the table may have changed.

fireTableRowsDeleted

public void fireTableRowsDeleted(int firstRow_,
                                 int lastRow_)
Notifies all listeners that rows in the range [firstRow_, lastRow_], inclusive, have been deleted.

fireTableRowsInserted

public void fireTableRowsInserted(int firstRow_,
                                  int lastRow_)
Notifies all listeners that rows in the range [firstRow_, lastRow_], inclusive, have been inserted.

getColumnName

public String getColumnName(int column_)
Returns a default name for the column using spreadsheet conventions: A, B, C...
Specified by:
getColumnName in interface TableModel

getRowCount

public abstract int getRowCount()
Get the number of rows in the model.
Specified by:
getRowCount in interface TableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
Removes the specified listener from the list of listeners.
Specified by:
removeTableModelListener in interface TableModel

setValueAt

public void setValueAt(Object value_,
                       int row_,
                       int column_)
This empty implementation is provided so that users don't have to provide their own implementation if their table is not editable.
Specified by:
setValueAt in interface TableModel