class org.aswing.table.PropertyTableModel extends AbstractTableModel

The table model return the properties of a row to be column data.

PropertyTableModel is very conveniently to use when your table data can be stored in a list and each columns can be a property of a object of a row.
For example, you can a data like this:

data = 
[{name:"paling", sex:1, age:26}, 
{name:"Comeny", sex:0, age:24}, 
{name:"Tom", sex:1, age:30},
{name:"Lita", sex:0, age:16}
];
Woool, it is very suit for PropertyTableModel to provide data to a JTable to view the datas. You can create your JTable like this:
var dataList:VectorListModel = new VectorListModel();
dataList.appendAll(data);
var tableModel:PropertyTableModel = new PropertyTableModel(

	dataList, 
	["Guy's Name", "Sex", "Age"], 
	["name", "sex", "age"], 
	[null, new SexTranslator(), null]

); var table:JTable = new JTable(tableModel);

Then the table will render a table for each object each properties like this.

-------------------------------
| Guy's Name |  Sex   |  Age  | 
|------------------------------
| paling      |  male  |  26   | 
|------------------------------
| Comeny     | female |  24   | 
|------------------------------
| Tom        |  male  |  30   | 
|------------------------------
| Lita       | female |  16   | 
-------------------------------

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

function new(?listModel:ListModel = null, ?names:Array<Dynamic> = null, ?properties:Array<String> = null, ?translators:Array<Dynamic> = null): Void

Create a Property table model, column headers, properties names, and translators.

listModel

the list model that contains the row objects.

names

column header labels.

properties

property names for column values, "." means returns row data object directly.

translators

the translators for each column, a null translator for a columns means return the property of that name directly. translator can be a PropertyTranslator instance or a Function(info:*, key:String):

function getColumnCount(): Int

function getColumnName(column:Int): String

Returns the column name for specified column.

function getList(): ListModel

Returns the row data provider, a list model.

returns

the row data provider.

function getProperties(): Array<Dynamic>

Return the properties.

function getRowCount(): Int

function getValueAt(rowIndex:Int, columnIndex:Int): Dynamic

Returns the translated value for specified row and column.

returns

the translated value for specified row and column.

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 setAllCellEditable(editable:Bool): Void

Sets all cells editable or not.

editable

editable or not

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 setList(listModel:ListModel): Void

Sets the row data provider, a list model.

listModel

the row object datas.

function setValueAt(aValue:Dynamic, rowIndex:Int, columnIndex:Int): Void