class org.aswing.table.PropertyTableModel extends AbstractTableModel
Interfaces | |||
![]() | ListDataListener |
|
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(Then the table will render a table for each object each properties like this.dataList, ["Guy's Name", "Sex", "Age"], ["name", "sex", "age"], [null, new SexTranslator(), null]
); var table:JTable = new JTable(tableModel);
------------------------------- | Guy's Name | Sex | Age | |------------------------------ | paling | male | 26 | |------------------------------ | Comeny | female | 24 | |------------------------------ | Tom | male | 30 | |------------------------------ | Lita | female | 16 | -------------------------------
Instance Fields
![]() | Show inherited public instance fields | Hide inherited public instance fields
|
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 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
- this.setValueAt()
- this.setCellEditable()
- this.setAllCellEditable()
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
- this.setValueAt()
- this.setCellEditable()
- this.setAllCellEditable()
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 |