Source Code Cross Referenced for SQLLogUI.java in  » Database-Client » DBBrowser » org » dbbrowser » ui » 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 » DBBrowser » org.dbbrowser.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser.ui;
002:
003:        import infrastructure.propertymanager.PropertyManager;
004:        import infrastructure.internationalization.InternationalizationManager;
005:        import javax.swing.*;
006:        import java.util.Observable;
007:        import java.util.Observer;
008:        import java.util.List;
009:        import java.util.ArrayList;
010:        import java.awt.event.ActionListener;
011:        import java.awt.event.ActionEvent;
012:        import org.dbbrowser.db.engine.SQLLog;
013:        import org.dbbrowser.ui.widget.Button;
014:        import org.dbbrowser.ui.panel.ButtonsPanel;
015:
016:        /**
017:         * Displays a log of all SQL statements
018:         */
019:        public class SQLLogUI implements  Observer, ActionListener {
020:            private static final String SQL_LOG_ICON_FILENAME = PropertyManager
021:                    .getInstance().getProperty(
022:                            "dbbrowser-ui-sql-log-window-icon");
023:            private static final String CLEAR_SQL_LOG_ICON_FILENAME = PropertyManager
024:                    .getInstance()
025:                    .getProperty(
026:                            "dbbrowser-ui-sql-log-window-clear-log-button-icon");
027:
028:            private static final String SQL_LOG_WINDOW_TITLE = InternationalizationManager
029:                    .getInstance().getMessage("dbbrowser-ui",
030:                            "dbbrowser-ui-sql-log-window-title", null);
031:            private static final String SQL_LOG_CLEAR_BUTTON_LABEL = InternationalizationManager
032:                    .getInstance()
033:                    .getMessage(
034:                            "dbbrowser-ui",
035:                            "dbbrowser-ui-sql-log-window-clear-log-button-label",
036:                            null);
037:
038:            private JFrame frame = new JFrame();
039:            private JTextArea sqlLog = new JTextArea();
040:            private JScrollPane paneForSQL = null;
041:
042:            /**
043:             * Constructer
044:             */
045:            public SQLLogUI() {
046:                initialize();
047:            }
048:
049:            /**
050:             * Show the UI
051:             */
052:            public void show() {
053:                this .frame.show();
054:            }
055:
056:            //Hide the SQL Logger UI
057:            public void hide() {
058:                this .frame.hide();
059:            }
060:
061:            /**
062:             * Called by the observable to inform the observer when a change occurs
063:             * @param observable
064:             * @param args
065:             */
066:            public void update(Observable observable, Object args) {
067:                sqlLog.append(args.toString() + "\n\n");
068:                this .paneForSQL.getVerticalScrollBar()
069:                        .setValue(
070:                                this .paneForSQL.getVerticalScrollBar()
071:                                        .getMaximum() + 1000);
072:            }
073:
074:            public void actionPerformed(ActionEvent e) {
075:                this .sqlLog.setText("");
076:            }
077:
078:            private void initialize() {
079:                //Setup the frame
080:                this .frame.setTitle(SQL_LOG_WINDOW_TITLE);
081:                this .frame.setSize(700, 300);
082:                this .frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
083:                this .frame.setIconImage((new ImageIcon(SQL_LOG_ICON_FILENAME))
084:                        .getImage());
085:                this .frame.toBack();
086:
087:                //Setup the widgets
088:                this .frame.getContentPane().setLayout(
089:                        new BoxLayout(this .frame.getContentPane(),
090:                                BoxLayout.PAGE_AXIS));
091:                this .sqlLog.setEditable(false);
092:                this .sqlLog.setLineWrap(true);
093:                this .paneForSQL = new JScrollPane(this .sqlLog);
094:                paneForSQL
095:                        .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
096:                this .frame.getContentPane().add(paneForSQL);
097:
098:                //Add the button to clear the log
099:                Button buttonToClearSQLLog = new Button(
100:                        SQL_LOG_CLEAR_BUTTON_LABEL, this ,
101:                        SQL_LOG_CLEAR_BUTTON_LABEL, new ImageIcon(
102:                                CLEAR_SQL_LOG_ICON_FILENAME), Boolean.FALSE);
103:                List listOfButtons = new ArrayList();
104:                listOfButtons.add(buttonToClearSQLLog);
105:                ButtonsPanel buttonsPanel = new ButtonsPanel(listOfButtons);
106:                this .frame.getContentPane().add(buttonsPanel);
107:
108:                //Add the UI as an observor to the SQLLog
109:                SQLLog.getInstance().addObserver(this);
110:            }
111:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.