charvax.swing.table
Class AbstractTableModel

java.lang.Object
  extended bycharvax.swing.table.AbstractTableModel
All Implemented Interfaces:
TableModel
Direct Known 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);
 


Constructor Summary
AbstractTableModel()
           
 
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.
 java.lang.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(java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface charvax.swing.table.TableModel
getColumnCount, getValueAt
 

Constructor Detail

AbstractTableModel

public AbstractTableModel()
Method Detail

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

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
Removes the specified listener from the list of listeners.

Specified by:
removeTableModelListener in interface TableModel

getColumnName

public java.lang.String getColumnName(int column_)
Returns a default name for the column using spreadsheet conventions: A, B, C...

Specified by:
getColumnName in interface TableModel

setValueAt

public void setValueAt(java.lang.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

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

fireTableCellUpdated

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


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.


getRowCount

public abstract int getRowCount()
Get the number of rows in the model.

Specified by:
getRowCount in interface TableModel