Class 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
    • Field Summary

      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResultSetTableModel

        public ResultSetTableModel​(java.sql.ResultSet result_set)
        Constructs the model.
      • ResultSetTableModel

        public ResultSetTableModel()
    • 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 interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • getValueAt

        public java.lang.Object getValueAt​(int row,
                                           int column)