Class ResultSetTableModel

    • Field Detail

      • m_Columns

        protected String[] m_Columns
        the column titles.
      • m_ColumnIndex

        protected Hashtable<String,​Integer> m_ColumnIndex
        for fast access to the column names (name - index).
    • Constructor Detail

      • ResultSetTableModel

        public ResultSetTableModel​(String[] columns)
        Initializes an empty model.
        Parameters:
        columns - the column titles
      • ResultSetTableModel

        public ResultSetTableModel​(ResultSet rs)
                            throws SQLException
        Initializes the model with the given result set.
        Parameters:
        rs - the data to use
        Throws:
        SQLException - in case of an SQL error
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
      • getRowCount

        public int getRowCount()
        Returns the number of rows in the model.
        Returns:
        the number of rows in the model
      • getColumnName

        public String getColumnName​(int columnIndex)
        Returns the name of the column at columnIndex. This is used to initialize the table's column header name.
        Specified by:
        getColumnName in interface TableModel
        Overrides:
        getColumnName in class AbstractTableModel
        Parameters:
        columnIndex - the index of the column
        Returns:
        the name of the column
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the model.
        Returns:
        the number of columns in the model
      • getValueAt

        public Object getValueAt​(int rowIndex,
                                 int columnIndex)
        Returns the value for the cell at columnIndex and rowIndex.
        Parameters:
        rowIndex - the row whose value is to be queried
        columnIndex - the column whose value is to be queried
        Returns:
        the value Object at the specified cell
      • getColumnIndex

        public int getColumnIndex​(String columnName)
        Returns the column index associated with the column name.
        Parameters:
        columnName - the name to look up
        Returns:
        the index, -1 if not found
      • getValueAt

        public Object getValueAt​(int rowIndex,
                                 String columnName)
        Returns the value for the cell row rowIndex and from the column named columnName.
        Parameters:
        rowIndex - the row whose value is to be queried
        columnName - the name of the column whose value is to be queried
        Returns:
        the value Object at the specified cell, null if not found or no value available