quick.dbtable
Class DBTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byquick.dbtable.DBTable
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DBTable
extends javax.swing.JPanel
implements java.io.Serializable

DBTable is a complete JTable alternative Javabean. DBTable can be used as

DBTable is a JTable which can be bound to a database table or query which also provides the fexibility of JTable. Integrating with a database table can be done in 3 statements

  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.

Version:
1.0 05/05/99
Author:
Benjamin D. Franklin
See Also:
Serialized Form

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.
 int defaultClickCountToStartEditor
          number of mouse clicks needed to start the editor.
 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 listenKeyPressEventsWholeWindow
          Events like CTRL+F to open find window, HOME, END, PAGE DOWN etc are watched for the whole window where the dbTable is present.
 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)
          Deprecated. Developers are making mistakes in using this method,so use the safe method addColumn(String). If this method is already working fine for you then you can continue to use them.
 Column addColumn(java.lang.String headerText)
          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
 javax.swing.JPanel getControlPanel()
          returns the control panel, if one was ever created by calling createControlPanel() or setControlPanelVisible().
 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.
 void insertSilent(java.util.Vector insertElements, int row)
          Inserts the record at the given row 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 After setting the maximum row count, if you have to change back to the original behaviour of showing all availble records use setMaximumRowCount(java.lang.Integer.MAX_VALUE)
 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

debug

public boolean debug
To get the debug messages , set this variable to true. The default value is false.


showCriticalWarnings

public boolean showCriticalWarnings
QuickTable displays various critical warnings, which needs to be corrected by developers. If not corrected, quicktable will not work properly. Developers may want to hide these messages when the application is deployed to users. In these cases they can set this variable to false. This should NEVER be turned off during development. If have enabled debug using dbTable.debug=true;, then critical warnings will be still shown, even if you disable showCriticalWarnings. The default value of this property is true.


showFindReplaceMessages

public boolean showFindReplaceMessages
While doing find or replace, quicktable shows informative messages like text not found, search complete, 10 replacements etc. If you do not want these messages to be displayed set this property to false. The default value is true.


retainConnection

public 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. If you feel that you want to use the original connection and keep it alive always even when you want to switch non bound modes set this flag to true


ALL_NAVIGATION

public static final int ALL_NAVIGATION
navigation, insert, delete

See Also:
Constant Field Values

READ_INSERT_NAVIGATION

public static final int READ_INSERT_NAVIGATION
navigation, insert

See Also:
Constant Field Values

READ_DELETE_NAVIGATION

public static final int READ_DELETE_NAVIGATION
navigation, delete

See Also:
Constant Field Values

READ_NAVIGATION

public static final int READ_NAVIGATION
navigation only

See Also:
Constant Field Values

UPDATE_DATABASE_ON_ROW_EXIT

public static final 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

Since:
2.0.4
See Also:
Constant Field Values

UPDATE_DATABASE_ON_CELL_EXIT

public static final 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

Since:
2.0.4
See Also:
Constant Field Values

autoCommit

public boolean autoCommit
If you want to handle the commit/rollback yourself, instead of quicktable handling it for you, set autoCommit to false. The default value for this property is true, quicktable itself handles the commit/rollback. when you want to handle the commit yourself, you can use getConnection() method and get the connection and then using connection.setAutoCommit(false/true) handle the connection. For commit/rollback use connection.commit()/connection.rollback

Since:
2.0.4.3

copyColumnHeaderNames

public boolean copyColumnHeaderNames
While copying data from quickTable to clipboard, setting copyColumnHeaderNames will include column headers in the copied data. The default value is false

Since:
2.0.4.3

enableTextOverwriteOnCellEdit

public 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. This is an excel like behaviour. The default value for this property is false, the text will not be erased, the user will be inserting the text. If you are trying to enable this feature, set this to true, immediately after you instantiate a new DBTable().

Since:
2.0.4.28

listenKeyPressEventsWholeWindow

public boolean listenKeyPressEventsWholeWindow
Events like CTRL+F to open find window, HOME, END, PAGE DOWN etc are watched for the whole window where the dbTable is present. This way even if dbtable is not in focus the keys will still work. In some cases we may have more than one DBTable per window, in those cases listeneing for these events at window level would fire the events in wrong DBTable. If you want to prevent that problem, you can listen for these events only when DBtable is in focus, by setting this variable to false. But if you set this to false, the DBTable should be in focus for these events to work.

Since:
2.0.4.5

postponeDBInsert

public 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. But sometimes you still want quickTable to handle the db insert the next time. In this case if you set this property postponeDBInsert to true, then quicktable will postpone the insert until you return true for beforeInsert() for that record. The default value is false

Since:
2.0.4.3
See Also:
DatabaseChangeListener.beforeInsert(int)

defaultClickCountToStartEditor

public int defaultClickCountToStartEditor
number of mouse clicks needed to start the editor. This is the default initial settings.
 If you want to change this per column, then use dbTable.getColumn(i).getCellEditor().setClickCountToStart(j);

 If you want to modify the value of this variable, it should be done immediately after you instantiate DBTable.

 The default value is 1. when user clicks on a cell, if the cell is editable, cell editor will be immediately shown.
 You can change this to 2, if you want the editor to be shown only on double click.
 

Since:
2.0.5.28

doNotUseDatabaseSort

public 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

Since:
2.0.2

EQUAL

public static final int EQUAL
See Also:
Constant Field Values

GREATER

public static final int GREATER
See Also:
Constant Field Values

LESS

public static final int LESS
See Also:
Constant Field Values
Constructor Detail

DBTable

public DBTable()
Creates an empty table

Method Detail

createControlPanel

public void createControlPanel()
Creates the control panel all the navigation buttons


setControlPanelVisible

public void setControlPanelVisible(boolean visible)
show/hide the control panel


getControlPanel

public javax.swing.JPanel getControlPanel()
returns the control panel, if one was ever created by calling createControlPanel() or setControlPanelVisible(). This will be useful if you ever want add some more buttons, status bar etc to the control panel. Use at your own risk. If you remove any of the buttons which were originally added by QuickTable, it will create problems. This panel uses FlowLayout, use the method add(comp) to add your components to Controlpanel.

Since:
2.0.5.28

createControlPanel

public void createControlPanel(int type)
Creates the control panel based on the navigation types. The different types are
 ALL_NAVIGATION --  navigation, insert, delete
 READ_INSERT_NAVIGATION  -- navigation, insert
 READ_DELETE_NAVIGATION  -- navigation, delete
 READ_NAVIGATION  -- navigation

Since:
2.0.2

delete

public void delete()
Deletes currently selected rows


scrollToCell

public void scrollToCell(int row,
                         int column)
If this cell is currently not visible, the view will be scrolled to show the cell

Since:
2.0.5.21

goTo

public void goTo(int row)
Selects this row and makes sure this row is visible

Since:
2.0.2

first

public void first()
Selects the first row and makes sure first row is visible

Since:
2.0.2

last

public void last()
Selects the last row and makes sure last row is visible

Since:
2.0.2

previous

public void previous()
Selects the previous row with respect to the currently selected row and makes sure that row is visible

Since:
2.0.2

next

public void next()
Selects the next row with respect to the currently selected row and makes sure that row is visible

Since:
2.0.2

setSortEnabled

public void setSortEnabled(boolean val)
If you don't want quicktable to do its default sort,when the user clicks on column header, pass false


delete

public void delete(int[] rows)
            throws java.lang.Exception
Deletes the rows.

Parameters:
rows - array of rownumbers , the row numbers start from 0,1,2..
Throws:
java.lang.Exception

insert

public void insert(java.util.Vector insertElements)
Inserts the records into the Jtable.
 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);
 
If the table is not in editable mode, insert will not work. use setEditable() to change settings

Parameters:
insertElements - a vector whose elements are the cell values and the elements should be in the same order of columns

insert

public void insert(java.util.Vector insertElements,
                   int row)
Inserts the record at the given row into the Jtable.
 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);
 

Parameters:
insertElements - a vector whose elements are the cell values and the elements should be in the same order of columns
row - The row where this record should be inserted. Valid values for row would be 0 to rowcount-1
Since:
2.0.4

insertSilent

public void insertSilent(java.util.Vector insertElements,
                         int row)
Inserts the record at the given row into the Jtable. While using silent mode, the selection is not changed to the newly inserted row and the row will NOT be made visible by scrolling to that row. The rows added using this method will never be inserted into database(if you use database). This method is mainly to add records to the table in the background rather than a user initiated record insertion. 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);

Parameters:
insertElements - a vector whose elements are the cell values and the elements should be in the same order of columns
row - The row where this record should be inserted. Valid values for row would be 0 to rowcount-1
Since:
2.0.5.26

insertEmptyRecord

public void insertEmptyRecord()
Inserts an empty records into the Jtable. This can be used when the user tried to add a new record
 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

 


setDatabaseDriver

public void setDatabaseDriver(java.lang.String input)
Sets the database driver

Parameters:
input - name of the driver e.g oracle.jdbc.driver.OracleDriver (sample) refer to your jdbc driver documentation for exact driver name

getDatabaseDriver

public java.lang.String getDatabaseDriver()
gets the database driver


setJdbcUrl

public void setJdbcUrl(java.lang.String input)
Sets the jdbc url

Parameters:
input - jdbc url The standard syntax for JDBC URLs is shown below. It has three parts, which are separated by colons: jdbc:: jdbc-the protocol. The protocol in a JDBC URL is always jdbc. -the name of the driver or the name of a database connectivity mechanism, which may be supported by one or more drivers. A prominent example of a subprotocol name is "odbc", which has been reserved for URLs that specify ODBC-style data source names. For example, to access a database through a JDBC-ODBC bridge, one might use a URL such as the following: jdbc:odbc:fred In this example, the subprotocol is "odbc", and the subname "fred" is a local ODBC data source. If one wants to use a network name service (so that the database name in the JDBC URL does not have to be its actual name), the naming service can be the subprotocol. So, for example, one might have a URL like: jdbc:dcenaming:accounts-payable In this example, the URL specifies that the local DCE naming service should resolve the database name "accounts-payable" into a more specific name that can be used to connect to the real database. -a way to identify the database. The subname can vary, depending on the subprotocol, and it can have a subsubname with any internal syntax the driver writer chooses. The point of a subname is to give enough information to locate the database. In the previous example, "fred" is enough because ODBC provides the remainder of the information. A database on a remote server requires more information, however. If the database is to be accessed over the Internet, for example, the network address should be included in the JDBC URL as part of the subname and should follow the standard URL naming convention of //hostname:port/subsubname Supposing that "dbnet" is a protocol for connecting to a host on the Internet, a JDBC URL might look like this: jdbc:dbnet://wombat:356/fred

getJdbcUrl

public java.lang.String getJdbcUrl()
gets the JdbcUrl used


setUser

public void setUser(java.lang.String input)
Sets the user

Parameters:
input - the user name to be used to logon to database

getUser

public java.lang.String getUser()
gets the user name


setPassword

public void setPassword(java.lang.String input)
Sets the password

Parameters:
input - the password to be used to logon to database

getPassword

public java.lang.String getPassword()
gets the password


getSelectSql

public java.lang.String getSelectSql()
gets the select statement which is used to fetch data to be displayed in the table


getTable

public javax.swing.JTable getTable()
gets the JTable used by this DBTable You should use the returned JTable cautiously


addUpdateSql

public 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.
 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()

 

Parameters:
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.
See Also:
clearAllUpdateSql(), addUpdateSql(PreparedStatement , String ), addUpdateSql(CallableStatement , String )

addUpdateSql

public 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.
 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()

 primaryColumns
   Sometimes the jdbc drives don't exactly give information about which columns are primary columns.
 primaryColumns information is necessary when users are allowed to modify primary columns values.

 In the above example emp_no is the primary key and emp_no is the first column, so primaryColumns will be new  int[]{1}
 If first two columns are primary columns, then  new int[]{1,2}

 

Parameters:
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.
primaryColumns - array of primary column numbers
See Also:
clearAllUpdateSql(), addUpdateSql(PreparedStatement , String ), addUpdateSql(CallableStatement , String )

addUpdateSql

public 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.
 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(yourDBConnection.prepareStatement("update emp set emp_name =? where emp_no =?"), "2,1");
  addUpdateSql(yourDBConnection.prepareStatement("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 for the input parameters

 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()

 primaryColumns
   Sometimes the jdbc drives don't exactly give information about which columns are primary columns.
 primaryColumns information is necessary when users are allowed to modify primary columns values.

 In the above example emp_no is the primary key and emp_no is the first column, so primaryColumns will be new  int[]{1}
 If first two columns are primary columns, then  new int[]{1,2}

 

Parameters:
updateStatement - The update preparedstatement to be added
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.
primaryColumns - array of primary column numbers
See Also:
clearAllUpdateSql(), addUpdateSql(String , String ), addUpdateSql(CallableStatement , String )

addUpdateSql

public 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.
 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(yourDBConnection.prepareStatement("update emp set emp_name =? where emp_no =?"), "2,1");
  addUpdateSql(yourDBConnection.prepareStatement("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 for the input parameters

 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()
 

Parameters:
updateStatement - The update preparedstatement to be added
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.
See Also:
clearAllUpdateSql(), addUpdateSql(String , String ), addUpdateSql(CallableStatement , String )

addUpdateSql

public 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.
 Example
  addUpdateSql(yourDBConnection.prepareCall("updateEmployeeInfo(?,?)"), "2,1");
  addUpdateSql(yourDBConnection.prepareCall("updateEmployeeStatus(?,?)"), "3,1");

  The second argument to this method is a column pointer which tells how the cell values
 in the table should be substituted for the input parameters

 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()
 

Parameters:
updateStatement - The update callable statement to be added
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.
See Also:
clearAllUpdateSql(), addUpdateSql(String , String ), addUpdateSql(PreparedStatement , String )

addUpdateSql

public 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.
 Example
  addUpdateSql(yourDBConnection.prepareCall("updateEmployeeInfo(?,?)"), "2,1");
  addUpdateSql(yourDBConnection.prepareCall("updateEmployeeStatus(?,?)"), "3,1");

  The second argument to this method is a column pointer which tells how the cell values
 in the table should be substituted for the input parameters

 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()

 primaryColumns
   Sometimes the jdbc drives don't exactly give information about which columns are primary columns.
 primaryColumns information is necessary when users are allowed to modify primary columns values.

 In the above example emp_no is the primary key and emp_no is the first column, so primaryColumns will be new  int[]{1}
 If first two columns are primary columns, then  new int[]{1,2}

 

Parameters:
updateStatement - The update callable statement to be added
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.
primaryColumns - array of primary column numbers
See Also:
clearAllUpdateSql(), addUpdateSql(String , String ), addUpdateSql(PreparedStatement , String )

addDeleteSql

public void addDeleteSql(java.lang.String deleteStatement,
                         java.lang.String columnPointer)
Sets the delete statement which is used delete the record from the table.
 Since the select statemnt used for this table may use table join or use a
 subquery, we may need to delete records in more than one table, so more
 than one delete 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 deletes a displayed record, then we need to delete records in
 2 tables

  delete from emp where emp_no = [emp_no]
  delete from emp_status where emp_no = [emp_no]

 To set this , you need to call this method as
  addDeleteSql("delete from emp where emp_no = ?", "1");
  addDeleteSql("delete from emp_status where emp_no = ?", "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 the emp_no, which is
 first column in the table to the first question mark position in the sql
 so we gave the column pointer value as "1". if there is more than one column
 we need to seperate with "Comma" , example "1,3,4".

 if you specify more than one delete statement then transaction will be
 commited only if all the delete 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:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(preparedStatement2, arr2)
       case 2:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(callableStatement2, arr2)
       case 3:
       addDeleteSql(callableStatement1, arr)
       addDeleteSql(callableStatement2, arr2)   *
       case 4:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(sqlString, arr2)
       case 5:
       addDeleteSql(sqlString, arr2)
       addDeleteSql(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 clearAllDeleteSql()

 

Parameters:
deleteStatement - The delete 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.
See Also:
clearAllDeleteSql(), addDeleteSql(CallableStatement , String ), addDeleteSql(PreparedStatement , String )

addDeleteSql

public void addDeleteSql(java.sql.PreparedStatement deleteStatement,
                         java.lang.String columnPointer)
Sets the delete prepared statement which is used delete the record from the table.
 Since the select statemnt used for this table may use table join or use a
 subquery, we may need to delete records in more than one table, so more
 than one delete 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 deletes a displayed record, then we need to delete records in
 2 tables

  delete from emp where emp_no = [emp_no]
  delete from emp_status where emp_no = [emp_no]

 To set this , you need to call this method as
  addDeleteSql(yourDBConnection.prepareStatement("delete from emp where emp_no = ?"), "1");
  addDeleteSql(yourDBConnection.prepareStatement("delete from emp_status where emp_no = ?"), "1");

  The second argument to this method is a column pointer which tells how the cell values
 in the table should be substituted for the input parameters

 if you specify more than one delete statement then transaction will be
 commited only if all the delete 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:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(preparedStatement2, arr2)
       case 2:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(callableStatement2, arr2)
       case 3:
       addDeleteSql(callableStatement1, arr)
       addDeleteSql(callableStatement2, arr2)   *
       case 4:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(sqlString, arr2)
       case 5:
       addDeleteSql(sqlString, arr2)
       addDeleteSql(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 clearAllDeleteSql()

 

Parameters:
deleteStatement - The delete preparedstatement to be added
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.
See Also:
clearAllDeleteSql(), addDeleteSql(CallableStatement , String ), addDeleteSql(String , String )

addDeleteSql

public void addDeleteSql(java.sql.CallableStatement deleteStatement,
                         java.lang.String columnPointer)
Sets the delete callable statement which is used delete the record from the table.
 Example
  addDeleteSql(yourDBConnection.prepareCall("deleteEmployeeInfo(?)"), "1");
  addDeleteSql(yourDBConnection.prepareCall("deleteEmployeeStatus(?)"), "1");

  The second argument to this method is a column pointer which tells how the cell values
 in the table should be substituted for the input parameters

 if you specify more than one delete statement then transaction will be
 commited only if all the delete 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:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(preparedStatement2, arr2)
       case 2:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(callableStatement2, arr2)
       case 3:
       addDeleteSql(callableStatement1, arr)
       addDeleteSql(callableStatement2, arr2)   *
       case 4:
       addDeleteSql(preparedStatement1, arr)
       addDeleteSql(sqlString, arr2)
       case 5:
       addDeleteSql(sqlString, arr2)
       addDeleteSql(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 clearAllDeleteSql()

 

Parameters:
deleteStatement - The delete callable statement to be added
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.
See Also:
clearAllDeleteSql(), addDeleteSql(PreparedStatement , String ), addDeleteSql(String , String )

addInsertSql

public void addInsertSql(java.lang.String insertStatement,
                         java.lang.String columnPointer)
Sets the insert statement which is used to insert a record into table.
 Since the select statemnt used for this table may use table
 join or use a subquery, we may need to insert record into more than one table, so more than one insert
 statementa are needed. You can add any number of insert statements 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 inserts a record , the following statments need to be executed

  insert into emp (emp_no, emp_name) values ([emp_no], [emp_name]);
  insert into emp_status (emp_no, emp_status) values ([emp_no], [emp_status]);

 To set this , you need to call this method as
  addInsertSql("insert into emp (emp_no, emp_name) values (?,?)", "1,2");
  addInsertSql("insert into emp_status (emp_no, emp_status) values (?, ?)", "1,3");

  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 the emp_no, which is first column in the table to the first question mark
 position in the sql and then emp_name which is second column in the table to the second question mark
 position in the sql , so we gave the column pointer value as "1,2". Note the column numbers
 should be seperated by "Comma"

 if you specify more than one insert statement then transaction will be commited only if
 all the insert 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:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(preparedStatement2, arr2)
       case 2:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(callableStatement2, arr2)
       case 3:
       addInsertSql(callableStatement1, arr)
       addInsertSql(callableStatement2, arr2)   *
       case 4:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(sqlString, arr2)
       case 5:
       addInsertSql(sqlString, arr2)
       addInsertSql(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 clearAllInsertSql()

 

Parameters:
insertStatement - The insert 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.
See Also:
clearAllInsertSql()

addInsertSql

public void addInsertSql(java.sql.PreparedStatement insertStatement,
                         java.lang.String columnPointer)
Sets the insert prepared statement which is used to insert a record into table.
 Since the select statemnt used for this table may use table
 join or use a subquery, we may need to insert record into more than one table, so more than one insert
 statementa are needed. You can add any number of insert statements 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 inserts a record , the following statments need to be executed

  insert into emp (emp_no, emp_name) values ([emp_no], [emp_name]);
  insert into emp_status (emp_no, emp_status) values ([emp_no], [emp_status]);

 To set this , you need to call this method as
  addInsertSql(yourDBConnection.prepareStatement("insert into emp (emp_no, emp_name) values (?,?)"), "1,2");
  addInsertSql(yourDBConnection.prepareStatement("insert into emp_status (emp_no, emp_status) values (?, ?)")fs, "1,3");

  The second argument to this method is a column pointer which tells how the cell values
 in the table should be substituted for the input parameters

 if you specify more than one insert statement then transaction will be commited only if
 all the insert 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:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(preparedStatement2, arr2)
       case 2:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(callableStatement2, arr2)
       case 3:
       addInsertSql(callableStatement1, arr)
       addInsertSql(callableStatement2, arr2)   *
       case 4:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(sqlString, arr2)
       case 5:
       addInsertSql(sqlString, arr2)
       addInsertSql(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 clearAllInsertSql()

 

Parameters:
insertStatement - The insert prepared statement to be added
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.
See Also:
clearAllInsertSql(), addInsertSql(CallableStatement , String ), addInsertSql(String , String )

addInsertSql

public void addInsertSql(java.sql.CallableStatement insertStatement,
                         java.lang.String columnPointer)
Sets the insert callable statement which is used to insert a record into table.
 Example
  addInsertSql(yourDBConnection.prepareCall("insertEmployeeInfo(?,?)"), "1,2");
  addInsertSql(yourDBConnection.prepareCall("insertEmployeeStatus(?, ?)"), "1,3");

  The second argument to this method is a column pointer which tells how the cell values
 in the table should be substituted for the input parameters

 if you specify more than one insert statement then transaction will be commited only if
 all the insert 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:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(preparedStatement2, arr2)
       case 2:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(callableStatement2, arr2)
       case 3:
       addInsertSql(callableStatement1, arr)
       addInsertSql(callableStatement2, arr2)   *
       case 4:
       addInsertSql(preparedStatement1, arr)
       addInsertSql(sqlString, arr2)
       case 5:
       addInsertSql(sqlString, arr2)
       addInsertSql(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 clearAllInsertSql()

 

Parameters:
insertStatement - The insert prepared statement to be added
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.
See Also:
clearAllInsertSql(), addInsertSql(PreparedStatement , String ), addInsertSql(String , String )

getConnection

public java.sql.Connection getConnection()
Returns the database Connection object used by the table


setConnection

public void setConnection(java.sql.Connection newConnection)
Sets the database Connection object to be used by this table

Parameters:
newConnection -

connectDatabase

public void connectDatabase()
                     throws java.sql.SQLException,
                            java.lang.ClassNotFoundException
Makes the database connection You need to provide the database driver, jdbcurl, user, pass before calling this method

Throws:
java.sql.SQLException
java.lang.ClassNotFoundException

connectDatabase

public void connectDatabase(java.lang.String dbDriver,
                            java.lang.String jdbcUrl,
                            java.lang.String user,
                            java.lang.String password)
                     throws java.sql.SQLException,
                            java.lang.ClassNotFoundException
Makes the database connection, using the specified parameters

Throws:
java.sql.SQLException
java.lang.ClassNotFoundException

getColumn

public Column getColumn(int colIndex)
Returns the column object for the specified index. colIndex starts from 0,1,2,3...
  If the user has moved columns then this method will return the new columns.
  If you want to get the columns as you created ( without user rearranging changes)
  then use the getOriginalColumn() method

  If the column is not available then you will get a RuntimeException  Column x is not available .
  This can happen if you call this method prematurely. when using database either refresh(..) or createColunModelFromQuery()
  should be called before calling getColumn() method. In other modes, one of the refresh methods should be called before
  calling getColumn()
  

Parameters:
colIndex -
See Also:
getColumnAsCreated(int)

getColumnAsCreated

public Column getColumnAsCreated(int colIndex)
Returns the column object for the specified index, as it was created. Even if the user moves the column, you will get the column by the index you have created. The other method, getColumn() returns the column based on the current column location.
  If you want to access the column with index as it is seen now use getColumn() method
 
colIndex starts from 0,1,2,3...

Parameters:
colIndex -
Since:
2.0.4

getOriginalColumnIndex

public 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...

Parameters:
colIndex -
Returns:
the column index. The returned index starts from 0,1,2..
Since:
2.0.4

getCurrentIndexForOriginalColumn

public 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...

Parameters:
colIndex -
Returns:
the column index. The returned index starts from 0,1,2..
Since:
2.0.4

addColumn

public void addColumn(Column aColumn)
Deprecated. Developers are making mistakes in using this method,so use the safe method addColumn(String). If this method is already working fine for you then you can continue to use them.

add a column to table.
Make sure to assign the column index of the new column as dBTable1.getColumnCount()+1 Also, don't forget to set the preferred width, otherwise the column will not be visible. Use the following example

    Column c = new Column(dBTable1.getColumnCount()+1);
    c.setHeaderValue("Order\nNo.");
    c.setLength(25);
    c.setPreferredWidth(100);
    dBTable1.addColumn(c);
 
Restriction: addColumn() method cannot be called before calling any refresh(...) type methods or createColumnModelFromQuery() method

Parameters:
aColumn -
See Also:
addColumn(String)

addColumn

public Column addColumn(java.lang.String headerText)
add a column to table.
Restriction: addColumn() method cannot be called before calling any refresh(...) type methods or createColumnModelFromQuery() method

Parameters:
headerText -

removeColumn

public void removeColumn(Column aColumn)

removeAllRows

public void removeAllRows()
Clears all data which is currently shown in the table. Preserves the columns, so the old columns will be still displayed. If you are using database mode, the data will not be deleted from database. beforeDelete(), afterDelete() methods will not be fired.

Since:
2.0.5.25

setSelectSql

public 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
  Example for executing stored procedure
  dBTable1.setSelectSql("get_Company_Info IBM, 2");

 Note:
 whenever the select sql of the dbtable is changed by calling this method, the next time when you call refresh() to fecth data, the column properties will be reset based on database column properties.
 e.g
 case 1:
 setSelectsql("select * from Orders");
 refresh(); // column properties are assigned based on the database column properties for orders
 setSelectsql("select * from products");
 refresh(); // column properties for orders are lost & new column properties are assigned based on the database column properties for products

 case 2:
 setSelectsql("select * from Orders where dept=123");
 refresh(); // column properties are assigned based on the database column properties for orders
 setSelectsql("select * from Orders where amount>5000");
 refresh(); // column properties for orders are lost & new column properties are assigned based on the database column properties for orders

 In case 2 we don't need to recreate the column properties second time, since they have the same column properties, use the following


 setSelectsql("select * from Orders where dept=123");
 refresh(); // column properties are assigned based on the database column properties for orders
 setSelectsql("select * from Orders where amount>5000");
 useOldColumnProperties(true);
 refresh(); // column properties for orders will be used again
 

Parameters:
input - the select sql / stored procedure
See Also:
useOldColumnProperties( boolean)

setRowCountSql

public void setRowCountSql(java.lang.String rowCountSql)
Sets the sql which is used to calculate the total rows available for the current select sql
  Usually rowcount sqls are automatically created, but when you use stored procedure or complex sql
  we cannot automatically create rowCountSql. In those cases you can set the rowCountSql

  Example
  setSelectsql("select * from Orders where dept=123");
  dBTable1.setRowCountSql("select count(*) from Orders where dept=123");
  dBTable1.refresh();

   Note: If you have assigned rowCountSql currently and for the next selectsql,
   if you want quicktable to automatically create rowCountsql then set setRowCountSql(null)
   before calling refresh(), otherwise old rowCountSql will be used.
 

Parameters:
rowCountSql - the row count sql / stored procedure

useOldColumnProperties

public 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
 Note:
 The following cases compare the difference between this method and the other setSelectSql method
 e.g
 case 1:
 setSelectsql("select * from Orders");
 refresh(); // column properties are assigned based on the database column properties for orders
 setSelectsql("select * from products");
 refresh(); // column properties for orders are lost & new column properties are assigned based on the database column properties for products

 case 2:
 setSelectsql("select * from Orders where dept=123");
 refresh(); // column properties are assigned based on the database column properties for orders
 setSelectsql("select * from Orders where amount>5000");
 refresh(); // column properties for orders are lost & new column properties are assigned based on the database column properties for orders

 In case 2 we don't need to recreate the column properties second time, since they have the same column properties, use the following

 setSelectsql("select * from Orders where dept=123");
 refresh(); // column properties are assigned based on the database column properties for orders
 setSelectsql("select * from Orders where amount>5000" );
 useOldColumnProperties(true);
 refresh(); // column properties for orders will be used again
 

Parameters:
val - true - uses the old column model, false - recreates the column model
Since:
2.0.2
See Also:
setSelectSql( String)

refresh

public void refresh()
             throws java.sql.SQLException
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

Throws:
java.sql.SQLException

refresh

public void refresh(java.sql.ResultSet rs)
             throws java.sql.SQLException
Loads the data from the resultset

Parameters:
rs - The resultset that need to be loaded
Throws:
java.sql.SQLException
Since:
2.0.2

refresh

public void refresh(java.util.Vector input)
             throws java.lang.Exception
loads a two dimensional vector of objects into quicktable
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - Vector of vectors which coontain the data
Throws:
java.lang.Exception
Since:
2.0.2

refreshDataObject

public void refreshDataObject(java.util.Enumeration input,
                              java.lang.String[] methodNames)
                       throws java.lang.Exception
loads a enumeration of Data objects into quicktable
 Important: The Data objects should be public class, not a default/protected class
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original Object

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - Enumeration which contains the data objects
methodNames - array of methodnames which should be used.
e.g if methods are getName(), getId(), then methodName = {"getName","getId"}
            if null is passed, then all the public methods which has no input parameters & which has a return type will be used
         
Throws:
java.lang.Exception
Since:
2.0.2

refreshDataObject

public void refreshDataObject(java.util.Vector input,
                              java.lang.String[] methodNames)
                       throws java.lang.Exception
loads a Vector of Data objects into quicktable
 Important: The Data objects should be public class, not a default/protected class
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original Object

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - Vector which contains the data objects
methodNames - array of methodnames which should be used.
e.g if methods are getName(), getId(), then methodName = {"getName","getId"}
            if null is passed, then all the public methods which has no input parameters & which has a return type will be used
        
Throws:
java.lang.Exception
Since:
2.0.2

refreshDataObject

public void refreshDataObject(java.util.Collection input,
                              java.lang.String[] methodNames)
                       throws java.lang.Exception
loads a Collection of Data objects into quicktable
 Important: The Data objects should be public class, not a default/protected class
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original Object
       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - Collection which contains the data objects
methodNames - array of methodnames which should be used.
e.g if methods are getName(), getId(), then methodName = {"getName","getId"}
            if null is passed, then all the public methods which has no input parameters & which has a return type will be used
        
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.lang.Object[][] input)
             throws java.lang.Exception
loads a two dimensional array of objects into quicktable
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - two dimensional array
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.net.URL url,
                    java.util.Properties prop)
             throws java.lang.Exception
loads a delimited file, found in the url into quicktable

  PLease set the correct proxy settings if you are within firewall
  HTTP:
  System.setProperty("http.proxyHost", proxyUrl);
  System.setProperty("http.proxyPort", proxyPort);

  HTTPS:
  System.setProperty("https.proxyHost", proxyUrl);
  System.setProperty("https.proxyPort", proxyPort);

  For using https url ,
    1) you need to have the "JavaTM Secure Socket Extension" in classpath
        This package comes with JDK 1.4. For all the older versions of JDK
        download the package from  http://java.sun.com/products/jsse/
    2) set the provider & security as below
  System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
  Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
url - the url which refers to the delimited file which you want to load
prop - Properties for the data. Supported properties are delimiter, isfixedLengthColumns, firstRowHasColumnNames, columnLengthArray
delimiter - the delimiter character of the data e.g "," "|"
        isfixedLengthColumns - if the column data has fixed lengths. Possible value would be a not null object example "true"
             One of delimiter or isFixedLengthColumns should be present
        firstRowHasColumnNames (optional) - if the first row in the data has column names. Possible value would be a not null object example "true"
        columnLengthArray (required if isFixedLengthColumns is not null)- Array of Column lengths , if this data is fixed length column. e.g  int[] arr = {25,100,10};
        username (optional). if the url is protected by basic authentication, provide the username
        password (optional). if the url is protected by basic authentication, provide the password
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.net.URL url,
                    java.lang.String delimiter)
             throws java.lang.Exception
loads a delimited file, found in the url into quicktable

  PLease set the correct proxy settings if you are within firewall
  HTTP:
  System.setProperty("http.proxyHost", proxyUrl);
  System.setProperty("http.proxyPort", proxyPort);

  HTTPS:
  System.setProperty("https.proxyHost", proxyUrl);
  System.setProperty("https.proxyPort", proxyPort);

  For using https url ,
    1) you need to have the "JavaTM Secure Socket Extension" in classpath
        This package comes with JDK 1.4. For all the older versions of JDK
        download the package from  http://java.sun.com/products/jsse/
    2) set the provider & security as below
  System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
  Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
url - the url which refers to the delimited file which you want to load
delimiter - - the delimiter character of the data e.g "," "|"
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.io.File f,
                    java.util.Properties prop)
             throws java.lang.Exception
loads a data file into quicktable
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
f - File handle of the delimited file
prop - Properties for the data. Supported properties are delimiter, isfixedLengthColumns, firstRowHasColumnNames, columnLengthArray
delimiter - the delimiter character of the data e.g "," "|"
        isfixedLengthColumns - if the column data has fixed lengths. Possible value would be a not null object example "true"
             One of delimiter or isFixedLengthColumns should be present
        firstRowHasColumnNames (optional) - if the first row in the data has column names. Possible value would be a not null object example "true"
        columnLengthArray (required if isFixedLengthColumns is not null)- Array of Column lengths , if this data is fixed length column. e.g  int[] arr = {25,100,10};
        
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.io.File f,
                    java.lang.String delimiter)
             throws java.lang.Exception
loads a delimited data file into quicktable
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
f - File handle of the delimited file
delimiter - - the delimiter character of the data e.g "," "|"
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.io.InputStream input,
                    java.util.Properties prop)
             throws java.lang.Exception
loads a inputstream which contains data to be loaded
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - Inputstream which has the delimited data
prop - Properties for the data. Supported properties are delimiter, isfixedLengthColumns, firstRowHasColumnNames, columnLengthArray
delimiter - the delimiter character of the data e.g "," "|"
        isfixedLengthColumns - if the column data has fixed lengths. Possible value would be a not null object example "true"
             One of delimiter or isFixedLengthColumns should be present
        firstRowHasColumnNames (optional) - if the first row in the data has column names. Possible value would be a not null object example "true"
        columnLengthArray (required if isFixedLengthColumns is not null)- Array of Column lengths , if this data is fixed length column. e.g  int[] arr = {25,100,10};
        
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.io.InputStream input,
                    java.lang.String delimiter)
             throws java.lang.Exception
loads a inputstream which contains delimited data
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - Inputstream which has the delimited data
delimiter - - the delimiter character of the data e.g "," "|"
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.io.BufferedReader in,
                    java.util.Properties prop)
             throws java.lang.Exception
loads a BufferedReader which contains delimited data
 Note: After loading this data into QuickTable, the changes made by editing the cells will not
       be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
in - BufferedReader which has the delimited data
prop - Properties for the data. Supported properties are delimiter, isfixedLengthColumns, firstRowHasColumnNames, columnLengthArray
delimiter - the delimiter character of the data e.g "," "|"
        isfixedLengthColumns - if the column data has fixed lengths. Possible value would be a not null object example "true"
             One of delimiter or isFixedLengthColumns should be present
        firstRowHasColumnNames (optional) - if the first row in the data has column names. Possible value would be a not null object example "true"
        columnLengthArray (required if isFixedLengthColumns is not null)- Array of Column lengths , if this data is fixed length column. e.g  int[] arr = {25,100,10};
Throws:
java.lang.Exception
Since:
2.0.2

refresh

public void refresh(java.io.BufferedReader input,
                    java.lang.String delimiter)
             throws java.lang.Exception
loads a BufferedReader which contains delimited data
 Note: After loading this data into QuickTable, the changes made by editing the cells will not be saved to the original source

       when you use this refresh() method quicktable behaves as non database mode. So if you set any
       insert/update/delete statements or any database specific properties, they will not be executed
 

Parameters:
input - BufferedReader which has the delimited data
delimiter - - the delimiter character of the data e.g "," "|"
Throws:
java.lang.Exception
Since:
2.0.2

isInsertingRow

public 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.

Since:
2.0.5.24

getDataArray

public java.lang.Object[][] getDataArray()
Returns the quicktable data in a array

Since:
2.0.2

getDataVector

public java.util.Vector getDataVector()
Returns the quicktable data in a Vector of Vector

Since:
2.0.2

refreshSkin

public 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

See Also:
setSkin(Skin)

addTableCellListener

public void addTableCellListener(DBTableCellListener tc)
This listener need to be added if you want to do cell data validation. When a user changes the data in a cell you will have an option to accept that change or reject it.

See Also:
DBTableCellListener

removeTableCellListener

public void removeTableCellListener(DBTableCellListener tc)

addDatabaseChangeListener

public void addDatabaseChangeListener(DatabaseChangeListener tc)
If you want to confirm the database insert/update/delete then add this listener. Using the DatabaseChangeListener you will have an option to cancel the database operation. Also if you want to display any confirmation message to user, after the database operation happend, you can use DatabaseChangeListener

See Also:
DatabaseChangeListener

removeDatabaseChangeListener

public void removeDatabaseChangeListener(DatabaseChangeListener tc)

addDBTableErrorListener

public void addDBTableErrorListener(DBTableErrorListener yourListener)
If you want to handle the exceptions or errrors occured add this Listener. Whenever an error occurs, it is first informed to the program and if the program didn't handle it, then DBTable itself handles that.

Parameters:
yourListener -
See Also:
DBTableErrorListener

removeDBTableErrorListener

public void removeDBTableErrorListener(DBTableErrorListener yourListener)

addDBTableEventListener

public void addDBTableEventListener(DBTableEventListener yourListener)
Listen for various DBTable events

Parameters:
yourListener -
See Also:
DBTableEventListener

removeDBTableEventListener

public void removeDBTableEventListener(DBTableEventListener yourListener)

createColumnModelFromQuery

public void createColumnModelFromQuery()
                                throws java.sql.SQLException
Creates the columnModel from the query, this uses ResultSetMetadata class to get the column properties. So it is the accuracy of the driver to provide column properties. It is not better to fully believe this function, since driver implemetations varies. This call should be made only after establishing a database connection, means setConnection() or connectDatabase() should be called before calling this method. You should have set the selectSql before calling this method. If you are trying to load data from your own resultset, you cannot call this method.

Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Closes all the database resources

Throws:
java.sql.SQLException

update

public void update(int row,
                   int col,
                   java.lang.Object value)
            throws java.lang.Exception
updates the cell with the new value this update is also done in the database

Throws:
java.lang.Exception

save

public void save()
Usually changes are saved automatically when the selection of row changes This method saves any pending insert or updates


enableExcelCopyPaste

public 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.


setCellPropertiesModel

public void setCellPropertiesModel(CellPropertiesModel cellModel)
Sets the cellPropertiesModel for the table.
 Color, Font, alignment of each cell in the table can be controlled using this.
 For complete information about using cell properties model refer to CellPropertiesModel class documentation
 

Parameters:
cellModel - The cell properties model that needs to be set for this table
See Also:
CellPropertiesModel

getCellPropertiesModel

public CellPropertiesModel getCellPropertiesModel()
gets the cellPropertiesModel of the table

See Also:
setCellPropertiesModel(CellPropertiesModel)

find

public 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
 This doesn't show any Find window where user can enter the text to be searched.
 you have to create your own window
 Otherwise you can use the Quicktable's find window. To show a quicktable's
 find Window use the method doFind()

 The main difference between this and the other find method is, this method cannot
 search in specific rows, other find method can search in specific set of rows

  Example
  to start searching from first row, and for searching 2nd and 4th columns only and starting
  the search from 4th column and searching the "quick" text backwards

  Vector columnVector = new Vector();
  columnVector.addElement(new Integer(2));
  columnVector.addElement(new Integer(4));
  yourquicktable.find( 0, 2, "quick", columnVector, false);

 If you want to search only in specific set of rows use the other find method

Parameters:
r - the starting row from which the search should be started. Row starts from 0,1,2..
searchCol - Vector of columns to be searched. example, if searching only 1st & 4th column, colVector.addElement(new Integer(1)); colVector.addElement(new Integer(4)); Important column starts from 1,2,3..
colIndex - the starting column within the searchCol vector, example if you want to start the searching from 3rd column, pass 2 because 4th column is the second index in colVector. Important the value for this argument cannot be greater than colVector size
findString1 - the text that needs to be searched
next - This determines the search direction, if this is true it searches forward, else backward
Returns:
returns the point where it found a match, the point contains (found row, found colIndex), this can be useful to do the next search
See Also:
, doFind(), find(int, int,String ,Vector, boolean , int[])

find

public 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
 This doesn't show any Find window where user can enter the text to be searched.
 you have to create your own window
 Otherwise you can use the Quicktable's find window. To show a quicktable's find
 Window use the method doFind()

 The main difference between this and the other find method is, this method
 can search in specific set of rows whereas the other method can only do a general
 search

  Example
  Lets say user has selected a set of rows and you want to search within that rows only
  to start searching from first selected row, and for searching 2nd and 4th columns
  only and starting the search from 4th column
   and searching the "quick" text backwards

  Vector columnVector = new Vector();
  columnVector.addElement(new Integer(2));
  columnVector.addElement(new Integer(4));
  yourquicktable.find( yourQuickTable.getTable().getSelectedRow(), 2, "quick", columnVector, false, yourQuickTable.getTable().getSelectedRows());
 

Parameters:
r - the starting row from which the search should be started. Row starts from 0,1,2..
searchCol - Vector of columns to be searched. example, if searching only 1st & 4th column, colVector.addElement(new Integer(1)); colVector.addElement(new Integer(4)); Important column starts from 1,2,3..
colIndex - the starting column within the searchCol vector, example if you want to start the searching from 3rd column, pass 2 because 4th column is the second index in colVector. Important the value for this argument cannot be greater than colVector size
findString1 - the text that needs to be searched
next - This determines the search direction, if this is true it searches forward, else backward
row - int array of rows in which search should be done
Returns:
returns the point where it found a match, the point contains (found row, found colIndex), this can be useful to do the next search
See Also:
doFind(), find(int, int,String ,Vector, boolean)

replace

public 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
 This doesn't show any Find & Replace window where user can enter the text to be searched.
 you have to create your own window
 Otherwise you can use the Quicktable's find & replace window. To show a quicktable's
 find & replace Window use the method doFindAndReplace()

 The main difference between this and the other replace method is, this method cannot
 search in specific rows, other replace method can search in specific set of rows

  Example
  to start searching from first row, and for searching 2nd and 4th columns only and
  starting the search from 4th column
   and searching the "quick" text forwards  and replacing the occurence with "table"

  Vector columnVector = new Vector();
  columnVector.addElement(new Integer(2));
  columnVector.addElement(new Integer(4));
  yourquicktable.replace( 0, 2, "quick", "table", columnVector, true);

 Note : replace will replace only editable columns
 

Parameters:
r - the starting row from which the search should be started. Row starts from 0,1,2..
searchCol - Vector of columns to be searched. example, if searching only 1st & 4th column, colVector.addElement(new Integer(1)); colVector.addElement(new Integer(4)); Important column starts from 1,2,3..
colIndex - the starting column within the searchCol vector, example if you want to start the searching from 3rd column, pass 2 because 4th column is the second index in colVector. Important the value for this argument cannot be greater than colVector size
findString1 - the text that needs to be searched
replaceString - the text that needs to be replaced
next - This determines the search direction, if this is true it searches forward, else backward
Returns:
returns the point where it found a match, the point contains (found row, found colIndex), this can be useful to do the next search
See Also:
doFindAndReplace(), replace(int, int,String ,String,Vector, boolean , int[])

replace

public 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
 This doesn't show any Find & Replace window where user can enter the text to be searched.
 you have to create your own window
 Otherwise you can use the Quicktable's find & replace window. To show a quicktable's
 find & replace Window use the method doFindAndReplace()

 The main difference between this and the other replace method is, this method can
 search in specific set of rows whereas the other can do only general search

  Example
  Lets say user has selected a set of rows and you want to search within that rows only
  to start searching from first row, and for searching 2nd and 4th columns only and
  starting the search from 4th column
   and searching the "quick" text forwards  and replacing the occurence with "table"

  Vector columnVector = new Vector();
  columnVector.addElement(new Integer(2));
  columnVector.addElement(new Integer(4));
  yourquicktable.replace( yourQuickTable.getTable().getSelectedRow(), 2, "quick", "table",columnVector, false, yourQuickTable.getTable().getSelectedRows());

 Note : replace will replace only editable columns
 

Parameters:
r - the starting row from which the search should be started. Row starts from 0,1,2..
searchCol - Vector of columns to be searched. example, if searching only 1st & 4th column, colVector.addElement(new Integer(1)); colVector.addElement(new Integer(4)); Important column starts from 1,2,3..
colIndex - the starting column within the searchCol vector, example if you want to start the searching from 3rd column, pass 2 because 4th column is the second index in colVector. Important the value for this argument cannot be greater than colVector size
findString1 - the text that needs to be searched
replaceString - the text that needs to be replaced
next - This determines the search direction, if this is true it searches forward, else backward
Returns:
returns the point where it found a match, the point contains (found row, found colIndex), this can be useful to do the next search
See Also:
doFindAndReplace(), replace(int, int,String ,String,Vector, boolean )

replaceAll

public 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
 The main difference between this and the other replaceAll method is, this method
 cannot search in specific rows, other replaceAll method can search in specific set
 of rows

  Example
  to start searching from first row, and for searching 2nd and 4th columns only and
  starting the search from 4th column
   and searching the "quick" text forwards  and replacing the occurence with "table"

  Vector columnVector = new Vector();
  columnVector.addElement(new Integer(2));
  columnVector.addElement(new Integer(4));
  yourquicktable.replaceAll( 0, 2, "quick", "table", columnVector);
 

Parameters:
r - the starting row from which the search should be started. Row starts from 0,1,2..
searchCol - Vector of columns to be searched. example, if searching only 1st & 4th column, colVector.addElement(new Integer(1)); colVector.addElement(new Integer(4)); Important column starts from 1,2,3..
colIndex - the starting column within the searchCol vector, example if you want to start the searching from 3rd column, pass 2 because 4th column is the second index in colVector. Important the value for this argument cannot be greater than colVector size
findString1 - the text that needs to be searched
replaceString - the text that needs to be replaced
Returns:
returns the point where the last match is found, the point contains (found row, found colIndex), this can be useful to do the next search
See Also:
replaceAll(int, int,String ,String,Vector, int[])

replaceAll

public 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
 The main difference between this and the other replaceAll method is, this method
 can search in specific rows whereas the other cannot

  Example
  Lets say user has selected a set of rows and you want to search within that rows only
  to start searching from first row, and for searching 2nd and 4th columns only and
  starting the search from 4th column
   and searching the "quick" text forwards  and replacing the occurence with "table"

  Vector columnVector = new Vector();
  columnVector.addElement(new Integer(2));
  columnVector.addElement(new Integer(4));
  yourquicktable.replace( yourQuickTable.getTable().getSelectedRow(), 2, "quick", "table",columnVector, yourQuickTable.getTable().getSelectedRows());
 

Parameters:
r - the starting row from which the search should be started. Row starts from 0,1,2..
searchCol - Vector of columns to be searched. example, if searching only 1st & 4th column, colVector.addElement(new Integer(1)); colVector.addElement(new Integer(4)); Important column starts from 1,2,3..
colIndex - the starting column within the searchCol vector, example if you want to start the searching from 3rd column, pass 2 because 4th column is the second index in colVector. Important the value for this argument cannot be greater than colVector size
findString1 - the text that needs to be searched
replaceString - the text that needs to be replaced
Returns:
returns the point where the last match is found, the point contains (found row, found colIndex), this can be useful to do the next search
See Also:
replaceAll(int, int,String ,String,Vector)

doFind

public 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

See Also:
find(int, int,String ,Vector, boolean), find(int, int,String ,Vector, boolean, int[])

doFindAndReplace

public 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

See Also:
replace(int, int,String ,String,Vector, boolean), replace(int, int,String ,String,Vector, boolean, int[])

setSkin

public void setSkin(Skin skin)
Apply the skin to table.
  Skins are used to apply style for your quickTable.
  Advantages of skins are
  1) Business logic and presentation separation
  2) You can change the style without changing the code
  3) You can get good skins from professional designers

  To know more about how to create your own skin, refer to Skin interface documentation
 

Parameters:
skin - the skin that need to be set to table
See Also:
Skin

getSkin

public Skin getSkin()
Gets the current skin applied If no skin is assigned it returns null


setCellComponent

public void setCellComponent(Column c,
                             int cellType,
                             java.util.Hashtable cellValueToDisplayHash)
sets the column's cell's component for rendering and editing.
 Currently QuickTable supports the following components
 Icon, CheckBox, RadioButton, ComboBox.

 Note: If you need Textarea editor ( multiple line editing) , instead of
 textfield editor (single line editing) for cell, use LONGVARCHAR as column type
 e.g dbTable.getColumn(1).setType(java.sql.Types.LONGVARCHAR)

 Setting Icon component
  Icon component displays the icon and when the user tries to
 edit the icon, it displays a list of icons in a combobox, user can select one of the icon from combo box

 set the celltype argument as Column.IMAGE_CELL
 set the cellValueToDisplayHash to hashtable which contains a mapping of actual cell data to the
 icon that need to be displayed
 For example, lets say the database contains "A" for employee alive, "D" for employee dead and "L" for employee on Leave
 and you have three gif files to represent these states alive.gif, dead.gif, leave.gif
 Hashtable imageHash = new Hashtable();
 imageHash.put("A",new ImageIcon(this.getClass().getResource("images/alive.gif")));
 imageHash.put("D",new ImageIcon(this.getClass().getResource("images/dead.gif")));
 imageHash.put("L",new ImageIcon(this.getClass().getResource("images/leave.gif")));
 //Note: make sure you have the images directory in classpath

 yourQuickTable.setCellComponent(yourQuickTable.getColumn(1), Column.IMAGE_CELL , imageHash)
 Note: For IMAGE_CELL, an empty row is added to combo box editor, so that users can use this to clear the data
       in the cell. If you don't need this empty row, use the other method
       see api for: setCellComponent(Column , int , Hashtable, boolean )

 setting Checkbox component
 checkbox component displayes a checkbox, user will be able to edit the check box by checking or unchecking

 set the celltype argument as Column.CHECKBOX_CELL
 set the cellValueToDisplayHash to hashtable which contains a mapping of actual cell data to the
 checkbox selection state
 For example, lets say the database contains "A" for employee alive, "D" for employee dead
 and if you want to set the checkbox selected when "A" and unselected when "D"
 Hashtable checkHash = new Hashtable();
 checkHash.put("A",new Boolean(true));
 checkHash.put("D",new Boolean(false));

 yourQuickTable.setCellComponent(yourQuickTable.getColumn(1), Column.CHECKBOX_CELL , checkHash)

 setting radiobutton component
 radiobutton component displayes a radiobutton, user will be able to edit the radiobutton by selecting or deselecting

 set the celltype argument as Column.RADIOBUTTON_CELL
 set the cellValueToDisplayHash to hashtable which contains a mapping of actual cell data to the
 checkbox selection state
 For example, lets say the database contains "A" for employee alive, "D" for employee dead
 and if you want to set the radiobutton selected when "A" and unselected when "D"
 Hashtable radioHash = new Hashtable();
 radioHash.put("A",new Boolean(true));
 radioHash.put("D",new Boolean(false));

 yourQuickTable.setCellComponent(yourQuickTable.getColumn(1), Column.RADIOBUTTON_CELL , radioHash)

 For COMBOBOX_CELL

 comboBox editor
 combox editor displayes a list of values in a combo box where user can select a value

 For example, lets say the database contains "A" for employee alive, "D" for employee dead
 and if you want to show "Alive" instead of "A" in the combo box list and "Dead" instead of "D"
 Hashtable comboHash = new Hashtable();
 comboHash.put("A","Alive");
 comboHash.put("D","Dead");
  yourQuickTable.setCellComponent(yourQuickTable.getColumn(1), Column.COMBOBOX_CELL , comboHash);

 Note: For COMBOBOX_CELL, an empty row is added to combo box editor, so that users can use this to clear the data
       in the cell. If you don't need this empty row, use the other method
       see api for: setCellComponent(Column , int , Hashtable, boolean )

  In the above case the database values "A", "D" are diffrenet from the combo box listed values "Alive","Dead".
  But in some cases database values & combo box listed values are same in that case, use as below

  Example
  class MyCell implements CellComponent
  {
      JCombobox myCombo = new JCombobox();
      MyCell()
      {
         myCombo.addItem("Alive");
         myCombo.addItem("Dead");
         myCombo.addItem("Leave");
      }

      public void setValue(Object value)
      {
          comboBox.setSelectedItem(o);
          //handle the case if null is passed
      }

      public Object getValue()
      {
  	return comboBox.getSelectedItem();
          //return "" if nothing is selected
      }


      public JComponent getComponent()
      {
         return mycombo;
      }

  }
  yourQuickTable.getColumn(1).setUserCellEditor(new MyCell());

 To create a combo box editor which contains the listed items from a Sql query use
 yourQuickTable.getColumn(1).setBoundSql("select distinct status from employee:);

 

Parameters:
c - Column to which the Cell component should be assigned
cellType - Any one of Column.IMAGE_CELL or Column.CHECKBOX_CELL or Column.RADIOBUTTON_CELL or COMBOBOX_CELL
cellValueToDisplayHash - hashtable which contains a mapping of actual cell data to the display data
See Also:
Column.setUserCellEditor(CellComponent), setCellComponent(Column , int , Hashtable, boolean )

setCellComponent

public 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

Parameters:
c - Column to which the Cell component should be assigned
cellType - Any one of Column.IMAGE_CELL or Column.CHECKBOX_CELL or Column.RADIOBUTTON_CELL or COMBOBOX_CELL
cellValueToDisplayHash - hashtable which contains a mapping of actual cell data to the display data
addClearOption - If true, adds an empty cell to combo box editor. This will be helpful to make the cell empty.
See Also:
setCellComponent(Column, int , Hashtable)

setCellComponent

public 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. Since hashtable cannot retreive the key/value pair in the order in which you added , we are using an extra object array of keys to notify the keys order. The keysSortOrder is only for Column.COMBOBOX_CELL and Column.IMAGE_CELL cellTypes. It is ignored for all other cell types Example
 Object[] keysSortOrder = new Object[2];
 keysSortOrder[0]="D";
 keysSortOrder[1]="A";

 Hashtable comboHash = new Hashtable();
 comboHash.put(keysSortOrder[1],"Alive");
 comboHash.put(keysSortOrder[0],"Dead");

 yourQuickTable.setCellComponent(yourQuickTable.getColumn(1), Column.COMBOBOX_CELL , comboHash, keysSortOrder, false);

 This will display the combox items in order Dead, Alive.

 

Parameters:
c - Column to which the Cell component should be assigned
cellType - Any one of Column.IMAGE_CELL or Column.CHECKBOX_CELL or Column.RADIOBUTTON_CELL or COMBOBOX_CELL
cellValueToDisplayHash - hashtable which contains a mapping of actual cell data to the display data
keysSortOrder - An object array of keys which are present in cellValueToDisplayHash.
addClearOption - If true, adds an empty cell to combo box editor. This will be helpful to make the cell empty.
See Also:
setCellComponent(Column, int , Hashtable)

clearAllDeleteSql

public 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

See Also:
addDeleteSql(String, String)

clearAllInsertSql

public 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

See Also:
addInsertSql(String, String)

clearAllUpdateSql

public 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

See Also:
addUpdateSql(String, String)

print

public 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[])

See Also:
print(int[])

print

public 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)

See Also:
print(int[],PrintProperties)

print

public void print(int pageWidth,
                  int pageHeight)
Prints the contents of quicktable to printer with a paper size of pageWidth & pageHeight
  You can use this method to print in Landscape mode
  Landscape mode or portriat mode is decided by the pagewidth & pageHeight
  For exampele
   to print in landscape mode for A4 size
   yourQuicktable.print(792,612);

   to print in portriat mode for A4 size
   yourQuicktable.print(612,792);

  If you want to print only specific pages use print(int[], int, int)

 

Parameters:
pageWidth - actual width of paper, in 1/72nds of an inch
pageHeight - actual height of paper, in 1/72nds of an inch
See Also:
print(int[], int, int)

print

public 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()

Parameters:
pages - int array of pages that should be printed
See Also:
print()

print

public 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)

Parameters:
pages - int array of pages that should be printed
See Also:
print(PrintProperties)

print

public void print(int[] pages,
                  int pageWidth,
                  int pageHeight)
Prints the contents of quicktable to printer with a paper size of pageWidth & pageHeight
  You can use this method to print in Landscape mode
  Landscape mode or portriat mode is decided by the pagewidth & pageHeight
  For exampele
   to print in landscape mode for A4 size
   yourQuicktable.print(792,612);

   to print in portriat mode for A4 size
   yourQuicktable.print(612,792);

  If you want to print all pages, use print(int, int)
 

Parameters:
pages - int array of pages that should be printed
pageWidth - actual width of paper
pageHeight - actual height of paper
See Also:
print(int, int)

copyToClipboard

public void copyToClipboard(int[] row)
Copies the content in the rows to clipboard, later it can be pasted in Excel or any text Editor. Content will be created in a tab delimited format

Parameters:
row - the rows which need to be copied, if null is passed all the selected rows will be copied

pasteFromClipboard

public 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


getPrintable

public java.awt.print.Printable getPrintable(PrintProperties prop)
Gets the Printable for this table. By default Quicktable uses the basic JDK 1.1 printing, if you want to use the new printing features in java, you can get the Printable object from DBTable and use the advanced features.
In JDK 1.2 or 1.3

 //get the printer
java.awt.print.PrinterJob printJob = java.awt.print.PrinterJob.getPrinterJob();

 //get the printable object from dbtable
printJob.setPrintable(dbTable.getPrintable(new PrintProperties()));

 //show the print dialog, if the user presses print in the dialog, then print
 //if you do not want to show dialog, comment the next line and directly call print()
if( printJob.printDialog() )
    printJob.print();
In JDK 1.4 or above
 //get the printable object from dbtable
java.awt.print.Printable print = dbTable.getPrintable(new PrintProperties());


 //set print type
javax.print.DocFlavor flavor = javax.print.DocFlavor.SERVICE_FORMATTED.PRINTABLE;
javax.print.SimpleDoc  doc = new javax.print.SimpleDoc(print, flavor, null);

 //get printer
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = service.createPrintJob();

 //print
job.print(doc, null);

For more info refer http://javaalmanac.com/egs/javax.print/pkg.html

Since:
2.0.5.19

printPreview

public void printPreview()
Shows the print preview frame


printPreview

public void printPreview(int pageWidth,
                         int pageHeight)
Shows the print preview frame, with the paper size of given width & height
  Landscape mode or portriat mode is decided by the pagewidth & pageHeight
  For exampele
   to print preview in landscape mode for A4 size
   yourQuicktable.printPreview(792,612);

   to print preview in portriat mode for A4 size
   yourQuicktable.printPreview(612,792);

 

Parameters:
pageWidth - actual width of paper, in 1/72nds of an inch
pageHeight - actual height of paper,in 1/72nds of an inch

printPreview

public void printPreview(PrintProperties prop)
Shows the print preview frame for the given Print Properties


getPrintPreviewCanvas

public PreviewPanel getPrintPreviewCanvas()
creates a printpreview Canvas This will be useful to create your own print preview frame


getPrintPreviewCanvas

public PreviewPanel getPrintPreviewCanvas(int pageWidth,
                                          int pageHeight)
creates a printpreview Canvas, with the paper size of given width & height. This will be useful to create your own print preview frame.
  Landscape mode or portriat mode is decided by the pagewidth & pageHeight
  For exampele
   to create print preview in landscape mode for A4 size
   yourQuicktable.getPrintPreviewCanvas(792,612);

   to create print preview in portriat mode for A4 size
   yourQuicktable.getPrintPreviewCanvas(612,792);

 

Parameters:
pageWidth - actual width of paper
pageHeight - actual height of paper

getPrintPreviewCanvas

public PreviewPanel getPrintPreviewCanvas(PrintProperties prop)
creates a printpreview Canvas with the given PrintProperties. This will be useful to create your own print preview frame

Since:
2.0.2

setEditable

public void setEditable(boolean val)
sets the editable property of this table.
If you don't want the users to edit the data in any of the cells in the table
  you can call     yourQuickTable.setEditable(false);

  This methods helps to set the editable property of the whole table. If you want
  to make some columns editable and some columns not editable  you can
  call setReadOnly() method for that specific column

  Note: This method overrides the column setReadOnly() property. If you want to make some columns
  editable and others non editable, then you have to call setEditable(true) first and then set
  the column which are non editable as setReadonly(true). By default quicktable is started
  with setEditable(true)

  If you need to control the editable property based on cell by cell, then you need to use the CellPropertiesModel class
 and override the isCellEditable() method.
 

Parameters:
val - true - to make table editable, false to make the table non editable
Since:
2.0.2
See Also:
Column.setReadOnly(boolean)

getColumnByDatabaseName

public 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

Parameters:
colName - database column name
Since:
2.0.2

getColumnByHeaderName

public 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

Parameters:
colName - column header name
Since:
2.0.2

sortByColumn

public 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

Parameters:
column - sort column
ascending - sort mode
Since:
2.0.2
See Also:
sortByColumns(Vector,boolean)

getSortColumns

public java.util.Vector getSortColumns()
returns a vector of Integer columns based on which the data is currently sorted. returns null, if columns were never sorted

Since:
2.0.5.6
See Also:
sortByColumns(Vector,boolean)

isSortAscending

public boolean isSortAscending()
returns the current sort order

Since:
2.0.5.6

sortByColumns

public 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

Parameters:
columnVector - columnVector which contains Integer objects corresponding to the columns that should be sorted
ascending - sort mode
Since:
2.0.2
See Also:
sortByColumn(int, boolean)

filter

public void filter(Filter filter)
Filters the data based on the given filter object If null is passed, then all the recorsd will be displayed

Since:
2.0.2
See Also:
Filter

filter

public void filter(int column,
                   int criteria,
                   java.lang.Object key)
Filters the data based on the given criteria

Parameters:
column - The column number starts from 0,1,2,3
criteria - One of EQUAL or GREATER or LESS
key - the object to which the cell data will be compared
Since:
2.0.2
See Also:
Filter

compareObject

public 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

Since:
2.0.2
See Also:
Filter

getRowObject

public java.lang.Object getRowObject(int row)
Gets the Data object in this row. This is mainly used with refreshDataObject() method. when you want to make some changes to the dataobject in a given row, you can access that row's data object using this method If the data currently displayed in the quicktable is not from data objects, then this method will return the row data vector

Parameters:
row - the row for which you need the data object
Since:
2.0.2
See Also:
refreshDataObject(Vector, String[]), refreshDataObject(Enumeration, String[])

setComparator

public void setComparator(Comparator comp)
Sets the compartor which should be used for sorting

Since:
2.0.2

setSorter

public void setSorter(Sorter sorter)
Sets the sorter which should be used for sorting

Since:
2.0.2

clearAllSettings

public void clearAllSettings()
clears the currently used settings This clears the following UpdateSql InsertSql DeleteSql ErrorListener CellListener ChangeListener cellPropertiesModel Comparator

Since:
2.0.2

getVersion

public java.lang.String getVersion()
returns the version of quicktable

Since:
2.0.2

setDBTableLocale

public void setDBTableLocale(java.util.Locale currentLocale,
                             java.awt.Font localeFont)
sets the locale for quickTable.
 For example to set the Locale to French language, the country of Canada, and the UNIX platform.
 yourQuickTable.setDBTableLocale(new Locale("fr", "CA", "UNIX"));

 You should also provide a properties file which has the text mappings for that locale. In the above
 case the properties file would have the name

  QuickTable_fr_CA_UNIX.properties

  This properties file should be present in the classpath.

  Following is the contents of the default properties file

  Record=Record
  FirstRow=First row
  PreviousRow=Previous row
  NextRow=Next row
  LastRow=Last row
  AddRow=Add row
  DeleteRow=Delete row
  of=of
  UnableToDelete=Unable to delete!
  FinishedSearching=Finished Searching
  ReplaceFormat=Replace this occurrence of {0}
  FinishedReplacing=Finished Replacing
  TotalReplacements={0,number,integer} replacements!
  TextToFind=Text to find
  FindNext=Find Next
  FindPrevious=Find Previous
  ReplaceAll=Replace All
  Close=Close
  FromSelectedRow=From selected row
  ReplaceWith=Replace With
  Print=Print
  Next=Next
  Previous=Previous
  January=January
  February=February
  March=March
  April=April
  May=May
  June=June
  July=July
  August=August
  September=September
  October=October
  November=November
  December=December
  Sunday=S
  Monday=M
  Tuesday=T
  Wednesday=W
  Thursday=T
  Friday=F
  Saturday=S
  Ok=Ok
  Cancel=Cancel
  Clear=Clear
  DriverNotFound=Unable to find the Database Driver!
  DatabaseError=Database error!
  EmptyCell=This cell can't be empty!
  InsertError=Unable to Insert!
  UpdateError=Unable to Update!
  SelectDate=Select Date
  ReplaceNext=Replace Next
  ReplacePrevious=Replace Previous

 Copy these mapping entries to your locale properties file and then
 provide the translations for your language
 For example
 of=de

 Please refer to http://java.sun.com/docs/books/tutorial/i18n/index.html for more information.


    QuickTable download file (zip/tar) has the properties file for the following languages.
    JAPANESE(QuickTable_ja.properties), FRENCH(QuickTable_fr.properties), GERMAN(QuickTable_de.properties),
    SPANISH(QuickTable_es.properties),ITALIAN (QuickTable_it.properties), PORTUGUESE(QuickTable_pt.properties),
    CHINESE(QuickTable_zh.properties), RUSSIAN(QuickTable_ru.properties),KOREAN(QuickTable_ko.properties).
    These files can be found in the "lib" directory

    For languages with non latin characters like Chinese, setting locale alone is not enough. You also
    have to set the font. Sometimes, the fon't you mention may not be available at runtime.
    In that case, use the other method setDBTableLocale(Locale, String ) and pass a sample text
    of that language, quickTable can find the font which can display that text in runtime.

 

Since:
2.0.5
See Also:
setDBTableLocale(Locale, String ), setDBTableLocale(Locale)

setDBTableLocale

public void setDBTableLocale(java.util.Locale currentLocale)
sets the locale for quickTable.
    You need to add your language specific quicktable properties file to classpath.
    For more information about this properties file, refer to setDBTableLocale(Locale, Font ).

    QuickTable download file (zip/tar) has the properties file for the following languages.
    JAPANESE(QuickTable_ja.properties), FRENCH(QuickTable_fr.properties), GERMAN(QuickTable_de.properties),
    SPANISH(QuickTable_es.properties),ITALIAN (QuickTable_it.properties), PORTUGUESE(QuickTable_pt.properties),
    CHINESE(QuickTable_zh.properties), RUSSIAN(QuickTable_ru.properties),KOREAN(QuickTable_ko.properties).
    These files can be found in the "lib" directory

    For languages with non latin characters like Chinese, setting locale alone is not enough. You also
    have to set the font. Use setDBTableLocale(Locale, Font ) to set the font.
  

Since:
2.0.3
See Also:
setDBTableLocale(Locale, Font )

setDBTableLocale

public void setDBTableLocale(java.util.Locale currentLocale,
                             java.lang.String localeUnicodeText)
sets the locale for quickTable.
    You need to add your language specific quicktable properties file to classpath.
    For more information about this properties file, refer to setDBTableLocale(Locale, Font ).

    QuickTable download file (zip/tar) has the properties file for the following languages.
    JAPANESE(QuickTable_ja.properties), FRENCH(QuickTable_fr.properties), GERMAN(QuickTable_de.properties),
    SPANISH(QuickTable_es.properties),ITALIAN (QuickTable_it.properties), PORTUGUESE(QuickTable_pt.properties),
    CHINESE(QuickTable_zh.properties), RUSSIAN(QuickTable_ru.properties),KOREAN(QuickTable_ko.properties).
    These files can be found in the "lib" directory

    For languages with non latin characters like Chinese, setting locale alone is not enough. You also
    have to set the font. Sometimes, the fon't you mention may not be available at runtime.
    If you give a sample text quickTable can find the font which can display that text in runtime.

    Note: There may be a performance impact with this method because this operation has to
    go through all the installed fonts. If it finds a match within first few fonts,this
    method will return quickly. If it goes through all fonts this method will take some time.

    e.g setDBTableLocale(Locale.CHINESE,"\u65E0\u6CD5\u5220\u9664");

  

Since:
2.0.5
See Also:
setDBTableLocale(Locale, Font )

findFont

public java.awt.Font findFont(java.lang.String sampleText)
A utility method to find the font which can display the given specific language text
    Since you may not be sure what fonts are available at runtime, you can use this method
    to find the font in runtime, which can display your language specific text
    e.g findFont("\u65E0\u6CD5\u5220\u9664");

    Note: There may be a performance impact with this method because this operation has to
    go through all the installed fonts. If it finds a match within first few fonts,this
    method will return quickly. If it goes through all fonts this method will take some time.
  

Since:
2.0.5
See Also:
setDBTableLocale(Locale, Font )

setFixedColumns

public void setFixedColumns(int[] cols)
Sets the fixed columns.
  This will make the fixed columns not scrollable, while other columns can be scrollable horizontally.

  Note: column starts from 1,2

  Fixed Columns implementation: JTable doesn't support fixed columns, so fixed columns are simulated by
  adding another JTable in the left side of the JTable, which will hold fixed columns and in the main
  table these fixed columns will be hidden. So when you try to navigate rows/cells using keyboards
  you may not see the right behaviour.

  Since the fixed columns are simulated, you cannot sort or apply quickTable specific cell/column properties
  like color/font/alignment/renederer/combobox/radio/image/check box editor etc. You will get the handle
  to the fixed JTable by calling getFixedTable(), you can access the columnmodel & tablemodel of this
  fixed JTable and you can use that to customize the fixed columns. Any DBTable cell/column settings which
  you apply to the main table will not be applied to the fixed columns.

  In the main table, the fixed columns will be hidden, if necessary, you can make them visible by calling
  dbTable.getColumn(1).setVisible(true) on those columns. Once you make them visible, sorting ,cell properties
  cell editors can be applied for those columns.

  There is no limit to how many columns you can add to fixed columns, but the width of quicktable should be
  greater than fixed column's width, then only you can view the horizontal scroll bar for non fixed columns
   & the non fixed columns

  After setting the fixed columns, if you want to hide it, call setFixedColumns(null)

  

Since:
2.0.5

getFixedTable

public javax.swing.JTable getFixedTable()
If you have created fixed columns using setFixedColumns(), then this method will return the JTable used by this fixed columns

Since:
2.0.5

setMaximumRowCount

public 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 After setting the maximum row count, if you have to change back to the original behaviour of showing all availble records use setMaximumRowCount(java.lang.Integer.MAX_VALUE)

Parameters:
row - the maximum row count
Since:
2.0.4

getMaximumRowCount

public int getMaximumRowCount()
returns the maximum row count

Returns:
the maximum row count
Since:
2.0.4

setDatabaseUpdateMode

public void setDatabaseUpdateMode(int mode)
sets the update mode about when the changes should be updated to database

Parameters:
mode - Either UPDATE_DATABASE_ON_CELL_EXIT or UPDATE_DATABASE_ON_ROW_EXIT, the default is UPDATE_DATABASE_ON_ROW_EXIT
Since:
2.0.4

getDatabaseUpdateMode

public int getDatabaseUpdateMode()
gets the update mode about when the changes should be updated to database

Since:
2.0.4

getTableHeader

public javax.swing.table.JTableHeader getTableHeader()
Returns the tableHeader working with this JTable.
Source: Copied from JTable for convenience

Returns:
the tableHeader

getColumnCount

public int getColumnCount()
Returns the number of columns
Source: Copied from JTable for convenience

Returns:
the number of columns in the table
See Also:
getRowCount()

editCellAt

public boolean editCellAt(int row,
                          int column)
Programmatically starts editing the cell at row and column, if the cell is editable.
Source: Copied from JTable for convenience

Parameters:
row - the row to be edited
column - the column to be edited
Returns:
false if for any reason the cell cannot be edited.
Throws:
java.lang.IllegalArgumentException - If row or column are not in the valid range

getEditingColumn

public int getEditingColumn()
This returns the index of the editing column.
Source: Copied from JTable for convenience

Returns:
the index of the column being edited

getEditingRow

public int getEditingRow()
Returns the index of the editing row.
Source: Copied from JTable for convenience

Returns:
the index of the row being edited

getRowCount

public int getRowCount()
Returns the number of rows in the table.
Source: Copied from JTable for convenience

See Also:
getColumnCount()

getSelectedColumn

public int getSelectedColumn()
Returns the index of the first selected column, -1 if no column is selected.
Source: Copied from JTable for convenience


getSelectedColumnCount

public int getSelectedColumnCount()
Returns the number of selected columns.
Source: Copied from JTable for convenience

Returns:
the number of selected columns, 0 if no columns are selected

getSelectedColumns

public int[] getSelectedColumns()
Returns the indices of all selected columns.
Source: Copied from JTable for convenience

Returns:
an array of ints containing the indices of all selected columns, or an empty array if no column is selected.
See Also:
getSelectedColumn()

getSelectedRow

public int getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.
Source: Copied from JTable for convenience


getSelectedRowCount

public int getSelectedRowCount()
Returns the number of selected rows.
Source: Copied from JTable for convenience

Returns:
the number of selected rows, 0 if no columns are selected

getSelectedRows

public int[] getSelectedRows()
Returns the indices of all selected rows.
Source: Copied from JTable for convenience

Returns:
an array of ints containing the indices of all selected rows, or an empty array if no row is selected.
See Also:
getSelectedRow()

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the cell value at row and column.


Source: Copied from JTable for convenience

Parameters:
row - the row whose value is to be looked up
column - the column whose value is to be looked up
Returns:
the Object at the specified cell

isRowSelected

public boolean isRowSelected(int row)
Returns true if the row at the specified index is selected
Source: Copied from JTable for convenience

Returns:
true if the row at index row is selected, where 0 is the first row
Throws:
java.lang.IllegalArgumentException - if row is not in the valid range

moveColumn

public void moveColumn(int column,
                       int targetColumn)
Moves the column column to the position currently occupied by the column targetColumn. The old column at targetColumn is shifted left or right to make room.
Note: the column index starts from 0,1,2...
Source: Copied from JTable for convenience

Parameters:
column - the index of column to be moved
targetColumn - the new index of the column

removeColumnSelectionInterval

public void removeColumnSelectionInterval(int index0,
                                          int index1)
Deselects the columns from index0 to index0 inclusive.
Source: Copied from JTable for convenience

Parameters:
index0 - one end of the interval.
index1 - other end of the interval

removeRowSelectionInterval

public void removeRowSelectionInterval(int index0,
                                       int index1)
Deselects the rows from index0 to index0 inclusive.
Source: Copied from JTable for convenience

Parameters:
index0 - one end of the interval.
index1 - other end of the interval

selectAll

public void selectAll()
Select all rows, columns and cells in the table.
Source: Copied from JTable for convenience


setRowSelectionInterval

public void setRowSelectionInterval(int index0,
                                    int index1)
Selects the rows from index0 to index1 inclusive.
Source: Copied from JTable for convenience

Parameters:
index0 - one end of the interval.
index1 - other end of the interval

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)
Sets the value for the cell at row and column. aValue is the new value.
Source: Copied from JTable for convenience

Parameters:
aValue - the new value
row - the row whose value is to be changed
column - the column whose value is to be changed
See Also:
getValueAt(int, int)

clearSelection

public void clearSelection()
Deselects all selected columns and rows.
Source: Copied from JTable for convenience


addColumnSelectionInterval

public void addColumnSelectionInterval(int index0,
                                       int index1)
Adds the columns from index0 to index0 inclusive to the current selection.
Source: Copied from JTable for convenience

Parameters:
index0 - one end of the interval.
index1 - other end of the interval

addRowSelectionInterval

public void addRowSelectionInterval(int index0,
                                    int index1)
Adds the rows from index0 to index0 inclusive to the current selection.
Source: Copied from JTable for convenience

Parameters:
index0 - one end of the interval.
index1 - other end of the interval

fireTableCellUpdated

public void fireTableCellUpdated(int row,
                                 int column)
Notify all listeners that the value of the cell at (row, column) has been updated. Sometimes, even if you update the cell value using setValueAt(), the table may not be refreshed with new value. In that case fire this event.


fireTableDataChanged

public void fireTableDataChanged()
Notify all listeners that all cell values in the table's rows may have changed. Sometimes, even if you update multiple cell values using setValueAt(), the table may not be refreshed with new value. In that case fire this event.


selectCell

public void selectCell(int rowOfCellToBeSelected,
                       int columnOfCellToBeSelected)
selects the cell. Sets the focus to the cell.


selectCell

public void selectCell(int rowOfCellToBeSelected,
                       int columnOfCellToBeSelected,
                       boolean focus)

selectFirstVisibleColumnCell

public void selectFirstVisibleColumnCell(int row,
                                         boolean focus)

loadAllRows

public 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

Since:
2.0.5.21

removeColumnHeader

public void removeColumnHeader()
Removes the column header from the table


addFocusListener

public void addFocusListener(java.awt.event.FocusListener l)

addKeyListener

public void addKeyListener(java.awt.event.KeyListener l)

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)

removeFocusListener

public void removeFocusListener(java.awt.event.FocusListener l)

removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener l)

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener l)

removeNotify

public void removeNotify()

cleanup

public void cleanup()
Cleans up swing resources like frames used within DBTable. This method will be automatically called once the DBTable is removed from the parent component. If you still feel quicktable is not releasing the resources on time, you call this method.