public class TableModel:
Simple tabular data model consumed by TableView.
The model intentionally stores strings because it is the generic visual layer. Database-specific adapters can subclass or populate it from typed records before handing it to the widget.
model = TableModel("users")
model.addColumn("id").addColumn("login")
model.addRow(["1", "admin"])
table = TableView(model)| Modifier and Type | Member | Description |
|---|---|---|
| public property | columns | Column labels in display order. |
| public property | isReadOnlyisReadOnly as Boolean |
Whether UI editors must prevent cell updates. |
| public property | namename as String |
Model display name. |
| public property | rows | Row values, one string list per row. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | TableModelTableModel(name as String, readOnly as Boolean = false): |
Creates an empty table model. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | addColumnaddColumn(name as String) as TableModel: |
Appends a column and returns this model for fluent setup. |
| public | addRowaddRow(values as ArrayList<String>) as TableModel: |
Appends a row and returns this model for fluent setup. |
| public | cell | Returns a cell value or an empty string when the coordinates are invalid. |
| public | setCell | Updates a cell when the model is editable. |