|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.table.AbstractTableModel
This abstract class provides default implementations for most of the methods in the TableModel interface. It takes care of the management of listners and provides some conveniences for generating TableModelEvents and dispatching them to the listeners. To create a concrete TableModel as a sublcass of AbstractTableModel you need only provide implementations for the following three methods:
public int getRowCount(); public int getColumnCount(); public Object getValueAt(int row, int column);
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Field Summary | |
protected EventListenerList |
listenerList
List of listeners |
Constructor Summary | |
AbstractTableModel()
|
Method Summary | |
void |
addTableModelListener(TableModelListener l)
Add a listener to the list that's notified each time a change to the data model occurs. |
int |
findColumn(String columnName)
Convenience method for locating columns by name. |
void |
fireTableCellUpdated(int row,
int column)
Notify all listeners that the value of the cell at (row, column) has been updated. |
void |
fireTableChanged(TableModelEvent e)
Forward the given notification event to all TableModelListeners that registered themselves as listeners for this table model. |
void |
fireTableDataChanged()
Notify all listeners that all cell values in the table's rows may have changed. |
void |
fireTableRowsDeleted(int firstRow,
int lastRow)
Notify all listeners that rows in the (inclusive) range [firstRow, lastRow] have been deleted. |
void |
fireTableRowsInserted(int firstRow,
int lastRow)
Notify all listeners that rows in the (inclusive) range [firstRow, lastRow] have been inserted. |
void |
fireTableRowsUpdated(int firstRow,
int lastRow)
Notify all listeners that rows in the (inclusive) range [firstRow, lastRow] have been updated. |
void |
fireTableStructureChanged()
Notify all listeners that the table's structure has changed. |
Class |
getColumnClass(int columnIndex)
Returns Object.class by default |
String |
getColumnName(int column)
Return a default name for the column using spreadsheet conventions: A, B, C, ... |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
This default implementation returns false for all cells |
void |
removeTableModelListener(TableModelListener l)
Remove a listener from the list that's notified each time a change to the data model occurs. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
This empty implementation is provided so users don't have to implement this method if their data model is not editable. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected EventListenerList listenerList
Constructor Detail |
public AbstractTableModel()
Method Detail |
public String getColumnName(int column)
columnIndex
- the index of columnpublic int findColumn(String columnName)
public Class getColumnClass(int columnIndex)
public boolean isCellEditable(int rowIndex, int columnIndex)
rowIndex
- the row whose value is to be looked upcolumnIndex
- the column whose value is to be looked upTableModel.setValueAt(java.lang.Object, int, int)
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changedTableModel.getValueAt(int, int)
,
TableModel.isCellEditable(int, int)
public void addTableModelListener(TableModelListener l)
l
- the TableModelListenerpublic void removeTableModelListener(TableModelListener l)
l
- the TableModelListenerpublic void fireTableDataChanged()
TableModelEvent
,
EventListenerList
public void fireTableStructureChanged()
setModel(TableModel)
on the JTable.TableModelEvent
,
EventListenerList
public void fireTableRowsInserted(int firstRow, int lastRow)
TableModelEvent
,
EventListenerList
public void fireTableRowsUpdated(int firstRow, int lastRow)
TableModelEvent
,
EventListenerList
public void fireTableRowsDeleted(int firstRow, int lastRow)
TableModelEvent
,
EventListenerList
public void fireTableCellUpdated(int row, int column)
TableModelEvent
,
EventListenerList
public void fireTableChanged(TableModelEvent e)
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |