Source Code Cross Referenced for DriverEditorDialog.java in  » Database-Client » SQL-Workbench » workbench » gui » profiles » 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.profiles 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DriverEditorDialog.java
003:         *
004:         * This file is part of SQL Workbench/J, http://www.sql-workbench.net
005:         *
006:         * Copyright 2002-2008, Thomas Kellerer
007:         * No part of this code maybe reused without the permission of the author
008:         *
009:         * To contact the author please send an email to: support@sql-workbench.net
010:         *
011:         */
012:        package workbench.gui.profiles;
013:
014:        import java.awt.BorderLayout;
015:        import java.awt.Dimension;
016:        import java.awt.EventQueue;
017:        import java.awt.FlowLayout;
018:        import java.awt.Frame;
019:        import java.awt.event.ActionEvent;
020:        import java.awt.event.ActionListener;
021:        import java.awt.event.WindowAdapter;
022:        import java.awt.event.WindowEvent;
023:
024:        import javax.swing.ActionMap;
025:        import javax.swing.InputMap;
026:        import javax.swing.JButton;
027:        import javax.swing.JComponent;
028:        import javax.swing.JDialog;
029:        import javax.swing.JPanel;
030:        import javax.swing.border.EtchedBorder;
031:
032:        import workbench.gui.actions.EscAction;
033:        import workbench.gui.components.WbButton;
034:        import workbench.resource.ResourceMgr;
035:        import workbench.resource.Settings;
036:
037:        public class DriverEditorDialog extends JDialog implements 
038:                ActionListener {
039:            private JPanel dummyPanel;
040:            private JPanel buttonPanel;
041:            private JButton okButton;
042:            private DriverlistEditorPanel driverListPanel;
043:            private JButton cancelButton;
044:            private boolean cancelled = true;
045:            private EscAction escAction;
046:
047:            public DriverEditorDialog(Frame parent) {
048:                super (parent, true);
049:                initComponents();
050:
051:                this .getRootPane().setDefaultButton(this .okButton);
052:                InputMap im = this .getRootPane().getInputMap(
053:                        JComponent.WHEN_IN_FOCUSED_WINDOW);
054:                ActionMap am = this .getRootPane().getActionMap();
055:                escAction = new EscAction(this );
056:                escAction.addToInputMap(im, am);
057:
058:                if (!Settings.getInstance().restoreWindowSize(this )) {
059:                    this .setSize(600, 400);
060:                }
061:                driverListPanel.restoreSettings();
062:
063:                // when invoked from the connection dialog, it seems that under
064:                // Linux the dialog is not visible (because it's behind the connection
065:                // dialog), so we're trying to make this window visible
066:                EventQueue.invokeLater(new Runnable() {
067:                    public void run() {
068:                        toFront();
069:                        requestFocus();
070:                    }
071:                });
072:            }
073:
074:            private void initComponents() {
075:                driverListPanel = new workbench.gui.profiles.DriverlistEditorPanel();
076:                buttonPanel = new JPanel();
077:                okButton = new WbButton(ResourceMgr
078:                        .getString(ResourceMgr.TXT_OK));
079:                cancelButton = new WbButton(ResourceMgr
080:                        .getString(ResourceMgr.TXT_CANCEL));
081:                dummyPanel = new JPanel();
082:
083:                setTitle(ResourceMgr.getString("TxtDriverEditorWindowTitle"));
084:                setModal(true);
085:                setName("DriverEditorDialog");
086:                addWindowListener(new WindowAdapter() {
087:                    public void windowClosing(WindowEvent evt) {
088:                        closeDialog(evt);
089:                    }
090:                });
091:
092:                driverListPanel.setBorder(new EtchedBorder());
093:                getContentPane().add(driverListPanel, BorderLayout.CENTER);
094:
095:                buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
096:
097:                okButton.setFont(null);
098:                okButton.addActionListener(this );
099:                buttonPanel.add(okButton);
100:
101:                cancelButton.addActionListener(this );
102:                buttonPanel.add(cancelButton);
103:
104:                getContentPane().add(buttonPanel, BorderLayout.SOUTH);
105:
106:                dummyPanel.setMaximumSize(new Dimension(2, 2));
107:                dummyPanel.setMinimumSize(new Dimension(1, 1));
108:                dummyPanel.setPreferredSize(new Dimension(2, 2));
109:                getContentPane().add(dummyPanel, BorderLayout.NORTH);
110:
111:            }
112:
113:            public void actionPerformed(ActionEvent e) {
114:                if (e.getSource() == okButton) {
115:                    okButtonActionPerformed(e);
116:                } else if (e.getSource() == cancelButton
117:                        || e.getActionCommand().equals(
118:                                escAction.getActionName())) {
119:                    cancelButtonActionPerformed(e);
120:                }
121:            }
122:
123:            private void cancelButtonActionPerformed(ActionEvent evt) {
124:                this .cancelled = true;
125:                this .closeDialog();
126:            }
127:
128:            /**
129:             *	Sets the driver name to be pre-selected in the list
130:             */
131:            public void setDriverName(String name) {
132:                if (this .driverListPanel != null && name != null) {
133:                    this .driverListPanel.selectDriver(name);
134:                }
135:            }
136:
137:            private void okButtonActionPerformed(ActionEvent evt) {
138:                try {
139:                    this .driverListPanel.saveItem();
140:                    this .cancelled = false;
141:                    this .closeDialog();
142:                } catch (Exception e) {
143:                    e.printStackTrace();
144:                }
145:            }
146:
147:            public boolean isCancelled() {
148:                return this .cancelled;
149:            }
150:
151:            /** Closes the dialog */
152:            private void closeDialog(WindowEvent evt) {
153:                this .closeDialog();
154:            }
155:
156:            public void closeDialog() {
157:                Settings.getInstance().storeWindowSize(this );
158:                driverListPanel.saveSettings();
159:                setVisible(false);
160:                dispose();
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.