class org.aswing.table.DefaultTableModel extends AbstractTableModel

Authors

  • paling

Instance Fields

Show inherited public instance fieldsHide inherited public instance fields

Inherited from AbstractTableModel

var columnClasses:Array<Dynamic>
function addTableModelListener(l:TableModelListener):Void
function findColumn(columnName:String):Int
function getColumnClass(columnIndex:Int):String
function getColumnCount():Int
function getColumnName(column:Int):String
function getRowCount():Int
function getTableModelListeners():Array<Dynamic>
function getValueAt(rowIndex:Int, columnIndex:Int):Dynamic
function isCellEditable(rowIndex:Int, columnIndex:Int):Bool
function removeTableModelListener(l:TableModelListener):Void
function setColumnClass(columnIndex:Int, className:String):Void
function setValueAt(aValue:Dynamic, rowIndex:Int, columnIndex:Int):Void
function toString():String

var data:Array<Array<Dynamic>>

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.

function new(): Void

Constructs a default DefaultTableModel which is a table of zero columns and zero rows.

You must call init method after constructing.

function addColumn(columnName:Dynamic, ?columnData:Array<Dynamic> = null): Void

addColumn(columnName:Dynamic, columnData:Array)
addColumn(columnName:Dynamic)

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.

columnName

the name of the column being added

columnData

optional data of the column being added

function addRow(rowData:Array<Dynamic>): 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

optional data of the row being added

function clearRows(): Void

Removes the all the rows . Notification of the rows being removed will be sent to all the listeners.

function getColumnCount(): Int

Returns the number of columns in this data table.

returns

the number of columns in the model

function getColumnName(column:Int): String

Returns the column name.

returns

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

function getRowCount(): Int

Returns the number of rows in this data table.

returns

the number of rows in the model

function getValueAt(row:Int, column:Int): Dynamic

Returns an attribute value for the cell at row and column.

row

the row whose value is to be queried

column

the column whose value is to be queried

returns

the value Object at the specified cell

function initWithDataNames(data:Array<Array<Dynamic>>, columnNames:Array<Dynamic>): 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

the data of the table

columnNames

the names of the columns

See Also

function initWithNamesRowcount(columnNames:Array<Dynamic>, 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 containing the names of the new columns; if this is

	  `null` then the model has no columns
rowCount

the number of rows the table holds

See Also

function initWithRowcountColumncount(rowCount:Int, columnCount:Int): DefaultTableModel

Initializes a DefaultTableModel with rowCount and columnCount of null object values.

rowCount

the number of rows the table holds

columnCount

the number of columns the table holds

See Also

function insertRow(row:Int, rowData:Array<Dynamic>): 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

the row index of the row to be inserted

rowData

optional data of the row being added

function isCellEditable(row:Int, column:Int): Bool

Returns is the row column editable, default is true.

row

the row whose value is to be queried

column

the column whose value is to be queried

returns

is the row column editable, default is true.

See Also

function isColumnEditable(column:Int): Bool

Returns is the column editable, default is true.

column

the column whose value is to be queried

returns

is the column editable, default is true.

See Also

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:

1. 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

the starting row index to be moved

end

the ending row index to be moved

to

the destination of the rows to be moved

function newDataAvailable(event:TableModelEvent): Void

Equivalent to fireTableChanged.

event

the change event

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

this TableModelEvent describes where the rows were added.

			 If `null` it assumes

all the rows were newly added

See Also

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

the row index of the row to be removed

function rowsRemoved(e:TableModelEvent): Void

Equivalent to fireTableChanged.

@param e the change event

function setAllCellEditable(editable:Bool): Void

Sets all cells editable or not.

editable

editable or not

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.

@param columnCount the new number of columns in the model

@see #setColumnCount()

function setColumnEditable(column:Int, editable:Bool): Void

Sets spcecifed column editable or not.

column

the column whose value is to be queried

editable

editable or not

function setColumnNames(columnNames:Array<Dynamic>): 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.

columnNames

array of column names. If null, set

	  the model to zero columns

See Also

function setDataNames(dataArray:Array<Array<Dynamic>>, columnNames:Array<Dynamic>): 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.

dataArray

the new data vector

columnNames

the names of the columns

See Also

function setNumRows(rowCount:Int): Void

Obsolete as of Java 2 platform v1.3. Please use setRowCount instead.

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.

@see #setColumnCount()

function setValueAt(aValue:Dynamic, 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

the new value; this can be null

row

the row whose value is to be changed

column

the column whose value is to be changed

function toString(): String