JIDE 3.5.15

com.jidesoft.database
Class ResultSetTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.jidesoft.database.ResultSetTableModel
All Implemented Interfaces:
Serializable, TableModel
Direct Known Subclasses:
RowSetTableModel

public class ResultSetTableModel
extends AbstractTableModel

ResultSetTableModel uses an existing ResultSet and display it in a table model.

See Also:
Serialized Form

Field Summary
protected  com.jidesoft.database.TableModelCache _cache
           
protected  int _currentRow
           
protected  boolean _forwardOnly
           
protected  int _recordCount
           
protected  ResultSet _resultSet
           
protected static Logger LOGGER
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ResultSetTableModel(ResultSet resultSet)
          Creates a RecordSetTableModel.
ResultSetTableModel(ResultSet resultSet, int recordCount)
          Creates a RecordSetTableModel.
 
Method Summary
 void close()
           
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 int getMaximumCachedRows()
           
 ResultSet getResultSet()
           
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 void invalidateCache()
           
 void invalidateCache(int row)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isForwardOnly()
           
 boolean isUpdatable()
           
 void refreshData()
          Queries the ResultSet and create the column information.
 void setForwardOnly(boolean forwardOnly)
           
 void setMaximumCachedRows(int maximumCachedRows)
           
 void setUpdatable(boolean updatable)
           
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_recordCount

protected int _recordCount

_currentRow

protected transient int _currentRow

_cache

protected com.jidesoft.database.TableModelCache _cache

_forwardOnly

protected boolean _forwardOnly

_resultSet

protected ResultSet _resultSet

LOGGER

protected static final Logger LOGGER
Constructor Detail

ResultSetTableModel

public ResultSetTableModel(ResultSet resultSet)
                    throws SQLException
Creates a RecordSetTableModel.

Parameters:
resultSet - a database ResultSet.
Throws:
SQLException - if a database related error happens. It could be because the connection is closed.

ResultSetTableModel

public ResultSetTableModel(ResultSet resultSet,
                           int recordCount)
                    throws SQLException
Creates a RecordSetTableModel.

Parameters:
resultSet - a database ResultSet.
recordCount - the record count in the ResultSet.
Throws:
SQLException - if a database related error happens. It could be because the connection is closed.
Method Detail

getColumnCount

public int getColumnCount()

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getRowCount

public int getRowCount()

invalidateCache

public void invalidateCache(int row)

invalidateCache

public void invalidateCache()

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)

refreshData

public void refreshData()
                 throws SQLException
Queries the ResultSet and create the column information.

Throws:
SQLException - if a database access error occurs, this method is called on a closed Statement or the given SQL statement produces anything other than a single ResultSet object

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

setUpdatable

public void setUpdatable(boolean updatable)

isUpdatable

public boolean isUpdatable()

getResultSet

public ResultSet getResultSet()

isForwardOnly

public boolean isForwardOnly()

setForwardOnly

public void setForwardOnly(boolean forwardOnly)

close

public void close()
           throws SQLException
Throws:
SQLException

getMaximumCachedRows

public int getMaximumCachedRows()

setMaximumCachedRows

public void setMaximumCachedRows(int maximumCachedRows)

JIDE 3.5.15