|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.swing.table.AbstractTableModel
|
+--com.zfqjava.swing.model.ResultSetTableModel
ResultSetTableModel provides a
ResultSet table model.
The TableModel methods use the model row index, all
other methods use the data row index of the ResultSet, but it is
0 based.
The page index also is 0 based.
All row index must be >= 0, and all first index must be
<= last index.
| Field Summary | |
static int |
CHANGE_CELL
Identifies the update or insert policy. |
static int |
CHANGE_PAGE
Identifies the update or insert policy. |
static int |
CHANGE_ROW
Identifies the update or insert policy. |
protected javax.swing.event.SwingPropertyChangeSupport |
changeSupport
If any PropertyChangeListeners have been registered, the
changeSupport field describes them. |
static int |
OFF
Identifies the update or insert policy. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
ResultSetTableModel(java.sql.ResultSet rs)
Constructs a ResultSetTableModel with a rs. |
|
ResultSetTableModel(java.sql.ResultSet rs,
boolean sync)
Constructs a ResultSetTableModel with a rs. |
|
ResultSetTableModel(java.sql.ResultSet rs,
boolean sync,
int pageSize)
Constructs a ResultSetTableModel with a rs. |
|
ResultSetTableModel(java.sql.ResultSet rs,
int pageSize)
Constructs a ResultSetTableModel with a rs. |
|
ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password)
Constructs a ResultSetTableModel with a SQL query command. |
|
ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password,
boolean sync)
Constructs a ResultSetTableModel with a SQL query command. |
|
ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password,
boolean sync,
int pageSize)
Constructs a ResultSetTableModel with a SQL query command. |
|
ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password,
int pageSize)
Constructs a ResultSetTableModel with a SQL query command. |
|
| Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
int |
dataToModelRow(int dataRow)
Converts the ResultSet row index to the model row index. |
void |
deleteRow()
Deletes the data row at the specified current row index. |
void |
deleteRow(int rowIndex)
Deletes the data row at the specified row index. |
void |
deleteRow(int firstRow,
int lastRow)
Deletes the data row from firstRow to lastRow |
protected void |
firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Supports reporting bound property changes. |
void |
firstRow()
Goto the fist row. |
int |
getAllRowCount()
Returns all row count. |
java.lang.Class |
getColumnClass(int columnIndex)
|
int |
getColumnCount()
|
java.lang.String |
getColumnName(int columnIndex)
|
int |
getFirstRowIndex()
Returns the first row index in current page. |
int |
getPageCount()
Returns the page count. |
int |
getPageIndex()
Returns the current page index. |
int |
getPageSize()
Returns the page size. |
int |
getRowCount()
|
int |
getRowIndex()
Returns the current row index. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
|
void |
lastRow()
Goto the last row. |
int |
modelToDataRow(int modelRow)
Converts the model row index to the ResultSet row index. |
void |
nextPage()
Show the next page. |
void |
nextRow()
Goto the next row. |
void |
previousPage()
Show the previous page. |
void |
previousRow()
Goto the previous row. |
void |
refreshCell(int rowIndex,
int columnIndex)
Refreshs the cell at the specified row and column index. |
void |
refreshCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
Refreshs the cell at the specified row and column index. |
void |
refreshRow()
Refreshs the data row at the specified current row index. |
void |
refreshRow(int rowIndex)
Refreshs the data row at the specified row index. |
void |
refreshRow(int firstRow,
int lastRow)
Refreshs the data row from firstRow to lastRow |
void |
reload()
Reloads all record from database. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
setAutoInsertPolicy(int insertPolicy)
Sets the auto insert policy. |
void |
setAutoUpdatePolicy(int updatePolicy)
Sets the auto update policy. |
void |
setPageIndex(int pageIndex)
Sets the page index. |
void |
setRowIndex(int rowIndex)
Sets the row index. |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
|
void |
updateCell(int rowIndex,
int columnIndex)
Updates the cell at the specified row and column index. |
void |
updateCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
Updates the cell at the specified row and column index. |
void |
updateRow()
Updates the data row at the specified current row index. |
void |
updateRow(int rowIndex)
Updates the data row at the specified row index. |
void |
updateRow(int firstRow,
int lastRow)
Updates the data row from firstRow to lastRow |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int CHANGE_CELL
public static final int CHANGE_ROW
public static final int CHANGE_PAGE
public static final int OFF
protected javax.swing.event.SwingPropertyChangeSupport changeSupport
PropertyChangeListeners have been registered, the
changeSupport field describes them.| Constructor Detail |
public ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password)
sql - the SQL commandurl - the JDBC url for connectionusername - the user name for connectionpassword - the password for connection
public ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password,
int pageSize)
sql - the SQL commandurl - the JDBC url for connectionusername - the user name for connectionpassword - the password for connectionpageSize - the page size for the record
public ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password,
boolean sync)
sql - the SQL commandurl - the JDBC url for connectionusername - the user name for connectionpassword - the password for connectionsync - the synchronized flag
public ResultSetTableModel(java.lang.String sql,
java.lang.String url,
java.lang.String username,
java.lang.String password,
boolean sync,
int pageSize)
sql - the SQL commandurl - the JDBC url for connectionusername - the user name for connectionpassword - the password for connectionsync - the synchronized flagpageSize - the page size for the recordpublic ResultSetTableModel(java.sql.ResultSet rs)
rs.rs - the ResultSet
public ResultSetTableModel(java.sql.ResultSet rs,
boolean sync)
rs.rs - the ResultSetsync - the synchronized flag
public ResultSetTableModel(java.sql.ResultSet rs,
int pageSize)
rs.rs - the ResultSetpageSize - the page size for the record
public ResultSetTableModel(java.sql.ResultSet rs,
boolean sync,
int pageSize)
rs.rs - the ResultSetsync - the synchronized flagpageSize - the page size for the record| Method Detail |
public void reload()
public int getPageSize()
public int getPageCount()
public void setPageIndex(int pageIndex)
pageIndex - the page indexgetPageIndex()public int getPageIndex()
setPageIndex(int)public void nextPage()
public void previousPage()
public void setRowIndex(int rowIndex)
rowIndex - the row indexgetRowIndex()public int getRowIndex()
setRowIndex(int)public int getFirstRowIndex()
public int getAllRowCount()
Note:This is different with getRowCount
when use page mode.
public void nextRow()
public void lastRow()
public void previousRow()
public void firstRow()
public void setAutoUpdatePolicy(int updatePolicy)
updatePolicy - the update policypublic void setAutoInsertPolicy(int insertPolicy)
insertPolicy - the insert policy
public void updateCell(int rowIndex,
int columnIndex)
rowIndex - the data row indexcolumnIndex - the data column index
public void refreshCell(int rowIndex,
int columnIndex)
rowIndex - the data row indexcolumnIndex - the data column index
public void updateCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
firstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell area
public void refreshCell(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
firstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell areapublic void updateRow()
public void updateRow(int rowIndex)
rowIndex - the row index
public void updateRow(int firstRow,
int lastRow)
firstRow to lastRowfirstRow - the first row indexlastRow - the last row indexpublic void deleteRow()
public void deleteRow(int rowIndex)
rowIndex - the row index
public void deleteRow(int firstRow,
int lastRow)
firstRow to lastRowfirstRow - the first row indexlastRow - the last row indexpublic void refreshRow()
public void refreshRow(int rowIndex)
rowIndex - the row index
public void refreshRow(int firstRow,
int lastRow)
firstRow to lastRowfirstRow - the first row indexlastRow - the last row indexpublic int modelToDataRow(int modelRow)
modelRow - the mode row indexpublic int dataToModelRow(int dataRow)
dataRow - the data row indexpublic int getRowCount()
getRowCount in class javax.swing.table.AbstractTableModelpublic int getColumnCount()
getColumnCount in class javax.swing.table.AbstractTableModelpublic java.lang.String getColumnName(int columnIndex)
getColumnName in class javax.swing.table.AbstractTableModelpublic java.lang.Class getColumnClass(int columnIndex)
getColumnClass in class javax.swing.table.AbstractTableModel
public boolean isCellEditable(int rowIndex,
int columnIndex)
isCellEditable in class javax.swing.table.AbstractTableModel
public java.lang.Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in class javax.swing.table.AbstractTableModel
public void setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
setValueAt in class javax.swing.table.AbstractTableModel
protected void firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
protected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
PropertyChangeEvent to any registered
PropertyChangeListeners.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to the listener list.
The listener is registered for all properties.
A PropertyChangeEvent will get fired in response to setting
a bound property, e.g. setFont, setBackground,
or setForeground.
Note that if the current component is inheriting its foreground,
background, or font from its container, then no event will be
fired in response to a change in the inherited property.
listener - The PropertyChangeListener to be addedAction#addPropertyChangeListenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.listener - the PropertyChangeListener to be removedAction#removePropertyChangeListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||