Package com.mckoi.jfccontrols
Class ResultSetTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- com.mckoi.jfccontrols.ResultSetTableModel
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.table.TableModel
public class ResultSetTableModel extends javax.swing.table.AbstractTableModel
An implementation of a javax.swing.table.TableModel that updates itself from a scrollable java.sql.ResultSet source. This directly maps columns from a query to columns in the table model. If you wish to filter information from the result set before it is output as a table use FilteredResultSetTableModel.- Author:
- Tobias Downer
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResultSetTableModel()
ResultSetTableModel(java.sql.ResultSet result_set)
Constructs the model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the model of the current result set.int
getColumnCount()
java.lang.String
getColumnName(int column)
int
getRowCount()
java.lang.Object
getValueAt(int row, int column)
void
setPreserveTableStructure(boolean status)
A property that checks for changes when a result set is updated and preserves the layout if the updated result set looks similar.void
updateResultSet(java.sql.ResultSet result_set)
Updates the result set in this model with the given ResultSet object.-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Method Detail
-
setPreserveTableStructure
public void setPreserveTableStructure(boolean status)
A property that checks for changes when a result set is updated and preserves the layout if the updated result set looks similar. This means that the width of columns in the UI will not change to their default values.
-
updateResultSet
public void updateResultSet(java.sql.ResultSet result_set)
Updates the result set in this model with the given ResultSet object.
-
clear
public void clear()
Clears the model of the current result set.
-
getRowCount
public int getRowCount()
-
getColumnCount
public int getColumnCount()
-
getColumnName
public java.lang.String getColumnName(int column)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
-
getValueAt
public java.lang.Object getValueAt(int row, int column)
-
-