Package com.jformdesigner.model
Class SwingTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- javax.swing.table.DefaultTableModel
-
- com.jformdesigner.model.SwingTableModel
-
- All Implemented Interfaces:
Serializable,TableModel
public class SwingTableModel extends DefaultTableModel
Used for TableModels in JFormDesigner forms. ExtendsDefaultTableModelby the possibility to specify column types and column editable flags.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description SwingTableModel()Constructs a defaultSwingTableModelthat has zero columns and rows.SwingTableModel(SwingTableModel model)Copy constructor.SwingTableModel(Object[][] data, Object[] columnNames)Constructs aSwingTableModeland initializes it with the specified data and column names.SwingTableModel(Vector<? extends Vector> data, Vector<String> columnNames)Constructs aSwingTableModeland initializes it with the specified data and column names.SwingTableModel(Vector<? extends Vector> data, Vector<String> columnNames, Vector<Class<?>> columnTypes, Vector<Boolean> columnEditables)Constructs aSwingTableModeland initializes it with the specified data, column names, column types and column editable flags.SwingTableModel(Vector<? extends Vector> data, Vector<String> columnNames, Vector<Class<?>> columnTypes, Vector<Boolean> columnEditables, Vector<SwingTableColumn> columnInfos)Constructs aSwingTableModeland initializes it with the specified data, column names, column types, column editable flags and additional column infos.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getColumnClass(int columnIndex)Returns the type of the data in the specified column.Vector<Boolean>getColumnEditables()Returns theVectorthat contains the table's column editable flags.SwingTableColumngetColumnInfo(int column)Returns the column info for the given column index.Vector<SwingTableColumn>getColumnInfos()Returns theVectorthat contains the table's column infos.Vector<String>getColumnNames()Returns theVectorthat contains the table's column names.Vector<Class<?>>getColumnTypes()Returns theVectorthat contains the table's column types.booleanisCellEditable(int row, int column)Returnstrueif the specified column is editable.booleanisColumnEditable(int column)Returnstrueif the cells in the specified column are editable.voidsetColumnCount(int columnCount)Sets the number of columns in the model.-
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Constructor Detail
-
SwingTableModel
public SwingTableModel()
Constructs a defaultSwingTableModelthat has zero columns and rows.
-
SwingTableModel
public SwingTableModel(Vector<? extends Vector> data, Vector<String> columnNames)
Constructs aSwingTableModeland initializes it with the specified data and column names.See
DefaultTableModelfor details.
-
SwingTableModel
public SwingTableModel(Vector<? extends Vector> data, Vector<String> columnNames, Vector<Class<?>> columnTypes, Vector<Boolean> columnEditables)
Constructs aSwingTableModeland initializes it with the specified data, column names, column types and column editable flags.See
DefaultTableModelfor details.
-
SwingTableModel
public SwingTableModel(Vector<? extends Vector> data, Vector<String> columnNames, Vector<Class<?>> columnTypes, Vector<Boolean> columnEditables, Vector<SwingTableColumn> columnInfos)
Constructs aSwingTableModeland initializes it with the specified data, column names, column types, column editable flags and additional column infos.See
DefaultTableModelfor details.- Since:
- 3.0
-
SwingTableModel
public SwingTableModel(Object[][] data, Object[] columnNames)
Constructs aSwingTableModeland initializes it with the specified data and column names.See
DefaultTableModelfor details.
-
SwingTableModel
public SwingTableModel(SwingTableModel model)
Copy constructor. Copies vectors, but not the real data.
-
-
Method Detail
-
getColumnNames
public Vector<String> getColumnNames()
Returns theVectorthat contains the table's column names. Each element in the vector must be ajava.lang.String.
-
getColumnTypes
public Vector<Class<?>> getColumnTypes()
Returns theVectorthat contains the table's column types. Each element in the vector must be ajava.lang.Class.
-
getColumnEditables
public Vector<Boolean> getColumnEditables()
Returns theVectorthat contains the table's column editable flags. Each element in the vector must be ajava.lang.Boolean.
-
getColumnInfos
public Vector<SwingTableColumn> getColumnInfos()
Returns theVectorthat contains the table's column infos. Each element in the vector must be aSwingTableColumn.- Since:
- 3.0
-
setColumnCount
public void setColumnCount(int columnCount)
Sets the number of columns in the model.See
DefaultTableModel.setColumnCount(int)for details.- Overrides:
setColumnCountin classDefaultTableModel
-
isColumnEditable
public boolean isColumnEditable(int column)
Returnstrueif the cells in the specified column are editable.
-
getColumnInfo
public SwingTableColumn getColumnInfo(int column)
Returns the column info for the given column index.- Since:
- 3.0
-
getColumnClass
public Class<?> getColumnClass(int columnIndex)
Returns the type of the data in the specified column.See
TableModel.getColumnClass(int)for details.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- See Also:
getColumnTypes()
-
isCellEditable
public boolean isCellEditable(int row, int column)Returnstrueif the specified column is editable.See
TableModel.isCellEditable(int, int)for details.- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classDefaultTableModel- See Also:
isColumnEditable(int),getColumnEditables()
-
-