Packageorg.aswing.table
Classpublic class AbstractTableModel
ImplementsTableModel
SubclassesDefaultTableModel, PropertyTableModel, TableSorter

This abstract class provides default implementations for most of the methods in the TableModel interface. It takes care of the management of listeners and provides some conveniences for generating TableModelEvents and dispatching them to the listeners. To create a concrete TableModel as a subclass of AbstractTableModel you need only provide implementations for the following three methods:
  public function getRowCount():Number;
  public function getColumnCount():Number;
  public function getValueAt(row:Number, column:Number);
  



Protected Properties
 PropertyDefined by
  columnClasses : Array
AbstractTableModel
  listenerList : Array
List of listeners
AbstractTableModel
Public Methods
 MethodDefined by
  
AbstractTableModel
  
Adds a listener to the list that's notified each time a change to the data model occurs.
AbstractTableModel
  
findColumn(columnName:String):int
Returns a column given its name.
AbstractTableModel
  
getColumnClass(columnIndex:int):String
Returns class name regardless of columnIndex.
AbstractTableModel
  
Subclass must override this method.
AbstractTableModel
  
getColumnName(column:int):String
Returns a default name for the column using spreadsheet conventions: A, B, C, ...
AbstractTableModel
  
Subclass must override this method.
AbstractTableModel
  
Returns an array of all the table model listeners registered on this model.
AbstractTableModel
  
getValueAt(rowIndex:int, columnIndex:int):*
Subclass must override this method.
AbstractTableModel
  
isCellEditable(rowIndex:int, columnIndex:int):Boolean
Returns false.
AbstractTableModel
  
Removes a listener from the list that's notified each time a change to the data model occurs.
AbstractTableModel
  
setColumnClass(columnIndex:int, className:String):void
Sets class name regardless of columnIndex.
AbstractTableModel
  
setValueAt(aValue:*, rowIndex:int, columnIndex:int):void
This empty implementation is provided so users don't have to implement this method if their data model is not editable.
AbstractTableModel
  
toString():String
AbstractTableModel
Protected Methods
 MethodDefined by
  
fireTableCellUpdated(row:int, column:int):void
Notifies all listeners that the value of the cell at [row, column] has been updated.
AbstractTableModel
  
Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
AbstractTableModel
  
Notifies all listeners that all cell values in the table's rows may have changed.
AbstractTableModel
  
fireTableRowsDeleted(firstRow:int, lastRow:int):void
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.
AbstractTableModel
  
fireTableRowsInserted(firstRow:int, lastRow:int):void
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.
AbstractTableModel
  
fireTableRowsUpdated(firstRow:int, lastRow:int):void
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.
AbstractTableModel
  
Notifies all listeners that the table's structure has changed.
AbstractTableModel
Property detail
columnClassesproperty
protected var columnClasses:Array
listenerListproperty 
protected var listenerList:Array

List of listeners

Constructor detail
AbstractTableModel()constructor
public function AbstractTableModel()
Method detail
addTableModelListener()method
public function addTableModelListener(l:TableModelListener):void

Adds a listener to the list that's notified each time a change to the data model occurs.

Parameters
l:TableModelListener — the TableModelListener
findColumn()method 
public function findColumn(columnName:String):int

Returns a column given its name. Implementation is naive so this should be overridden if this method is to be called often. This method is not in the TableModel interface and is not used by the JTable.

Parameters
columnName:String — string containing name of column to be located

Returns
int — the column with columnName, or -1 if not found
fireTableCellUpdated()method 
protected function fireTableCellUpdated(row:int, column:int):void

Notifies all listeners that the value of the cell at [row, column] has been updated.

Parameters
row:int — row of cell which has been updated
 
column:int — column of cell which has been updated

See also

TableModelEvent
EventListenerList
fireTableChanged()method 
protected function fireTableChanged(e:TableModelEvent):void

Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.

Parameters
e:TableModelEvent — the event to be forwarded

See also

addTableModelListener
TableModelEvent
EventListenerList
fireTableDataChanged()method 
protected function fireTableDataChanged():void

Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.

See also

TableModelEvent
EventListenerList
javax.swing.JTable.tableChanged(TableModelEvent)
fireTableRowsDeleted()method 
protected function fireTableRowsDeleted(firstRow:int, lastRow:int):void

Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.

Parameters
firstRow:int — the first row
 
lastRow:int — the last row

See also

TableModelEvent
EventListenerList
fireTableRowsInserted()method 
protected function fireTableRowsInserted(firstRow:int, lastRow:int):void

Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.

Parameters
firstRow:int — firstRow the first row
 
lastRow:int — lastRow the last row

See also

TableModelEvent
EventListenerList
fireTableRowsUpdated()method 
protected function fireTableRowsUpdated(firstRow:int, lastRow:int):void

Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.

Parameters
firstRow:int — the first row
 
lastRow:int — the last row

See also

TableModelEvent
EventListenerList
fireTableStructureChanged()method 
protected function fireTableStructureChanged():void

Notifies all listeners that the table's structure has changed. The number of columns in the table, and the names and types of the new columns may be different from the previous state. If the JTable receives this event and its autoCreateColumnsFromModel flag is set it discards any table columns that it had and reallocates default columns in the order they appear in the model. This is the same as calling setModel(TableModel) on the JTable.

See also

TableModelEvent
EventListenerList
getColumnClass()method 
public function getColumnClass(columnIndex:int):String

Returns class name regardless of columnIndex.

Parameters
columnIndex:int — the column being queried

Returns
String — the class name, default is "Object"
getColumnCount()method 
public function getColumnCount():int

Subclass must override this method.

Returns
int
getColumnName()method 
public function getColumnName(column:int):String

Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z, AA, AB, etc. If column cannot be found, returns an empty string.

Parameters
column:int — the column being queried

Returns
String — a string containing the default name of column
getRowCount()method 
public function getRowCount():int

Subclass must override this method.

Returns
int
getTableModelListeners()method 
public function getTableModelListeners():Array

Returns an array of all the table model listeners registered on this model.

Returns
Array — all of this model's TableModelListeners or an empty array if no table model listeners are currently registered

See also

getValueAt()method 
public function getValueAt(rowIndex:int, columnIndex:int):*

Subclass must override this method.

Parameters
rowIndex:int
 
columnIndex:int

Returns
*
isCellEditable()method 
public function isCellEditable(rowIndex:int, columnIndex:int):Boolean

Returns false. This is the default implementation for all cells.

Parameters
rowIndex:int — rowIndex the row being queried
 
columnIndex:int — columnIndex the column being queried

Returns
Boolean — false
removeTableModelListener()method 
public function removeTableModelListener(l:TableModelListener):void

Removes a listener from the list that's notified each time a change to the data model occurs.

Parameters
l:TableModelListener — the TableModelListener
setColumnClass()method 
public function setColumnClass(columnIndex:int, className:String):void

Sets class name regardless of columnIndex.

Parameters
columnIndex:int — the column being queried
 
className:String — the class name
setValueAt()method 
public function setValueAt(aValue:*, rowIndex:int, columnIndex:int):void

This empty implementation is provided so users don't have to implement this method if their data model is not editable.

Parameters
aValue:* — aValue value to assign to cell
 
rowIndex:int — rowIndex row of cell
 
columnIndex:int — columnIndex column of cell
toString()method 
public function toString():String

Returns
String