Packageorg.aswing.event
Classpublic class TableModelEvent
InheritanceTableModelEvent Inheritance ModelEvent

TableModelEvent is used to notify listeners that a table model has changed. The model event describes changes to a TableModel and all references to rows and columns are in the co-ordinate system of the model. Depending on the parameters used in the constructors, the TableModelevent can be used to specify the following types of changes:

 TableModelEvent(source);              //  The data, ie. all rows changed 
 TableModelEvent(source, HEADER_ROW);  //  Structure change, reallocate TableColumns
 TableModelEvent(source, 1);           //  Row 1 changed
 TableModelEvent(source, 3, 6);        //  Rows 3 to 6 inclusive changed
 TableModelEvent(source, 2, 2, 6);     //  Cell at (2, 6) changed
 TableModelEvent(source, 3, 6, ALL_COLUMNS, INSERT); // Rows (3, 6) were inserted
 TableModelEvent(source, 3, 6, ALL_COLUMNS, DELETE); // Rows (3, 6) were deleted
 
It is possible to use other combinations of the parameters, not all of them are meaningful. By subclassing, you can add other information, for example: whether the event WILL happen or DID happen. This makes the specification of rows in DELETE events more useful but has not been included in the swing package as the JTable only needs post-event notification.



Public Methods
 MethodDefined by
  
TableModelEvent(source:TableModel, firstRow:int = -2, lastRow:int = -2, column:int, type:String)
     TableModelEvent(source:TableModel, firstRow:int, lastRow:int, column:int, type:String)
     TableModelEvent(source:TableModel, firstRow:int, lastRow:int, column:int)
     TableModelEvent(source:TableModel, firstRow:int, lastRow:int)
     TableModelEvent(source:TableModel, row:int)
     TableModelEvent(source:TableModel)
     

  • TableModelEvent(source:TableModel, firstRow:int, lastRow:int, column:int, type:String)
    The cells from (firstRow, column) to (lastRow, column) have been changed.
TableModelEvent
  
getColumn():int
Returns the column for the event.
TableModelEvent
  
Returns the first row that changed.
TableModelEvent
  
getLastRow():int
Returns the last row that changed.
TableModelEvent
 Inherited
getSource():Object
ModelEvent
  
getType():String
TableModelEvent
Public Constants
 ConstantDefined by
  ALL_COLUMNS : int = -1
[static] Specifies all columns in a row or rows.
TableModelEvent
  DELETE : String = "delete"
[static] Identifies the removal of rows or columns.
TableModelEvent
  HEADER_ROW : int = -1
[static] Identifies the header row.
TableModelEvent
  INSERT : String = "insert"
[static] Identifies the addtion of new rows or columns.
TableModelEvent
  UPDATE : String = "update"
[static] Identifies a change to existing data.
TableModelEvent
Constructor detail
TableModelEvent()constructor
public function TableModelEvent(source:TableModel, firstRow:int = -2, lastRow:int = -2, column:int, type:String)

     TableModelEvent(source:TableModel, firstRow:int, lastRow:int, column:int, type:String)
     TableModelEvent(source:TableModel, firstRow:int, lastRow:int, column:int)
     TableModelEvent(source:TableModel, firstRow:int, lastRow:int)
     TableModelEvent(source:TableModel, row:int)
     TableModelEvent(source:TableModel)
     

Parameters
source:TableModel
 
firstRow:int (default = -2)
 
lastRow:int (default = -2)
 
column:int
 
type:String
Method detail
getColumn()method
public function getColumn():int

Returns the column for the event. If the return value is ALL_COLUMNS; it means every column in the specified rows changed.

Returns
int
getFirstRow()method 
public function getFirstRow():int

Returns the first row that changed. HEADER_ROW means the meta data, ie. names, types and order of the columns.

Returns
int
getLastRow()method 
public function getLastRow():int

Returns the last row that changed.

Returns
int
getType()method 
public function getType():String

Returns
String
Constant detail
ALL_COLUMNSconstant
public static const ALL_COLUMNS:int = -1

Specifies all columns in a row or rows.

DELETEconstant 
public static const DELETE:String = "delete"

Identifies the removal of rows or columns.

HEADER_ROWconstant 
public static const HEADER_ROW:int = -1

Identifies the header row.

INSERTconstant 
public static const INSERT:String = "insert"

Identifies the addtion of new rows or columns.

UPDATEconstant 
public static const UPDATE:String = "update"

Identifies a change to existing data.