Source Code Cross Referenced for ToolbarPanel.java in  » Database-Client » SQL-Profiler » org » jahia » sqlprofiler » gui » 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 Profiler » org.jahia.sqlprofiler.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) Jahia Ltd. All rights reserved.
003:         *
004:         * This software is published under the terms of the Jahia Open Software
005:         * License version 1.1, a copy of which has been included with this
006:         * distribution in the LICENSE.txt file.
007:         */
008:        package org.jahia.sqlprofiler.gui;
009:
010:        import java.awt.*;
011:        import javax.swing.JPanel;
012:        import javax.swing.JToolBar;
013:        import javax.swing.JButton;
014:        import javax.swing.Icon;
015:        import javax.swing.ImageIcon;
016:        import javax.swing.JFileChooser;
017:        import java.net.URL;
018:        import java.io.InputStream;
019:        import java.io.IOException;
020:        import java.awt.event.ActionListener;
021:        import java.awt.event.ActionEvent;
022:
023:        /**
024:         * <p>Title: SQL Profiler</p>
025:         * <p>Description: </p>
026:         * <p>Copyright: Copyright (c) 2003</p>
027:         * <p>Company: Jahia Ltd</p>
028:         * @author Serge Huber
029:         * @author Jean-Philippe Valentin
030:         * @version 1.0
031:         *
032:         * 11/14/2003 : Add button to save table profile statistics as report file CSV by Jean-Philippe VALENTIN (JPV)
033:         */
034:
035:        public class ToolbarPanel extends JPanel {
036:            private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger
037:                    .getLogger(ToolbarPanel.class);
038:
039:            BorderLayout borderLayout1 = new BorderLayout();
040:
041:            private JButton playButton;
042:            private JButton pauseButton;
043:            private JButton reportButton; //jpv : Add a button to save SQL table profile statistics generated in a file
044:            private boolean playing = true;
045:
046:            private LoggerTableModel loggerModel;
047:            private ProfileStatementTableModel profileStatementTableModel;
048:
049:            public ToolbarPanel(LoggerTableModel loggerModel,
050:                    ProfileStatementTableModel profileStatementTableModel) {
051:                this .loggerModel = loggerModel;
052:                this .profileStatementTableModel = profileStatementTableModel;
053:                try {
054:                    jbInit();
055:                } catch (Exception ex) {
056:                    ex.printStackTrace();
057:                }
058:            }
059:
060:            void jbInit() throws Exception {
061:                this .setLayout(borderLayout1);
062:                JToolBar toolbar = new JToolBar();
063:                java.net.URL saveAsIconURL = ClassLoader
064:                        .getSystemResource("toolbarButtonGraphics/general/SaveAs16.gif");
065:                Icon saveAsIcon = new ImageIcon(saveAsIconURL, "Save As");
066:                JButton myButton = new JButton(saveAsIcon);
067:                myButton
068:                        .setToolTipText("Save the generated SQL INDEX File as...");
069:                myButton.addActionListener(new ActionListener() {
070:                    public void actionPerformed(ActionEvent aEvent) {
071:                        JFileChooser chooser = new JFileChooser();
072:                        // Note: source for ExampleFileFilter can be found in FileChooserDemo,
073:                        // under the demo/jfc directory in the Java 2 SDK, Standard Edition.
074:                        chooser.setDialogTitle("Save Index SQL File As...");
075:                        int returnVal = chooser.showSaveDialog(null);
076:                        if (returnVal == JFileChooser.APPROVE_OPTION) {
077:                            profileStatementTableModel.saveSQLIndexFile(chooser
078:                                    .getSelectedFile().toString());
079:                        }
080:                    }
081:                });
082:                toolbar.add(myButton);
083:                toolbar.addSeparator();
084:                java.net.URL clearIconURL = ClassLoader
085:                        .getSystemResource("toolbarButtonGraphics/general/Delete16.gif");
086:                Icon clearIcon = new ImageIcon(clearIconURL, "Clear");
087:                myButton = new JButton(clearIcon);
088:                myButton
089:                        .setToolTipText("Clear all the log entries from memory");
090:                myButton.addActionListener(new ActionListener() {
091:                    public void actionPerformed(ActionEvent aEvent) {
092:                        loggerModel.clear();
093:                    }
094:                });
095:                toolbar.add(myButton);
096:                toolbar.addSeparator();
097:                java.net.URL playIconURL = ClassLoader
098:                        .getSystemResource("toolbarButtonGraphics/media/Play16.gif");
099:                Icon playIcon = new ImageIcon(playIconURL, "Play");
100:                playButton = new JButton(playIcon);
101:                playButton.setEnabled(false);
102:                playButton
103:                        .setToolTipText("Resume real-time display and gather SQL statistics");
104:                playButton.addActionListener(new ActionListener() {
105:                    public void actionPerformed(ActionEvent aEvent) {
106:                        loggerModel.toggle();
107:                        togglePlayButtons();
108:                    }
109:                });
110:                toolbar.add(playButton);
111:                java.net.URL pauseIconURL = ClassLoader
112:                        .getSystemResource("toolbarButtonGraphics/media/Pause16.gif");
113:                Icon pauseIcon = new ImageIcon(pauseIconURL, "Pause");
114:                pauseButton = new JButton(pauseIcon);
115:                pauseButton
116:                        .setToolTipText("Pause real-time display and display SQL table profile statistics");
117:                pauseButton.addActionListener(new ActionListener() {
118:                    public void actionPerformed(ActionEvent aEvent) {
119:                        loggerModel.toggle();
120:                        togglePlayButtons();
121:                    }
122:                });
123:                toolbar.add(pauseButton);
124:                // JPV Add a button to save SQL table profile statistics generated in a file
125:                java.net.URL reportIconURL = ClassLoader
126:                        .getSystemResource("toolbarButtonGraphics/general/Edit16.gif");
127:                Icon reportIcon = new ImageIcon(reportIconURL, "Report");
128:                reportButton = new JButton(reportIcon);
129:                reportButton.setEnabled(false);
130:                reportButton
131:                        .setToolTipText("Save SQL table profile statistics generated in a file ...");
132:                reportButton.addActionListener(new ActionListener() {
133:                    public void actionPerformed(ActionEvent aEvent) {
134:                        JFileChooser chooser = new JFileChooser();
135:                        // Note: source for ExampleFileFilter can be found in FileChooserDemo,
136:                        // under the demo/jfc directory in the Java 2 SDK, Standard Edition.
137:                        chooser.setDialogTitle("Save Report File As...");
138:                        int returnVal = chooser.showSaveDialog(null);
139:                        if (returnVal == JFileChooser.APPROVE_OPTION) {
140:                            profileStatementTableModel.saveReportFile(chooser
141:                                    .getSelectedFile().toString());
142:                        }
143:                    }
144:                });
145:                toolbar.addSeparator();
146:                toolbar.add(reportButton);
147:                //End JPV
148:                add(toolbar, BorderLayout.NORTH);
149:            }
150:
151:            public void togglePlayButtons() {
152:                playing = !playing;
153:                if (playing) {
154:                    playButton.setEnabled(false);
155:                    pauseButton.setEnabled(true);
156:                    reportButton.setEnabled(false); //JPV : set to false the button to save SQL table profile statistics generated in a file
157:                } else {
158:                    playButton.setEnabled(true);
159:                    pauseButton.setEnabled(false);
160:                    reportButton.setEnabled(true); //JPV : set to true the button to save SQL table profile statistics generated in a file
161:                }
162:            }
163:
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.