Source Code Cross Referenced for SQLStatementRecallDialog.java in  » Database-Client » JSqlTool » org » jsqltool » 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 » JSqlTool » org.jsqltool.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jsqltool.gui;
002:
003:        import java.awt.*;
004:        import javax.swing.*;
005:        import java.awt.event.*;
006:        import java.util.*;
007:        import org.jsqltool.model.*;
008:        import org.jsqltool.conn.DbConnectionUtil;
009:        import org.jsqltool.utils.Options;
010:        import org.jsqltool.utils.ImageLoader;
011:
012:        /**
013:         * <p>Title: JSqlTool Project</p>
014:         * <p>Description: Dialog used to select an old query.
015:         * </p>
016:         * <p>Copyright: Copyright (C) 2006 Mauro Carniel</p>
017:         *
018:         * <p> This file is part of JSqlTool project.
019:         * This library is free software; you can redistribute it and/or
020:         * modify it under the terms of the (LGPL) Lesser General Public
021:         * License as published by the Free Software Foundation;
022:         *
023:         *                GNU LESSER GENERAL PUBLIC LICENSE
024:         *                 Version 2.1, February 1999
025:         *
026:         * This library is distributed in the hope that it will be useful,
027:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
028:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
029:         * Library General Public License for more details.
030:         *
031:         * You should have received a copy of the GNU Library General Public
032:         * License along with this library; if not, write to the Free
033:         * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
034:         *
035:         *       The author may be contacted at:
036:         *           maurocarniel@tin.it</p>
037:         *
038:         * @author Mauro Carniel
039:         * @version 1.0
040:         */
041:        public class SQLStatementRecallDialog extends JDialog {
042:            JPanel mainPanel = new JPanel();
043:            BorderLayout borderLayout1 = new BorderLayout();
044:            JPanel centerPanel = new JPanel();
045:            JPanel buttonsPanel = new JPanel();
046:            JButton cancelButton = new JButton();
047:            JButton okButton = new JButton();
048:            JScrollPane scrollPane = new JScrollPane();
049:            BorderLayout borderLayout2 = new BorderLayout();
050:            CustomTableModel model = new CustomTableModel(
051:                    new String[] { "SQL" }, new Class[] { String.class });
052:            JTable oldQueries = new JTable(model);
053:            private SQLFrame frame = null;
054:
055:            public SQLStatementRecallDialog(JFrame parent,
056:                    DbConnectionUtil dbConnUtil, SQLFrame frame) {
057:                super (parent, Options.getInstance().getResource(
058:                        "old sql statements"), true);
059:                this .frame = frame;
060:                try {
061:                    jbInit();
062:                    Dimension frameSize = new Dimension(750, 400);
063:                    setSize(frameSize);
064:                    Dimension screenSize = parent.getSize();
065:                    if (frameSize.height > screenSize.height) {
066:                        frameSize.height = screenSize.height;
067:                    }
068:                    if (frameSize.width > screenSize.width) {
069:                        frameSize.width = screenSize.width;
070:                    }
071:                    setLocation((screenSize.width - frameSize.width) / 2,
072:                            (screenSize.height - frameSize.height) / 2);
073:                    init(dbConnUtil);
074:                } catch (Exception ex) {
075:                    ex.printStackTrace();
076:                }
077:            }
078:
079:            public SQLStatementRecallDialog() {
080:                this (null, null, null);
081:            }
082:
083:            private void init(DbConnectionUtil dbConnUtil) {
084:                ArrayList oldQueries = dbConnUtil.getDbConnection()
085:                        .getOldQueries();
086:                model.setEditMode(model.DETAIL_REC);
087:                for (int i = 0; i < oldQueries.size(); i++)
088:                    model.addRow(new Object[] { oldQueries.get(i).toString() });
089:            }
090:
091:            private void jbInit() throws Exception {
092:                mainPanel.setLayout(borderLayout1);
093:                cancelButton.setMnemonic(Options.getInstance().getResource(
094:                        "cancelbutton.mnemonic").charAt(0));
095:                cancelButton.setText(Options.getInstance().getResource(
096:                        "cancelbutton.text"));
097:                cancelButton
098:                        .addActionListener(new SQLStatementRecallDialog_cancelButton_actionAdapter(
099:                                this ));
100:                okButton.setMnemonic(Options.getInstance().getResource(
101:                        "okbutton.mnemonic").charAt(0));
102:                okButton.setText(Options.getInstance().getResource(
103:                        "okbutton.text"));
104:                okButton
105:                        .addActionListener(new SQLStatementRecallDialog_okButton_actionAdapter(
106:                                this ));
107:                buttonsPanel.setBorder(BorderFactory.createEtchedBorder());
108:                centerPanel.setLayout(borderLayout2);
109:                oldQueries
110:                        .addMouseListener(new SQLStatementRecallDialog_oldQueries_mouseAdapter(
111:                                this ));
112:                getContentPane().add(mainPanel);
113:                mainPanel.add(centerPanel, BorderLayout.CENTER);
114:                centerPanel.add(scrollPane, BorderLayout.CENTER);
115:                mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
116:                buttonsPanel.add(okButton, null);
117:                buttonsPanel.add(cancelButton, null);
118:                scrollPane.getViewport().add(oldQueries, null);
119:            }
120:
121:            void cancelButton_actionPerformed(ActionEvent e) {
122:                setVisible(false);
123:                dispose();
124:            }
125:
126:            void okButton_actionPerformed(ActionEvent e) {
127:                if (oldQueries.getSelectedRow() != -1) {
128:                    frame.setEditorContent(oldQueries.getValueAt(
129:                            oldQueries.getSelectedRow(), 0).toString());
130:                    setVisible(false);
131:                    dispose();
132:                }
133:            }
134:
135:            void oldQueries_mouseClicked(MouseEvent e) {
136:                if (e.getClickCount() == 2) {
137:                    okButton_actionPerformed(null);
138:                }
139:            }
140:        }
141:
142:        class SQLStatementRecallDialog_cancelButton_actionAdapter implements 
143:                java.awt.event.ActionListener {
144:            SQLStatementRecallDialog adaptee;
145:
146:            SQLStatementRecallDialog_cancelButton_actionAdapter(
147:                    SQLStatementRecallDialog adaptee) {
148:                this .adaptee = adaptee;
149:            }
150:
151:            public void actionPerformed(ActionEvent e) {
152:                adaptee.cancelButton_actionPerformed(e);
153:            }
154:        }
155:
156:        class SQLStatementRecallDialog_okButton_actionAdapter implements 
157:                java.awt.event.ActionListener {
158:            SQLStatementRecallDialog adaptee;
159:
160:            SQLStatementRecallDialog_okButton_actionAdapter(
161:                    SQLStatementRecallDialog adaptee) {
162:                this .adaptee = adaptee;
163:            }
164:
165:            public void actionPerformed(ActionEvent e) {
166:                adaptee.okButton_actionPerformed(e);
167:            }
168:        }
169:
170:        class SQLStatementRecallDialog_oldQueries_mouseAdapter extends
171:                java.awt.event.MouseAdapter {
172:            SQLStatementRecallDialog adaptee;
173:
174:            SQLStatementRecallDialog_oldQueries_mouseAdapter(
175:                    SQLStatementRecallDialog adaptee) {
176:                this .adaptee = adaptee;
177:            }
178:
179:            public void mouseClicked(MouseEvent e) {
180:                adaptee.oldQueries_mouseClicked(e);
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.