| Package | org.aswing.table |
| Class | public class DefaultTableModel |
| Inheritance | DefaultTableModel AbstractTableModel |
| Method | Defined by | ||
|---|---|---|---|
|
Constructs a default
DefaultTableModel
which is a table of zero columns and zero rows. | DefaultTableModel | ||
|
addColumn(columnName:Object, columnData:Array):void
addColumn(columnName:Object, columnData:Array)
addColumn(columnName:Object) Adds a column to the model. | DefaultTableModel | ||
|
addRow(rowData:Array):void
Adds a row to the end of the model.
| DefaultTableModel | ||
![]() |
Adds a listener to the list that's notified each time a change
to the data model occurs.
| AbstractTableModel | |
|
clearRows():void
Removes the all the rows .
| DefaultTableModel | ||
![]() |
findColumn(columnName:String):int
Returns a column given its name.
| AbstractTableModel | |
![]() |
getColumnClass(columnIndex:int):String
Returns class name regardless of
columnIndex. | AbstractTableModel | |
|
getColumnCount():int
Returns the number of columns in this data table.
| DefaultTableModel | ||
|
getColumnName(column:int):String
Returns the column name.
| DefaultTableModel | ||
|
getData():Array
Returns the
Array of Arrays
that contains the table's
data values. | DefaultTableModel | ||
|
getRowCount():int
Returns the number of rows in this data table.
| DefaultTableModel | ||
![]() |
getTableModelListeners():Array
Returns an array of all the table model listeners
registered on this model.
| AbstractTableModel | |
|
getValueAt(row:int, column:int):*
Returns an attribute value for the cell at
row
and column. | DefaultTableModel | ||
|
initWithDataNames(data:Array, columnNames:Array):DefaultTableModel
Initializes a
DefaultTableModel
by passing data and columnNames
to the setDataArray
method. | DefaultTableModel | ||
|
initWithNamesRowcount(columnNames:Array, rowCount:int):DefaultTableModel
Initializes a
DefaultTableModel with as many
columns as there are elements in columnNames
and rowCount of null
object values. | DefaultTableModel | ||
|
initWithRowcountColumncount(rowCount:int, columnCount:int):DefaultTableModel
Initializes a
DefaultTableModel with
rowCount and columnCount of
null object values. | DefaultTableModel | ||
|
insertRow(row:int, rowData:Array):void
Inserts a row at
row in the model. | DefaultTableModel | ||
|
isCellEditable(row:int, column:int):Boolean
Returns is the row column editable, default is true.
| DefaultTableModel | ||
|
isColumnEditable(column:int):Boolean
Returns is the column editable, default is true.
| DefaultTableModel | ||
|
moveRow(start:int, end:int, _to:int):void
Moves one or more rows from the inclusive range
start to
end to the to position in the model. | DefaultTableModel | ||
|
newDataAvailable(event:TableModelEvent):void
Equivalent to
fireTableChanged. | DefaultTableModel | ||
|
newRowsAdded(e:TableModelEvent):void
Ensures that the new rows have the correct number of columns.
| DefaultTableModel | ||
|
removeRow(row:int):void
Removes the row at
row from the model. | DefaultTableModel | ||
![]() |
Removes a listener from the list that's notified each time a
change to the data model occurs.
| AbstractTableModel | |
|
rowsRemoved(e:TableModelEvent):void
Equivalent to
fireTableChanged. | DefaultTableModel | ||
|
setAllCellEditable(editable:Boolean):void
Sets all cells editable or not.
| DefaultTableModel | ||
![]() |
setColumnClass(columnIndex:int, className:String):void
Sets class name regardless of
columnIndex. | AbstractTableModel | |
|
setColumnCount(columnCount:int):void
Sets the number of columns in the model.
| DefaultTableModel | ||
|
setColumnEditable(column:int, editable:Boolean):void
Sets spcecifed column editable or not.
| DefaultTableModel | ||
|
setColumnNames(columnNames:Array):void
Replaces the column names in the model.
| DefaultTableModel | ||
|
setData(dataArray:Array):void
Replaces the current
dataArray instance variable
with the new Vector of rows, dataArray. | DefaultTableModel | ||
|
setDataNames(dataArray:Array, columnNames:Array):void
Replaces the current
dataArray instance variable
with the new Vector of rows, dataArray. | DefaultTableModel | ||
|
setNumRows(rowCount:int):void
Obsolete as of Java 2 platform v1.3.
| DefaultTableModel | ||
|
setRowCount(rowCount:int):void
Sets the number of rows in the model.
| DefaultTableModel | ||
|
setValueAt(aValue:*, row:int, column:int):void
Sets the object value for the cell at
column and
row. | DefaultTableModel | ||
|
toString():String
| DefaultTableModel | ||
| DefaultTableModel | () | constructor |
public function DefaultTableModel()
Constructs a default DefaultTableModel
which is a table of zero columns and zero rows.
You must call init method after constructing.
See also
| addColumn | () | method |
public function addColumn(columnName:Object, columnData:Array):void
addColumn(columnName:Object, columnData:Array)
addColumn(columnName:Object)
Adds a column to the model. The new column will have the
name columnName. columnData is the
optional array of data for the column. If it is null
the column is filled with null values. Otherwise,
the new data will be added to model starting with the first
element going to row 0, etc. This method will send a
tableChanged notification message to all the listeners.
Parameters
columnName:Object — columnName the name of the column being added
|
|
columnData:Array — columnData optional data of the column being added
|
| addRow | () | method |
public function addRow(rowData:Array):void
Adds a row to the end of the model. The new row will contain
null values unless rowData is specified.
Notification of the row being added will be generated.
rowData:Array — rowData optional data of the row being added
|
| clearRows | () | method |
public function clearRows():voidRemoves the all the rows . Notification of the rows being removed will be sent to all the listeners.
| getColumnCount | () | method |
public override function getColumnCount():intReturns the number of columns in this data table.
Returnsint — the number of columns in the model
|
| getColumnName | () | method |
public override function getColumnName(column:int):StringReturns the column name.
Parameterscolumn:int |
String — a name for this column using the string value of the
appropriate member in columnNames.
If columnNames does not have an entry
for this index, returns the default
name provided by the superclass
|
| getData | () | method |
public function getData():Array
Returns the Array of Arrays
that contains the table's
data values. The arrays contained in the outer array are
each a single row of values. In other words, to get to the cell
at row 1, column 5:
getDataVector()[1][5];
Returns
Array — the array of arrays containing the tables data values
|
See also
| getRowCount | () | method |
public override function getRowCount():intReturns the number of rows in this data table.
Returnsint — the number of rows in the model
|
| getValueAt | () | method |
public override function getValueAt(row:int, column:int):*
Returns an attribute value for the cell at row
and column.
row:int — row the row whose value is to be queried
|
|
column:int — column the column whose value is to be queried
|
* — the value Object at the specified cell
|
| initWithDataNames | () | method |
public function initWithDataNames(data:Array, columnNames:Array):DefaultTableModel
Initializes a DefaultTableModel
by passing data and columnNames
to the setDataArray
method. The first index in the [][] array is
the row index and the second is the column index.
data:Array — the data of the table
|
|
columnNames:Array — the names of the columns
|
DefaultTableModel |
See also
| initWithNamesRowcount | () | method |
public function initWithNamesRowcount(columnNames:Array, rowCount:int):DefaultTableModel
Initializes a DefaultTableModel with as many
columns as there are elements in columnNames
and rowCount of null
object values. Each column's name will be taken from
the columnNames array.
columnNames:Array — array containing the names
of the new columns; if this is
null then the model has no columns
|
|
rowCount:int — the number of rows the table holds
|
DefaultTableModel |
See also
| initWithRowcountColumncount | () | method |
public function initWithRowcountColumncount(rowCount:int, columnCount:int):DefaultTableModel
Initializes a DefaultTableModel with
rowCount and columnCount of
null object values.
rowCount:int — the number of rows the table holds
|
|
columnCount:int — the number of columns the table holds
|
DefaultTableModel |
See also
| insertRow | () | method |
public function insertRow(row:int, rowData:Array):void
Inserts a row at row in the model. The new row
will contain null values unless rowData
is specified. Notification of the row being added will be generated.
row:int — row the row index of the row to be inserted
|
|
rowData:Array — rowData optional data of the row being added
|
| isCellEditable | () | method |
public override function isCellEditable(row:int, column:int):BooleanReturns is the row column editable, default is true.
Parametersrow:int — row the row whose value is to be queried
|
|
column:int — column the column whose value is to be queried
|
Boolean — is the row column editable, default is true.
|
See also
| isColumnEditable | () | method |
public function isColumnEditable(column:int):BooleanReturns is the column editable, default is true.
Parameterscolumn:int — column the column whose value is to be queried
|
Boolean — is the column editable, default is true.
|
See also
| moveRow | () | method |
public function moveRow(start:int, end:int, _to:int):void
Moves one or more rows from the inclusive range start to
end to the to position in the model.
After the move, the row that was at index start
will be at index to.
This method will send a tableChanged notification
message to all the listeners.
Examples of moves:Parameters1. moveRow(1,3,5); a|B|C|D|e|f|g|h|i|j|k - before a|e|f|g|h|B|C|D|i|j|k - after
2. moveRow(6,7,1); a|b|c|d|e|f|G|H|i|j|k - before a|G|H|b|c|d|e|f|i|j|k - after
start:int — start the starting row index to be moved
|
|
end:int — end the ending row index to be moved
|
|
_to:int — to the destination of the rows to be moved
|
| newDataAvailable | () | method |
public function newDataAvailable(event:TableModelEvent):void
Equivalent to fireTableChanged.
event:TableModelEvent — the change event
|
| newRowsAdded | () | method |
public function newRowsAdded(e:TableModelEvent):void
Ensures that the new rows have the correct number of columns.
This is accomplished by using the setSize method in
Vector which truncates vectors
which are too long, and appends nulls if they
are too short.
This method also sends out a tableChanged
notification message to all the listeners.
e:TableModelEvent — this TableModelEvent describes
where the rows were added.
If null it assumes
all the rows were newly added
|
See also
| removeRow | () | method |
public function removeRow(row:int):void
Removes the row at row from the model. Notification
of the row being removed will be sent to all the listeners.
row:int — row the row index of the row to be removed
|
| rowsRemoved | () | method |
public function rowsRemoved(e:TableModelEvent):void
Equivalent to fireTableChanged.
e:TableModelEvent — the change event
|
| setAllCellEditable | () | method |
public function setAllCellEditable(editable:Boolean):voidSets all cells editable or not.
Parameterseditable:Boolean — editable or not
|
| setColumnCount | () | method |
public function setColumnCount(columnCount:int):void
Sets the number of columns in the model. If the new size is greater
than the current size, new columns are added to the end of the model
with null cell values.
If the new size is less than the current size, all columns at index
columnCount and greater are discarded.
columnCount:int — the new number of columns in the model
|
See also
| setColumnEditable | () | method |
public function setColumnEditable(column:int, editable:Boolean):voidSets spcecifed column editable or not.
Parameterscolumn:int — the column whose value is to be queried
|
|
editable:Boolean — editable or not
|
| setColumnNames | () | method |
public function setColumnNames(columnNames:Array):void
Replaces the column names in the model. If the number of
columnNamess is greater than the current number
of columns, new columns are added to the end of each row in the model.
If the number of columnNamess is less than the current
number of columns, all the extra columns at the end of a row are
discarded.
Parameters
columnNames:Array — columnNames array of column names.
If null, set
the model to zero columns
|
See also
| setData | () | method |
public function setData(dataArray:Array):void
Replaces the current dataArray instance variable
with the new Vector of rows, dataArray.
Each row is represented in dataArray as a
Vector of Object values.
Note that passing in a null value for
dataArray results in unspecified behavior,
an possibly an exception.
Parameters
dataArray:Array — dataArray the new data vector
|
See also
| setDataNames | () | method |
public function setDataNames(dataArray:Array, columnNames:Array):void
Replaces the current dataArray instance variable
with the new Vector of rows, dataArray.
Each row is represented in dataArray as a
Vector of Object values.
columnNames are the names of the new
columns. The first name in columnNames is
mapped to column 0 in dataArray. Each row in
dataArray is adjusted to match the number of
columns in columnNames
either by truncating the Vector if it is too long,
or adding null values if it is too short.
Note that passing in a null value for
dataArray results in unspecified behavior,
an possibly an exception.
Parameters
dataArray:Array — dataArray the new data vector
|
|
columnNames:Array — columnNames the names of the columns
|
See also
| setNumRows | () | method |
public function setNumRows(rowCount:int):void
Obsolete as of Java 2 platform v1.3. Please use setRowCount instead.
rowCount:int |
| setRowCount | () | method |
public function setRowCount(rowCount:int):void
Sets the number of rows in the model. If the new size is greater
than the current size, new rows are added to the end of the model
If the new size is less than the current size, all
rows at index rowCount and greater are discarded.
Parameters
rowCount:int |
See also
| setValueAt | () | method |
public override function setValueAt(aValue:*, row:int, column:int):void
Sets the object value for the cell at column and
row. aValue is the new value. This method
will generate a tableChanged notification.
aValue:* — aValue the new value; this can be null
|
|
row:int — row the row whose value is to be changed
|
|
column:int — column the column whose value is to be changed
|
| toString | () | method |
public override function toString():String
Returns
String |