|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
com.compomics.util.db.DBResultSet
public class DBResultSet
This class wraps a DB resultset in an 'offline' object.
Field Summary |
---|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
DBResultSet()
Default constructor, just creates an empty resultset. |
|
DBResultSet(java.sql.ResultSet aRS)
This constructor takes a ResultSet from which the data is read. |
|
DBResultSet(java.sql.ResultSet aRS,
boolean aNullReplace)
This constructor takes a ResultSet from which the data is read. |
Method Summary | |
---|---|
java.lang.Class |
getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex . |
int |
getColumnCount()
This method reports on the number of columns in the resultset. |
java.lang.String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... |
java.lang.String[] |
getColumnNames()
This method reports on all the columnn ames. |
java.lang.Object[][] |
getData()
This method reports on the data stored in the resultset. |
int |
getRowCount()
This method reports on the number of rows in the resultset. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and
rowIndex . |
void |
writeToCSVFile(java.io.Writer out,
java.lang.String aSeparator)
This method allows the caller to write the current dataset to the specified Writer. |
void |
writeToHTMLTable(java.io.Writer out,
int aBorderstyle)
This method allows the caller to write the current dataset to the specified Writer. |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, 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 |
---|
public DBResultSet()
public DBResultSet(java.sql.ResultSet aRS) throws java.sql.SQLException
aRS
- ResultSet from which to read the data. Closing the ResultSet
is up to the caller!!
java.sql.SQLException
- whenever reading the resultset failed.public DBResultSet(java.sql.ResultSet aRS, boolean aNullReplace) throws java.sql.SQLException
aRS
- ResultSet from which to read the data. Closing the ResultSet
is up to the caller!!aNullReplace
- boolean to indicate whether 'null' values returned by
the DB should be converted into "(null)" Strings ('true')
or not ('false').
java.sql.SQLException
- whenever reading the resultset failed.Method Detail |
---|
public java.lang.String[] getColumnNames()
public java.lang.Object[][] getData()
public int getColumnCount()
public int getRowCount()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried
public java.lang.Class getColumnClass(int columnIndex)
Object.class
regardless of columnIndex
.
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
columnIndex
- the column being queried
public java.lang.String getColumnName(int column)
column
cannot be found,
returns an empty string.
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the column being queried
column
public void writeToCSVFile(java.io.Writer out, java.lang.String aSeparator) throws java.io.IOException
out
- Writer to print to. Note that flushing and closing this
writer is up to the caller.aSeparator
- String with the separator character(s) to use.
java.io.IOException
- when something goes wrong.public void writeToHTMLTable(java.io.Writer out, int aBorderstyle) throws java.io.IOException
out
- Writer to print to. Note that flushing and closing this
writer is up to the caller.aBorderstyle
- int with the HTML table border tag style for the table.
java.io.IOException
- when something goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |