Source Code Cross Referenced for ConfigConnectionView.java in  » Database-Client » ViennaSQL » uk » co » whisperingwind » vienna » 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 » ViennaSQL » uk.co.whisperingwind.vienna 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         ** $Id: ConfigConnectionView.java,v 1.7 2000/10/21 14:37:18 mrw Exp $
003:         **
004:         ** Dialog to edit the details of one connection.
005:         **
006:         ** Mike Wilson, July 2000, mrw@whisperingwind.co.uk
007:         **
008:         ** (C) Copyright 2000, Mike Wilson, Reading, Berkshire, UK
009:         **
010:         ** This program is free software; you can redistribute it and/or modify
011:         ** it under the terms of the GNU General Public License as published by
012:         ** the Free Software Foundation; either version 2 of the License, or
013:         ** (at your option) any later version.
014:         ** 
015:         ** This program is distributed in the hope that it will be useful,
016:         ** but WITHOUT ANY WARRANTY; without even the implied warranty of
017:         ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
018:         ** GNU General Public License for more details.
019:         ** 
020:         ** You should have received a copy of the GNU Library General
021:         ** Public License along with this library; if not, write to the
022:         ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         ** Boston, MA  02111-1307  USA.
024:         */
025:
026:        package uk.co.whisperingwind.vienna;
027:
028:        import java.awt.BorderLayout;
029:        import java.awt.GridBagConstraints;
030:        import java.awt.GridBagLayout;
031:        import java.awt.Insets;
032:        import javax.swing.JButton;
033:        import javax.swing.JFrame;
034:        import javax.swing.JLabel;
035:        import javax.swing.JPanel;
036:        import javax.swing.JTextField;
037:        import uk.co.whisperingwind.framework.ActionFactory;
038:        import uk.co.whisperingwind.framework.ModelEvent;
039:        import uk.co.whisperingwind.framework.PanelDialogView;
040:
041:        class ConfigConnectionView extends PanelDialogView {
042:            private ActionFactory.DefaultAction okAction = null;
043:            private ActionFactory.DefaultAction cancelAction = null;
044:            private ActionFactory.DefaultAction testAction = null;
045:            private String originalName;
046:            private JTextField textName = new JTextField(16);
047:            private JTextField textDriverClass = new JTextField(32);
048:            private JTextField textUrl = new JTextField(32);
049:            private JTextField textUserName = new JTextField(32);
050:            private JTextField textPassword = new JTextField(32);
051:
052:            public ConfigConnectionView(JFrame parent, boolean modal) {
053:                super (parent, modal);
054:                createActions();
055:
056:                panel.add(new ConnectionPanel(), BorderLayout.CENTER);
057:
058:                JButton okButton = okAction.toolButtonFactory(buttonPanel);
059:                cancelAction.toolButtonFactory(buttonPanel);
060:                testAction.toolButtonFactory(buttonPanel);
061:
062:                content.pack();
063:                content.setResizable(false);
064:                content.getRootPane().setDefaultButton(okButton);
065:            }
066:
067:            /*
068:             ** Set the original name of the connection. If the name is null, I
069:             ** assume I am creating a new connection and clear out all fields.
070:             */
071:
072:            public void setOriginalName(String name) {
073:                originalName = name;
074:
075:                if (originalName == null) {
076:                    content.setTitle("New connection");
077:                    textName.setText("Untitled");
078:
079:                    textDriverClass.setText("");
080:                    textUrl.setText("");
081:                    textUserName.setText("");
082:                    textPassword.setText("");
083:                } else {
084:                    textName.setText(originalName);
085:                    content.setTitle("Edit connection " + originalName);
086:                }
087:            }
088:
089:            /*
090:             ** Set the name of the connection.
091:             */
092:
093:            public void setName(String name) {
094:                textName.setText(name);
095:                textName.requestFocus();
096:            }
097:
098:            /*
099:             ** Set the driver class of the connection.
100:             */
101:
102:            public void setDriverClass(String driverClass) {
103:                textDriverClass.setText(driverClass);
104:            }
105:
106:            /*
107:             ** Set the URL of the connection.
108:             */
109:
110:            public void setUrl(String url) {
111:                textUrl.setText(url);
112:            }
113:
114:            /*
115:             ** Set the user name of the connection.
116:             */
117:
118:            public void setUserName(String userName) {
119:                textUserName.setText(userName);
120:            }
121:
122:            /*
123:             ** Set the password of the connection.
124:             */
125:
126:            public void setPassword(String password) {
127:                textPassword.setText(password);
128:            }
129:
130:            public String getOriginalName() {
131:                return originalName;
132:            }
133:
134:            public String getName() {
135:                return textName.getText();
136:            }
137:
138:            public String getUserName() {
139:                return textUserName.getText();
140:            }
141:
142:            public String getPassword() {
143:                return textPassword.getText();
144:            }
145:
146:            public String getDriverClass() {
147:                return textDriverClass.getText();
148:            }
149:
150:            public String getUrl() {
151:                return textUrl.getText();
152:            }
153:
154:            protected void modelEvent(ModelEvent event) {
155:            }
156:
157:            protected void cleanUp() {
158:            }
159:
160:            /*
161:             ** Create the Action instances used by this dialog.
162:             */
163:
164:            private void createActions() {
165:                ConfigActionFactory factory = new ConfigActionFactory(
166:                        "/uk/co/whisperingwind/images");
167:
168:                okAction = factory.createAction("ok");
169:                cancelAction = factory.createAction("cancel");
170:                testAction = factory.createAction("test");
171:
172:                okAction.addActionListener(actionListener);
173:                cancelAction.addActionListener(actionListener);
174:                testAction.addActionListener(actionListener);
175:            }
176:
177:            /*
178:             ** Panel containing the connection details.
179:             */
180:
181:            private class ConnectionPanel extends JPanel {
182:                public ConnectionPanel() {
183:                    setLayout(new GridBagLayout());
184:                    GridBagConstraints constraints = new GridBagConstraints();
185:
186:                    constraints.anchor = GridBagConstraints.WEST;
187:                    constraints.insets = new Insets(4, 4, 4, 4);
188:                    constraints.fill = GridBagConstraints.NONE;
189:                    constraints.gridwidth = 1;
190:                    constraints.weightx = 0.0;
191:                    constraints.weighty = 0.0;
192:                    add(new JLabel("Connection name"), constraints);
193:
194:                    constraints.gridwidth = GridBagConstraints.REMAINDER;
195:                    constraints.fill = GridBagConstraints.NONE;
196:                    constraints.weightx = 1.0;
197:                    add(textName, constraints);
198:
199:                    constraints.gridwidth = 1;
200:                    constraints.fill = GridBagConstraints.NONE;
201:                    constraints.weightx = 0.0;
202:                    add(new JLabel("Driver class"), constraints);
203:
204:                    constraints.gridwidth = GridBagConstraints.REMAINDER;
205:                    constraints.fill = GridBagConstraints.HORIZONTAL;
206:                    constraints.weightx = 1.0;
207:                    add(textDriverClass, constraints);
208:
209:                    constraints.gridwidth = 1;
210:                    constraints.fill = GridBagConstraints.NONE;
211:                    constraints.weightx = 0.0;
212:                    add(new JLabel("URL"), constraints);
213:
214:                    constraints.gridwidth = GridBagConstraints.REMAINDER;
215:                    constraints.fill = GridBagConstraints.HORIZONTAL;
216:                    constraints.weightx = 1.0;
217:                    add(textUrl, constraints);
218:
219:                    constraints.gridwidth = 1;
220:                    constraints.fill = GridBagConstraints.NONE;
221:                    constraints.weightx = 0.0;
222:                    add(new JLabel("User name"), constraints);
223:
224:                    constraints.gridwidth = GridBagConstraints.REMAINDER;
225:                    constraints.fill = GridBagConstraints.NONE;
226:                    constraints.weightx = 1.0;
227:                    add(textUserName, constraints);
228:
229:                    constraints.gridwidth = 1;
230:                    constraints.fill = GridBagConstraints.NONE;
231:                    constraints.weightx = 0.0;
232:                    add(new JLabel("Password"), constraints);
233:
234:                    constraints.gridwidth = GridBagConstraints.REMAINDER;
235:                    constraints.fill = GridBagConstraints.NONE;
236:                    constraints.weightx = 1.0;
237:                    add(textPassword, constraints);
238:                }
239:            }
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.