Java Doc for DwPanel.java in  » Database-Client » SQL-Workbench » workbench » gui » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » SQL Workbench » workbench.gui.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.swing.JPanel
   workbench.gui.sql.DwPanel

DwPanel
public class DwPanel extends JPanel implements TableModelListener,ListSelectionListener,ChangeListener,DbData,DbUpdater,Interruptable,JobErrorHandler(Code)
A Panel which displays the result of a SELECT statement and can save changes to the database
author:
   support@sql-workbench.net


Field Summary
final public static  StringPROP_UPDATE_TABLE
    
protected  WbTabledataTable
    
protected  WbConnectiondbConnection
    
protected  DeleteDependentRowsActiondeleteDependentRow
    
protected  DeleteRowActiondeleteRow
    
protected  CopyRowActionduplicateRow
    
protected  InsertRowActioninsertRow
    
protected  WbScrollPanescrollPane
    
protected  SelectKeyColumnsActionselectKeys
    
protected  DwStatusBarstatusBar
    
protected  UpdateDatabaseActionupdateAction
    

Constructor Summary
public  DwPanel()
    
public  DwPanel(DwStatusBar aStatusBar)
    

Method Summary
public  longaddRow()
    
public  voidcancelExecution()
    
public  voidcheckAndSelectKeyColumns()
    
public  booleancheckUpdateTable()
    
public  voidclearContent()
     Clears everything.
public  voidclearStatusMessage()
     Clears the display on the status bar.
public  booleanconfirmCancel()
    
public  voiddeleteRow()
    
public  voiddeleteRowWithDependencies()
    
protected  voiddisableUpdateActions()
    
public  voiddisconnect()
    
public  voiddispose()
    
public  intduplicateRow()
    
public  voidendEdit()
    
public  voidendEdit(boolean restoreData)
    
public  voidfatalError(String msg)
    
public  intgetActionOnError(int errorRow, String errorColumn, String data, String errorMessage)
    
public  CopyRowActiongetCopyRowAction()
    
public  NamedSortDefinitiongetCurrentSort()
    
public  DeleteDependentRowsActiongetDeleteDependentRowsAction()
    
public  DeleteRowActiongetDeleteRowAction()
    
public  InsertRowActiongetInsertRowAction()
    
public  StringgetLastMessage()
    
public  intgetMaxRows()
    
public  intgetQueryTimeout()
    
public  RowActionMonitorgetRowMonitor()
    
public  SelectKeyColumnsActiongetSelectKeysAction()
    
public  WbTablegetTable()
    
public  UpdateDatabaseActiongetUpdateDatabaseAction()
    
public  booleanhasKeyColumns()
    
public  booleanhasResultSet()
    
public  booleanhasUpdateableColumns()
    
public  voidinitTableNavigation(MainWindow container)
    
public  booleanisModified()
     Returns true if the DataStore of the Table has been modified.
public  booleanisReadOnly()
    
public  booleanisUpdateable()
    
 booleanprepareDatabaseUpdate()
     Prepare the DwPanel for saving any changes to the database. This will check for the PK columns and if necessary ask the user to specify them.
public  voidrowCountChanged()
     This method will update the row info display on the statusbar.
public  booleanrunQuery(String aSql, boolean respectMaxRows)
     Execute the given SQL statement and display the result.
public  intsaveChanges(WbConnection aConnection, JobErrorHandler errorHandler)
    
public  voidsaveChangesToDatabase()
    
public  voidsetBatchUpdate(boolean aFlag)
     Turns on the batchUpdate mode. In this mode, the automatic switch to edit mode is disabled.
public  voidsetConnection(WbConnection aConn)
     Defines the connection for this DwPanel.
public  voidsetCursor(Cursor newCursor)
    
public  voidsetDefaultStatusMessage(String aMessage)
    
public  voidsetManageUpdateAction(boolean aFlag)
    
public  voidsetMaxRows(int aMax)
    
protected  voidsetMessageDisplayModel(TableModel aModel)
    
public  voidsetPrintHeader(String header)
    
public  voidsetQueryTimeout(int value)
    
public  voidsetReadOnly(boolean aFlag)
    
public  voidsetShowLoadProcess(boolean aFlag)
    
public  voidsetSortDefinition(NamedSortDefinition sort)
    
public  voidsetStatusMessage(String aMsg)
     Show a message in the status panel.
public  voidsetUpdateHandler(DbUpdater aDelegate)
     Sets the handler which performs the update to the database. This delegate is passed to the UpdateDatabaseAction.
public  voidsetUpdateTable(TableIdentifier table)
     Define the update table to be used.
public  voidsetUpdateTableToBeUsed(TableIdentifier table)
     Pass the table to be used for future updates to the underlying DataStore.
public  booleanshouldSaveChanges(WbConnection aConnection)
    
public  voidshowData(StatementRunnerResult result)
     Display any result set that is contained in the StatementRunnerResult.
public  voidshowData(ResultSet result, String sql)
    
public  voidshowData(DataStore newData, String statement)
    
public  voidshowError(String error)
    
public  voidshowlastExecutionTime()
    
public  booleanstartEdit()
    
public  booleanstartEdit(boolean restoreSelection)
     Starts the "edit" mode of the table.
public  voidstateChanged(ChangeEvent e)
     Called from the viewport, when the display has been scrolled We need to update the row display then.
public  voidtableChanged(TableModelEvent e)
     If the user changes something in the result set (which is possible, as the table defaults to beeing editable) the edit mode (with status column and the different actions enabled) is switched on automatically.
public  voidupdateStatusBar()
    
public  voidvalueChanged(ListSelectionEvent e)
     This is called when the selection in the table changes.

Field Detail
PROP_UPDATE_TABLE
final public static String PROP_UPDATE_TABLE(Code)



dataTable
protected WbTable dataTable(Code)



dbConnection
protected WbConnection dbConnection(Code)



deleteDependentRow
protected DeleteDependentRowsAction deleteDependentRow(Code)



deleteRow
protected DeleteRowAction deleteRow(Code)



duplicateRow
protected CopyRowAction duplicateRow(Code)



insertRow
protected InsertRowAction insertRow(Code)



scrollPane
protected WbScrollPane scrollPane(Code)



selectKeys
protected SelectKeyColumnsAction selectKeys(Code)



statusBar
protected DwStatusBar statusBar(Code)



updateAction
protected UpdateDatabaseAction updateAction(Code)




Constructor Detail
DwPanel
public DwPanel()(Code)



DwPanel
public DwPanel(DwStatusBar aStatusBar)(Code)




Method Detail
addRow
public long addRow()(Code)



cancelExecution
public void cancelExecution()(Code)



checkAndSelectKeyColumns
public void checkAndSelectKeyColumns()(Code)



checkUpdateTable
public boolean checkUpdateTable()(Code)



clearContent
public void clearContent()(Code)
Clears everything.
  • Ends the edit mode
  • removes all rows from the table
  • sets the hasResultSet flag to false
  • the lastMessage is set to an empty string
  • the last SQL is set to null
  • the statusbar display is cleared



clearStatusMessage
public void clearStatusMessage()(Code)
Clears the display on the status bar.
See Also:   DwStatusBar.clearStatusMessage



confirmCancel
public boolean confirmCancel()(Code)



deleteRow
public void deleteRow()(Code)



deleteRowWithDependencies
public void deleteRowWithDependencies()(Code)



disableUpdateActions
protected void disableUpdateActions()(Code)



disconnect
public void disconnect()(Code)



dispose
public void dispose()(Code)



duplicateRow
public int duplicateRow()(Code)



endEdit
public void endEdit()(Code)
Stops the editing mode of the displayed WbTable:
  • the status column is turned off
  • the edit actions are enabled/disabled correctly
  • the originalValues for the DataStore are restored



endEdit
public void endEdit(boolean restoreData)(Code)



fatalError
public void fatalError(String msg)(Code)



getActionOnError
public int getActionOnError(int errorRow, String errorColumn, String data, String errorMessage)(Code)



getCopyRowAction
public CopyRowAction getCopyRowAction()(Code)



getCurrentSort
public NamedSortDefinition getCurrentSort()(Code)



getDeleteDependentRowsAction
public DeleteDependentRowsAction getDeleteDependentRowsAction()(Code)



getDeleteRowAction
public DeleteRowAction getDeleteRowAction()(Code)



getInsertRowAction
public InsertRowAction getInsertRowAction()(Code)



getLastMessage
public String getLastMessage()(Code)



getMaxRows
public int getMaxRows()(Code)



getQueryTimeout
public int getQueryTimeout()(Code)



getRowMonitor
public RowActionMonitor getRowMonitor()(Code)



getSelectKeysAction
public SelectKeyColumnsAction getSelectKeysAction()(Code)



getTable
public WbTable getTable()(Code)



getUpdateDatabaseAction
public UpdateDatabaseAction getUpdateDatabaseAction()(Code)



hasKeyColumns
public boolean hasKeyColumns()(Code)



hasResultSet
public boolean hasResultSet()(Code)



hasUpdateableColumns
public boolean hasUpdateableColumns()(Code)



initTableNavigation
public void initTableNavigation(MainWindow container)(Code)



isModified
public boolean isModified()(Code)
Returns true if the DataStore of the Table has been modified.
See Also:   workbench.storage.DataStore.isModified



isReadOnly
public boolean isReadOnly()(Code)



isUpdateable
public boolean isUpdateable()(Code)



prepareDatabaseUpdate
boolean prepareDatabaseUpdate()(Code)
Prepare the DwPanel for saving any changes to the database. This will check for the PK columns and if necessary ask the user to specify them. It will also prompt the user to verify the generated update statements. If everything is OK, true will be returned If the user cancels the PK column selection or the statement preview, false will be returned. In that case saveChanges() should not be called



rowCountChanged
public void rowCountChanged()(Code)
This method will update the row info display on the statusbar.



runQuery
public boolean runQuery(String aSql, boolean respectMaxRows) throws SQLException, Exception(Code)
Execute the given SQL statement and display the result.



saveChanges
public int saveChanges(WbConnection aConnection, JobErrorHandler errorHandler) throws SQLException(Code)



saveChangesToDatabase
public void saveChangesToDatabase()(Code)
Starts the saving of the data in the background



setBatchUpdate
public void setBatchUpdate(boolean aFlag)(Code)
Turns on the batchUpdate mode. In this mode, the automatic switch to edit mode is disabled. This is used when populating the table from the database otherwise, the first row, which is retrieved will start the edit mode



setConnection
public void setConnection(WbConnection aConn)(Code)
Defines the connection for this DwPanel.



setCursor
public void setCursor(Cursor newCursor)(Code)



setDefaultStatusMessage
public void setDefaultStatusMessage(String aMessage)(Code)



setManageUpdateAction
public void setManageUpdateAction(boolean aFlag)(Code)



setMaxRows
public void setMaxRows(int aMax)(Code)



setMessageDisplayModel
protected void setMessageDisplayModel(TableModel aModel)(Code)



setPrintHeader
public void setPrintHeader(String header)(Code)



setQueryTimeout
public void setQueryTimeout(int value)(Code)



setReadOnly
public void setReadOnly(boolean aFlag)(Code)



setShowLoadProcess
public void setShowLoadProcess(boolean aFlag)(Code)



setSortDefinition
public void setSortDefinition(NamedSortDefinition sort)(Code)



setStatusMessage
public void setStatusMessage(String aMsg)(Code)
Show a message in the status panel.
See Also:   DwStatusBar.setStatusMessage(String)



setUpdateHandler
public void setUpdateHandler(DbUpdater aDelegate)(Code)
Sets the handler which performs the update to the database. This delegate is passed to the UpdateDatabaseAction. The action will in turn call the delegate's saveChangesToDatabase() method instead of ours.
See Also:   workbench.interfaces.DbUpdater.saveChangesToDatabase
See Also:   DwPanel.saveChangesToDatabase()
See Also:   workbench.gui.sql.SqlPanel.saveChangesToDatabase



setUpdateTable
public void setUpdateTable(TableIdentifier table)(Code)
Define the update table to be used.
See Also:   workbench.storage.DataStore.setUpdateTable(TableIdentifier)



setUpdateTableToBeUsed
public void setUpdateTableToBeUsed(TableIdentifier table)(Code)
Pass the table to be used for future updates to the underlying DataStore. This will also reset the internal cache of the ReferenceTableNavigator.
See Also:   workbench.gui.sql.ReferenceTableNavigator.reset
See Also:   workbench.storage.DataStore.setUpdateTableToBeUsed(workbench.db.TableIdentifier)



shouldSaveChanges
public boolean shouldSaveChanges(WbConnection aConnection)(Code)



showData
public void showData(StatementRunnerResult result) throws SQLException(Code)
Display any result set that is contained in the StatementRunnerResult.
Parameters:
  result - the result from the workbench.interfaces.StatementRunner to be displayed
See Also:   workbench.sql.DefaultStatementRunner



showData
public void showData(ResultSet result, String sql) throws SQLException(Code)



showData
public void showData(DataStore newData, String statement) throws SQLException(Code)



showError
public void showError(String error)(Code)



showlastExecutionTime
public void showlastExecutionTime()(Code)
Displays the last execution time in the status bar



startEdit
public boolean startEdit()(Code)



startEdit
public boolean startEdit(boolean restoreSelection)(Code)
Starts the "edit" mode of the table. It will not start the edit mode, if the table is "read only" meaning if no update table (=database table) is defined. The following actions are carried out:
  • if the updateable flag is not yet set, try to find out which table to update
  • the status column is displayec
  • the corresponding actions (insert row, delete row) are enabled
  • the startEdit action is turned to "switched on"

Parameters:
  restoreSelection - if true the selected rows before starting the edit mode are restored



stateChanged
public void stateChanged(ChangeEvent e)(Code)
Called from the viewport, when the display has been scrolled We need to update the row display then.



tableChanged
public void tableChanged(TableModelEvent e)(Code)
If the user changes something in the result set (which is possible, as the table defaults to beeing editable) the edit mode (with status column and the different actions enabled) is switched on automatically.



updateStatusBar
public void updateStatusBar()(Code)



valueChanged
public void valueChanged(ListSelectionEvent e)(Code)
This is called when the selection in the table changes. The copy row action will be enabled when exactly one row is selected



Methods inherited from javax.swing.JPanel
public AccessibleContext getAccessibleContext()(Code)(Java Doc)
public PanelUI getUI()(Code)(Java Doc)
public String getUIClassID()(Code)(Java Doc)
protected String paramString()(Code)(Java Doc)
public void setUI(PanelUI ui)(Code)(Java Doc)
public void updateUI()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.