Package groovy.swing.model
Class DefaultTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- groovy.swing.model.DefaultTableModel
-
- All Implemented Interfaces:
Serializable,TableModel
public class DefaultTableModel extends AbstractTableModel
A default table model made up of PropertyModels on a Value model.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDefaultTableModel.MyTableColumnModel
-
Field Summary
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description DefaultTableModel(ValueModel rowsModel)DefaultTableModel(ValueModel rowsModel, ValueModel rowModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultTableColumnaddClosureColumn(Object headerValue, Closure readClosure, Closure writeClosure, Class type)Adds a closure based column to the tablevoidaddColumn(DefaultTableColumn column)Adds a new column definition to the tableDefaultTableColumnaddColumn(Object headerValue, ValueModel columnValueModel)DefaultTableColumnaddColumn(Object headerValue, Object identifier, ValueModel columnValueModel)DefaultTableColumnaddPropertyColumn(Object headerValue, String property, Class type)Adds a property model column to the tableDefaultTableColumnaddPropertyColumn(Object headerValue, String property, Class type, boolean editable)Adds a property model column to the tableClassgetColumnClass(int columnIndex)intgetColumnCount()ListgetColumnList()TableColumnModelgetColumnModel()protected ValueModelgetColumnModel(int columnIndex)StringgetColumnName(int columnIndex)intgetRowCount()ValueModelgetRowModel()protected ListgetRows()ValueModelgetRowsModel()ObjectgetValueAt(int rowIndex, int columnIndex)booleanisCellEditable(int rowIndex, int columnIndex)voidremoveColumn(DefaultTableColumn column)Removes a column definition from the tablevoidsetValueAt(Object value, int rowIndex, int columnIndex)-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Constructor Detail
-
DefaultTableModel
public DefaultTableModel(ValueModel rowsModel)
-
DefaultTableModel
public DefaultTableModel(ValueModel rowsModel, ValueModel rowModel)
-
-
Method Detail
-
getColumnList
public List getColumnList()
- Returns:
- the column definitions.
-
getColumnModel
public TableColumnModel getColumnModel()
-
addPropertyColumn
public DefaultTableColumn addPropertyColumn(Object headerValue, String property, Class type)
Adds a property model column to the table
-
addPropertyColumn
public DefaultTableColumn addPropertyColumn(Object headerValue, String property, Class type, boolean editable)
Adds a property model column to the table
-
addClosureColumn
public DefaultTableColumn addClosureColumn(Object headerValue, Closure readClosure, Closure writeClosure, Class type)
Adds a closure based column to the table
-
addColumn
public DefaultTableColumn addColumn(Object headerValue, ValueModel columnValueModel)
-
addColumn
public DefaultTableColumn addColumn(Object headerValue, Object identifier, ValueModel columnValueModel)
-
addColumn
public void addColumn(DefaultTableColumn column)
Adds a new column definition to the table
-
removeColumn
public void removeColumn(DefaultTableColumn column)
Removes a column definition from the table
-
getRowCount
public int getRowCount()
-
getColumnCount
public int getColumnCount()
-
getColumnName
public String getColumnName(int columnIndex)
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel
-
getColumnClass
public Class getColumnClass(int columnIndex)
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
-
setValueAt
public void setValueAt(Object value, int rowIndex, int columnIndex)
- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel
-
getColumnModel
protected ValueModel getColumnModel(int columnIndex)
-
getRows
protected List getRows()
-
getRowModel
public ValueModel getRowModel()
-
getRowsModel
public ValueModel getRowsModel()
-
-