|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
quick.dbtable.DBTable
DBTable is a complete JTable alternative Javabean. DBTable can be used as
DBTable dBTable1 = new DBTable();
dBTable1.connectDatabase("oracle.jdbc.driver.OracleDriver",
"jdbc:oracle:thin:@myServer:1526:myInstance",
"username" ,
"password");
dBTable1.setSelectSql("select * from employee");
dBTable1.refresh();
Navigation bar to navigate within the records is available, you need to call the
createControlPanel() method to create the navigation bar.
See How to use DBtable
See DBTable FAQ
See Don't forget to look at this sample which explains how to use DBTable.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Field Summary | |
static int |
ALL_NAVIGATION
navigation, insert, delete |
boolean |
autoCommit
If you want to handle the commit/rollback yourself, instead of quicktable handling it for you, set autoCommit to false. |
boolean |
copyColumnHeaderNames
While copying data from quickTable to clipboard, setting copyColumnHeaderNames will include column headers in the copied data. |
boolean |
debug
To get the debug messages , set this variable to true. |
boolean |
doNotUseDatabaseSort
If you don't want to use the database query to sort the results and if you always want to sort by quicktable's sort set this to true |
boolean |
enableTextOverwriteOnCellEdit
If enableTextOverwriteOnCellEdit set to true, Whenever user starts editing a text cell, the previous value will be erased and the new value will be set. |
static int |
EQUAL
|
static int |
GREATER
|
static int |
LESS
|
boolean |
postponeDBInsert
When you attach a DatabaseChangeListener with quicktable and during beforeInsert(), if you return false that means you don't want quickTable to do the insert, instead you will handle the database insert yourself. |
static int |
READ_DELETE_NAVIGATION
navigation, delete |
static int |
READ_INSERT_NAVIGATION
navigation, insert |
static int |
READ_NAVIGATION
navigation only |
boolean |
retainConnection
when you switch between the database bound modes and non bound modes, usually the database connections are closed next time when you go to the database bound mode, again a connection will be created. |
boolean |
showCriticalWarnings
QuickTable displays various critical warnings, which needs to be corrected by developers. |
boolean |
showFindReplaceMessages
While doing find or replace, quicktable shows informative messages like text not found, search complete, 10 replacements etc. |
static int |
UPDATE_DATABASE_ON_CELL_EXIT
By setting the setDatabaseUpdateMode() with this option, will save the changes to database once the user tries to go to a different cell than the currently edited cell |
static int |
UPDATE_DATABASE_ON_ROW_EXIT
By setting the setDatabaseUpdateMode() with this option, will save the changes to database once the user tries to go to a different row than the currently edited row |
| Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
DBTable()
Creates an empty table |
|
| Method Summary | |
void |
addColumn(Column aColumn)
add a column to table. |
void |
addColumnSelectionInterval(int index0,
int index1)
Adds the columns from index0 to index0 inclusive to the current selection. |
void |
addDatabaseChangeListener(DatabaseChangeListener tc)
If you want to confirm the database insert/update/delete then add this listener. |
void |
addDBTableErrorListener(DBTableErrorListener yourListener)
If you want to handle the exceptions or errrors occured add this Listener. |
void |
addDBTableEventListener(DBTableEventListener yourListener)
Listen for various DBTable events |
void |
addDeleteSql(java.sql.CallableStatement deleteStatement,
java.lang.String columnPointer)
Sets the delete callable statement which is used delete the record from the table. |
void |
addDeleteSql(java.sql.PreparedStatement deleteStatement,
java.lang.String columnPointer)
Sets the delete prepared statement which is used delete the record from the table. |
void |
addDeleteSql(java.lang.String deleteStatement,
java.lang.String columnPointer)
Sets the delete statement which is used delete the record from the table. |
void |
addFocusListener(java.awt.event.FocusListener l)
|
void |
addInsertSql(java.sql.CallableStatement insertStatement,
java.lang.String columnPointer)
Sets the insert callable statement which is used to insert a record into table. |
void |
addInsertSql(java.sql.PreparedStatement insertStatement,
java.lang.String columnPointer)
Sets the insert prepared statement which is used to insert a record into table. |
void |
addInsertSql(java.lang.String insertStatement,
java.lang.String columnPointer)
Sets the insert statement which is used to insert a record into table. |
void |
addKeyListener(java.awt.event.KeyListener l)
|
void |
addMouseListener(java.awt.event.MouseListener l)
|
void |
addRowSelectionInterval(int index0,
int index1)
Adds the rows from index0 to index0 inclusive to the current selection. |
void |
addTableCellListener(DBTableCellListener tc)
This listener need to be added if you want to do cell data validation. |
void |
addUpdateSql(java.sql.CallableStatement updateStatement,
java.lang.String columnPointer)
Sets the update callable statement which is used to update data to the database when user changes values in the cells of table. |
void |
addUpdateSql(java.sql.CallableStatement updateStatement,
java.lang.String columnPointer,
int[] primaryColumns)
Sets the update callable statement which is used to update data to the database when user changes values in the cells of table. |
void |
addUpdateSql(java.sql.PreparedStatement updateStatement,
java.lang.String columnPointer)
Sets the update preparedstatement which is used to update data to the database when user changes values in the cells of table. |
void |
addUpdateSql(java.sql.PreparedStatement updateStatement,
java.lang.String columnPointer,
int[] primaryColumns)
Sets the update preparedstatement which is used to update data to the database when user changes values in the cells of table. |
void |
addUpdateSql(java.lang.String updateStatement,
java.lang.String columnPointer)
Sets the update statement which is used to update data to the database when user changes values in the cells of table. |
void |
addUpdateSql(java.lang.String updateStatement,
java.lang.String columnPointer,
int[] primaryColumns)
Sets the update statement which is used to update data to the database when user changes values in the cells of table. |
void |
cleanup()
Cleans up swing resources like frames used within DBTable. |
void |
clearAllDeleteSql()
clears all the delete sqls which were added using addDeleteSql method when you change the select sqls of a table and if you have assigned delete sqls before then we have to call this method which will clear all the old delete sqls, so that you can add new delete sqls for your new select sql |
void |
clearAllInsertSql()
clears all the insert sqls which were added using addInsertSql method when you change the select sqls of a table and if you have assigned insert sqls before then we have to call this method which will clear all the old insert sqls, so that you can add new insert sqls for your new select sql |
void |
clearAllSettings()
clears the currently used settings This clears the following UpdateSql InsertSql DeleteSql ErrorListener CellListener ChangeListener cellPropertiesModel Comparator |
void |
clearAllUpdateSql()
clears all the update sqls which were added using addUpdateSql method when you change the select sqls of a table and if you have assigned update sqls before then we have to call this method which will clear all the old update sqls, so that you can add new update sqls for your new select sql |
void |
clearSelection()
Deselects all selected columns and rows. |
void |
close()
Closes all the database resources |
static int |
compareObject(java.lang.Object o1,
java.lang.Object o2)
Utility method which can be used to compare two objects This method is added here, becuase it may be useful while implementing your own filter This method returns EQUAL, GREATER, LESS based on o1 compared with o2 |
void |
connectDatabase()
Makes the database connection You need to provide the database driver, jdbcurl, user, pass before calling this method |
void |
connectDatabase(java.lang.String dbDriver,
java.lang.String jdbcUrl,
java.lang.String user,
java.lang.String password)
Makes the database connection, using the specified parameters |
void |
copyToClipboard(int[] row)
Copies the content in the rows to clipboard, later it can be pasted in Excel or any text Editor. |
void |
createColumnModelFromQuery()
Creates the columnModel from the query, this uses ResultSetMetadata class to get the column properties. |
void |
createControlPanel()
Creates the control panel all the navigation buttons |
void |
createControlPanel(int type)
Creates the control panel based on the navigation types. |
void |
delete()
Deletes currently selected rows |
void |
delete(int[] rows)
Deletes the rows |
void |
doFind()
Shows the find window, where user can enter the text to be found and does the find automatically If you want to do find programatically use find() method |
void |
doFindAndReplace()
Shows the find & replace window, where user can enter the text to be found and the replace string and the find & replace is done automatically If you want to do find and replace programatically use replace() method |
boolean |
editCellAt(int row,
int column)
Programmatically starts editing the cell at row and column, if the cell is editable. |
void |
enableExcelCopyPaste()
allows to do copy & paste from Excel into quicktable This option will work in applet only if applet has access to system clipboard. |
void |
filter(Filter filter)
Filters the data based on the given filter object If null is passed, then all the recorsd will be displayed |
void |
filter(int column,
int criteria,
java.lang.Object key)
Filters the data based on the given criteria |
java.awt.Point |
find(int r,
int colIndex,
java.lang.String findString1,
java.util.Vector searchCol,
boolean next)
Find searches for a given text and highlights the cell which contains the text |
java.awt.Point |
find(int r,
int colIndex,
java.lang.String findString1,
java.util.Vector searchCol,
boolean next,
int[] row)
Find searches for a given text in a given array of rows and highlights the cell which contains the text |
java.awt.Font |
findFont(java.lang.String sampleText)
A utility method to find the font which can display the given specific language text |
void |
fireTableCellUpdated(int row,
int column)
Notify all listeners that the value of the cell at (row, column) has been updated. |
void |
fireTableDataChanged()
Notify all listeners that all cell values in the table's rows may have changed. |
void |
first()
Selects the first row and makes sure first row is visible |
CellPropertiesModel |
getCellPropertiesModel()
gets the cellPropertiesModel of the table |
Column |
getColumn(int colIndex)
Returns the column object for the specified index. |
Column |
getColumnAsCreated(int colIndex)
Returns the column object for the specified index, as it was created. |
Column |
getColumnByDatabaseName(java.lang.String colName)
gets the Column based on the database column name If the column name is not found, this returns null |
Column |
getColumnByHeaderName(java.lang.String colName)
gets the Column based on the column header name If the column name is not found, this returns null |
int |
getColumnCount()
Returns the number of columns Source: Copied from JTable for convenience |
java.sql.Connection |
getConnection()
Returns the database Connection object used by the table |
int |
getCurrentIndexForOriginalColumn(int colIndex)
If the columns have been moved/rearranged by the user, this method will return the new moved location of a original/created column index colIndex starts from 0,1,2,3... |
java.lang.Object[][] |
getDataArray()
Returns the quicktable data in a array |
java.lang.String |
getDatabaseDriver()
gets the database driver |
int |
getDatabaseUpdateMode()
gets the update mode about when the changes should be updated to database |
java.util.Vector |
getDataVector()
Returns the quicktable data in a Vector of Vector |
int |
getEditingColumn()
This returns the index of the editing column. |
int |
getEditingRow()
Returns the index of the editing row. |
javax.swing.JTable |
getFixedTable()
If you have created fixed columns using setFixedColumns(), then this method will return the JTable used by this fixed columns |
java.lang.String |
getJdbcUrl()
gets the JdbcUrl used |
int |
getMaximumRowCount()
returns the maximum row count |
int |
getOriginalColumnIndex(int colIndex)
If the columns have been moved/rearranged by the user, this method will return the original/created column index for a given (moved) column colIndex starts from 0,1,2,3... |
java.lang.String |
getPassword()
gets the password |
java.awt.print.Printable |
getPrintable(PrintProperties prop)
Gets the Printable for this table. |
PreviewPanel |
getPrintPreviewCanvas()
creates a printpreview Canvas This will be useful to create your own print preview frame |
PreviewPanel |
getPrintPreviewCanvas(int pageWidth,
int pageHeight)
creates a printpreview Canvas, with the paper size of given width & height. |
PreviewPanel |
getPrintPreviewCanvas(PrintProperties prop)
creates a printpreview Canvas with the given PrintProperties. |
int |
getRowCount()
Returns the number of rows in the table. |
java.lang.Object |
getRowObject(int row)
Gets the Data object in this row. |
int |
getSelectedColumn()
Returns the index of the first selected column, -1 if no column is selected. |
int |
getSelectedColumnCount()
Returns the number of selected columns. |
int[] |
getSelectedColumns()
Returns the indices of all selected columns. |
int |
getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected. |
int |
getSelectedRowCount()
Returns the number of selected rows. |
int[] |
getSelectedRows()
Returns the indices of all selected rows. |
java.lang.String |
getSelectSql()
gets the select statement which is used to fetch data to be displayed in the table |
Skin |
getSkin()
Gets the current skin applied If no skin is assigned it returns null |
java.util.Vector |
getSortColumns()
returns a vector of Integer columns based on which the data is currently sorted. |
javax.swing.JTable |
getTable()
gets the JTable used by this DBTable You should use the returned JTable cautiously |
javax.swing.table.JTableHeader |
getTableHeader()
Returns the tableHeader working with this JTable. |
java.lang.String |
getUser()
gets the user name |
java.lang.Object |
getValueAt(int row,
int column)
Returns the cell value at row and column. |
java.lang.String |
getVersion()
returns the version of quicktable |
void |
goTo(int row)
Selects this row and makes sure this row is visible |
void |
insert(java.util.Vector insertElements)
Inserts the records into the Jtable. |
void |
insert(java.util.Vector insertElements,
int row)
Inserts the record at the given row into the Jtable. |
void |
insertEmptyRecord()
Inserts an empty records into the Jtable. |
boolean |
isInsertingRow(int row)
From the time when the row was inserted into the table and until the inserted row was added to the database, this method will return true for that row. |
boolean |
isRowSelected(int row)
Returns true if the row at the specified index is selected Source: Copied from JTable for convenience |
boolean |
isSortAscending()
returns the current sort order |
void |
last()
Selects the last row and makes sure last row is visible |
void |
loadAllRows()
In some cases like when using database, quicktable loads data into table as user scrolls down to minimize memory usage This method will load all rows |
void |
moveColumn(int column,
int targetColumn)
Moves the column column to the position currently occupied by the column targetColumn. |
void |
next()
Selects the next row with respect to the currently selected row and makes sure that row is visible |
void |
pasteFromClipboard()
Paste the clipboard content into dbtable The content should be in a tab delimited format If you copy from Excel , it will be in a tab delimited format, else you can use a text editor |
void |
previous()
Selects the previous row with respect to the currently selected row and makes sure that row is visible |
void |
print()
Prints the contents of quicktable to printer This prints all the pages in portriat mode for A4 size paper If you want to print only specific pages use print(int[]) |
void |
print(int[] pages)
Prints the contents of quicktable to printer only for specific pages This prints in portriat mode for A4 size paper If you want to print all pages use print() |
void |
print(int[] pages,
int pageWidth,
int pageHeight)
Prints the contents of quicktable to printer with a paper size of pageWidth & pageHeight |
void |
print(int[] pages,
PrintProperties prop)
Prints the contents of quicktable to printer only for specific pages This prints based on the given Print properties If you want to print all pages use print(PrintProperties) |
void |
print(int pageWidth,
int pageHeight)
Prints the contents of quicktable to printer with a paper size of pageWidth & pageHeight |
void |
print(PrintProperties prop)
Prints the contents of quicktable to printer This prints all the pages using the given print properties If you want to print only specific pages use print(int[], PrintProperties) |
void |
printPreview()
Shows the print preview frame |
void |
printPreview(int pageWidth,
int pageHeight)
Shows the print preview frame, with the paper size of given width & height |
void |
printPreview(PrintProperties prop)
Shows the print preview frame for the given Print Properties |
void |
refresh()
This fires the query , and refills the table with the new data Note: This method should be used only when you have set a sql/stored procedure through setSelectSql In all the other cases call the other refresh() methods |
void |
refresh(java.io.BufferedReader in,
java.util.Properties prop)
loads a BufferedReader which contains delimited data |
void |
refresh(java.io.BufferedReader input,
java.lang.String delimiter)
loads a BufferedReader which contains delimited data |
void |
refresh(java.io.File f,
java.util.Properties prop)
loads a data file into quicktable |
void |
refresh(java.io.File f,
java.lang.String delimiter)
loads a delimited data file into quicktable |
void |
refresh(java.io.InputStream input,
java.util.Properties prop)
loads a inputstream which contains data to be loaded |
void |
refresh(java.io.InputStream input,
java.lang.String delimiter)
loads a inputstream which contains delimited data |
void |
refresh(java.lang.Object[][] input)
loads a two dimensional array of objects into quicktable |
void |
refresh(java.sql.ResultSet rs)
Loads the data from the resultset |
void |
refresh(java.net.URL url,
java.util.Properties prop)
loads a delimited file, found in the url into quicktable |
void |
refresh(java.net.URL url,
java.lang.String delimiter)
loads a delimited file, found in the url into quicktable |
void |
refresh(java.util.Vector input)
loads a two dimensional vector of objects into quicktable |
void |
refreshDataObject(java.util.Collection input,
java.lang.String[] methodNames)
loads a Collection of Data objects into quicktable |
void |
refreshDataObject(java.util.Enumeration input,
java.lang.String[] methodNames)
loads a enumeration of Data objects into quicktable |
void |
refreshDataObject(java.util.Vector input,
java.lang.String[] methodNames)
loads a Vector of Data objects into quicktable |
void |
refreshSkin()
The skin assigned to the table through setSkin() method will be applied to the table This method should be called only if you feel that the skin is not getting refreshed |
void |
removeAllRows()
Clears all data which is currently shown in the table. |
void |
removeColumn(Column aColumn)
|
void |
removeColumnHeader()
Removes the column header from the table |
void |
removeColumnSelectionInterval(int index0,
int index1)
Deselects the columns from index0 to index0 inclusive. |
void |
removeDatabaseChangeListener(DatabaseChangeListener tc)
|
void |
removeDBTableErrorListener(DBTableErrorListener yourListener)
|
void |
removeDBTableEventListener(DBTableEventListener yourListener)
|
void |
removeFocusListener(java.awt.event.FocusListener l)
|
void |
removeKeyListener(java.awt.event.KeyListener l)
|
void |
removeMouseListener(java.awt.event.MouseListener l)
|
void |
removeNotify()
|
void |
removeRowSelectionInterval(int index0,
int index1)
Deselects the rows from index0 to index0 inclusive. |
void |
removeTableCellListener(DBTableCellListener tc)
|
java.awt.Point |
replace(int r,
int colIndex,
java.lang.String findString1,
java.lang.String replaceString,
java.util.Vector searchCol,
boolean next)
replace searches for a text , highlights the cell and prompts you whether you want to replace the text |
java.awt.Point |
replace(int r,
int colIndex,
java.lang.String findString1,
java.lang.String replaceString,
java.util.Vector searchCol,
boolean next,
int[] row)
replace searches for a text , highlights the cell and prompts you whether you want to replace the text |
java.awt.Point |
replaceAll(int r,
int colIndex,
java.lang.String findString1,
java.lang.String replaceString,
java.util.Vector searchCol)
replaceAll searches for a text , once the text is found it is replaced without confirmation and all occurences are replaced |
java.awt.Point |
replaceAll(int r,
int colIndex,
java.lang.String findString1,
java.lang.String replaceString,
java.util.Vector searchCol,
int[] row)
replaceAll searches for a text , once the text is found it is replaced without confirmation and all occurences are replaced |
void |
save()
Usually changes are saved automatically when the selection of row changes This method saves any pending insert or updates |
void |
scrollToCell(int row,
int column)
If this cell is currently not visible, the view will be scrolled to show the cell |
void |
selectAll()
Select all rows, columns and cells in the table. |
void |
selectCell(int rowOfCellToBeSelected,
int columnOfCellToBeSelected)
selects the cell. |
void |
selectCell(int rowOfCellToBeSelected,
int columnOfCellToBeSelected,
boolean focus)
|
void |
selectFirstVisibleColumnCell(int row,
boolean focus)
|
void |
setCellComponent(Column c,
int cellType,
java.util.Hashtable cellValueToDisplayHash)
sets the column's cell's component for rendering and editing. |
void |
setCellComponent(Column c,
int cellType,
java.util.Hashtable cellValueToDisplayHash,
boolean addClearOption)
sets the column's cell's component for rendering and editing See the documentation of the other method for more information, setCellComponent(Column, int , Hashtable) The only difference than the other method is, you can add an empty cell to select null values |
void |
setCellComponent(Column c,
int cellType,
java.util.Hashtable cellValueToDisplayHash,
java.lang.Object[] keysSortOrder,
boolean addClearOption)
sets the column's cell's component for rendering and editing See the documentation of the other method for more information, setCellComponent(Column, int , Hashtable) The only difference than the other method is, you can sort the combo box listed items using keysSortOrder. |
void |
setCellPropertiesModel(CellPropertiesModel cellModel)
Sets the cellPropertiesModel for the table. |
void |
setComparator(Comparator comp)
Sets the compartor which should be used for sorting |
void |
setConnection(java.sql.Connection newConnection)
Sets the database Connection object to be used by this table |
void |
setControlPanelVisible(boolean visible)
show/hide the control panel |
void |
setDatabaseDriver(java.lang.String input)
Sets the database driver |
void |
setDatabaseUpdateMode(int mode)
sets the update mode about when the changes should be updated to database |
void |
setDBTableLocale(java.util.Locale currentLocale)
sets the locale for quickTable. |
void |
setDBTableLocale(java.util.Locale currentLocale,
java.awt.Font localeFont)
sets the locale for quickTable. |
void |
setDBTableLocale(java.util.Locale currentLocale,
java.lang.String localeUnicodeText)
sets the locale for quickTable. |
void |
setEditable(boolean val)
sets the editable property of this table. |
void |
setFixedColumns(int[] cols)
Sets the fixed columns. |
void |
setJdbcUrl(java.lang.String input)
Sets the jdbc url |
void |
setMaximumRowCount(int row)
sets the maximum rows which QuickTable will load, even though the source may have more rows Example a query returns 1000 records & you want to show only first 100 records This method should be called before you call refresh() This method won't set the maximum row, when the source is array or vector |
void |
setPassword(java.lang.String input)
Sets the password |
void |
setRowCountSql(java.lang.String rowCountSql)
Sets the sql which is used to calculate the total rows available for the current select sql |
void |
setRowSelectionInterval(int index0,
int index1)
Selects the rows from index0 to index1 inclusive. |
void |
setSelectSql(java.lang.String input)
Sets the select sql or stored procedure which should be used to fetch data to be displayed in the table The column properties will be refreshed from database everytime the Select sql is changed using this method |
void |
setSkin(Skin skin)
Apply the skin to table. |
void |
setSortEnabled(boolean val)
If you don't want quicktable to do its default sort,when the user clicks on column header, pass false |
void |
setSorter(Sorter sorter)
Sets the sorter which should be used for sorting |
void |
setUser(java.lang.String input)
Sets the user |
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
Sets the value for the cell at row and column. |
void |
sortByColumn(int column,
boolean ascending)
Sorts the data by the given column Note:In Mac OS, sorting will not show the sort type icon in header |
void |
sortByColumns(java.util.Vector columnVector,
boolean ascending)
Sorts the data by many columns Note:In Mac OS, sorting will not show the sort type icon in header |
void |
update(int row,
int col,
java.lang.Object value)
updates the cell with the new value this update is also done in the database |
void |
useOldColumnProperties(boolean val)
to set whether column properties should be recreated or not The column properties will be refreshed from database based on useOldColumnProperties argument |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public boolean debug
public boolean showCriticalWarnings
public boolean showFindReplaceMessages
public boolean retainConnection
public static final int ALL_NAVIGATION
public static final int READ_INSERT_NAVIGATION
public static final int READ_DELETE_NAVIGATION
public static final int READ_NAVIGATION
public static final int UPDATE_DATABASE_ON_ROW_EXIT
public static final int UPDATE_DATABASE_ON_CELL_EXIT
public boolean autoCommit
public boolean copyColumnHeaderNames
public boolean enableTextOverwriteOnCellEdit
public boolean postponeDBInsert
DatabaseChangeListener.beforeInsert(int)public boolean doNotUseDatabaseSort
public static final int EQUAL
public static final int GREATER
public static final int LESS
| Constructor Detail |
public DBTable()
| Method Detail |
public void createControlPanel()
public void setControlPanelVisible(boolean visible)
public void createControlPanel(int type)
public void delete()
public void scrollToCell(int row,
int column)
public void goTo(int row)
public void first()
public void last()
public void previous()
public void next()
public void setSortEnabled(boolean val)
public void delete(int[] rows)
throws java.lang.Exception
rows - array of rownumbers , the row numbers start from 0,1,2..
java.lang.Exceptionpublic void insert(java.util.Vector insertElements)
This doesn't inserts into database
Insertion into database occurs when
1) the user moves away from this record by selecting another row
2) closing the table
3) by calling save() method
Example : the columns are EmpNo, EmpName and you want to set empNo=10, empName="Alice"
Vector insertVector = new Vector();
//since first column is empNo, insert that value first into the vector
insertVector.addElement(new Integer(10));
//add the second columnvalue
insertVector.addElement("Alice");
yourDBTableInstance.insert(insertVector);
insertElements - a vector whose elements are the cell values
and the elements should be in the same order of columns
public void insert(java.util.Vector insertElements,
int row)
This doesn't inserts into database
Insertion into database occurs when
1) the user moves away from this record by selecting another row
2) closing the table
3) by calling save() method
Example : the columns are EmpNo, EmpName and you want to set empNo=10, empName="Alice"
Vector insertVector = new Vector();
//since first column is empNo, insert that value first into the vector
insertVector.addElement(new Integer(10));
//add the second columnvalue
insertVector.addElement("Alice");
yourDBTableInstance.insert(insertVector,3);
insertElements - a vector whose elements are the cell values
and the elements should be in the same order of columnsrow - The row where this record should be inserted. Valid values for row would be 0 to rowcount-1public void insertEmptyRecord()
This doesn't inserts into database Insertion into database occurs when 1) the user moves away from this record by selecting another row 2) closing the table 3) by calling save() method
public void setDatabaseDriver(java.lang.String input)
input - name of the driver e.g oracle.jdbc.driver.OracleDriver (sample)
refer to your jdbc driver documentation for exact driver namepublic java.lang.String getDatabaseDriver()
public void setJdbcUrl(java.lang.String input)
input - jdbc url
The standard syntax for JDBC URLs is shown below. It has three parts, which are
separated by colons:
jdbc:public java.lang.String getJdbcUrl()
public void setUser(java.lang.String input)
input - the user name to be used to logon to databasepublic java.lang.String getUser()
public void setPassword(java.lang.String input)
input - the password to be used to logon to databasepublic java.lang.String getPassword()
public java.lang.String getSelectSql()
public javax.swing.JTable getTable()
public void addUpdateSql(java.lang.String updateStatement,
java.lang.String columnPointer)
Since the select statemnt used for this table may use table
join or use a subquery, we may need to update more than one table, so more than one update
statements are needed. So you can add as many updateStatements as needed using this method
Lets say your selectSql is "select a.emp_no, a.emp_name, b.status from emp a, emp_status b
where a.emp_no = b.emp_no"
If the user changes the emp_name & status in a record, then we need to update 2 tables
update emp set emp_name =[new emp_name] where emp_no = [emp_no]
update emp_status set status=[new status] where emp_no=[emp_no]
To set this , you need to call this method as
addUpdateSql("update emp set emp_name =? where emp_no =?", "2,1");
addUpdateSql("update emp_status set status=? where emp_no=?, "3,1");
The second argument to this method is a column pointer which tells how the cell values
in the table should be substituted in the sql Statement. In the first Sql Statement we
wanted to substitute emp_name which is second column in the table to the first question mark
position in the sql & then the emp_no, which is first column in the table to the second question mark
position in the sql, so we gave the column pointer value as "2,1". Note the column numbers
should be seperated by "Comma"
if you specify more than one update statement then transaction will be commited only if
all the update statements go through fine
The order in which the statements will be executed will be the order in which you added
Note: For a given select sql, you can either use "preparedStatement or callable statement" or sql string, you cannot mix, meaning,
case 1:
addUpdateSql(preparedStatement1, arr)
addUpdateSql(preparedStatement2, arr2)
case 2:
addUpdateSql(preparedStatement1, arr)
addUpdateSql(callableStatement2, arr2)
case 3:
addUpdateSql(callableStatement1, arr)
addUpdateSql(callableStatement2, arr2) *
case 4:
addUpdateSql(preparedStatement1, arr)
addUpdateSql(sqlString, arr2)
case 5:
addUpdateSql(sqlString, arr2)
addUpdateSql(preparedStatement1, arr)
case 1 & 2 & 3 are valid, case 4 & 5 are invalid
If you change the selectSql of the quicktable to a entirely different query to which the update/insert/delete statements are not applicable,
don't forget to clear the existing update Sqls using clearAllUpdateSql()
updateStatement - The update statement to be added (this sql should be preparable)columnPointer - columnNumbers whose values should be set for this sql, the column numbers starts as 1,2,3
The column numbers should be seperated by comma
the column numbers should be of the same order of parameter you specify in sql.clearAllUpdateSql(),
addUpdateSql(PreparedStatement , String ),