Source Code Cross Referenced for TCPIPClientSSLSettingsWizardPage.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » ui » componentflow » componentFlowEditor » diagram » wizards » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id$
023:         */
024:        package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
025:
026:        import java.util.Map;
027:
028:        import org.eclipse.jface.dialogs.Dialog;
029:        import org.eclipse.jface.dialogs.IDialogConstants;
030:        import org.eclipse.swt.SWT;
031:        import org.eclipse.swt.events.SelectionAdapter;
032:        import org.eclipse.swt.events.SelectionEvent;
033:        import org.eclipse.swt.graphics.Point;
034:        import org.eclipse.swt.layout.GridData;
035:        import org.eclipse.swt.layout.GridLayout;
036:        import org.eclipse.swt.widgets.Button;
037:        import org.eclipse.swt.widgets.Combo;
038:        import org.eclipse.swt.widgets.Composite;
039:        import org.eclipse.swt.widgets.Control;
040:        import org.eclipse.swt.widgets.Label;
041:        import org.eclipse.swt.widgets.Shell;
042:        import org.eclipse.swt.widgets.Text;
043:        import org.eclipse.ui.PlatformUI;
044:        import org.eclipse.ui.part.FileEditorInput;
045:
046:        import com.bostechcorp.cbesb.common.i18n.I18N;
047:        import com.bostechcorp.cbesb.common.i18n.Messages;
048:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditorPlugin;
049:        import com.bostechcorp.cbesb.ui.util.browser.BaseFileBrowser;
050:
051:        public class TCPIPClientSSLSettingsWizardPage extends Dialog {
052:            private Text truststorefilePassword;
053:            private Text text;
054:
055:            private Text textPassword;
056:
057:            private Text textKeystoreFile;
058:
059:            private Combo combo;
060:
061:            private Button keyFileBrowseButton;
062:
063:            private Button browseButton;
064:
065:            private Button allowAnonymousButton;
066:
067:            private Button usePrivateKeyButton;
068:
069:            private Button buttonAuthenticateServer;
070:
071:            private Button buttonUseDefaultTruststore;
072:
073:            private Map<String, String> sslMap;
074:
075:            private boolean updateOperation = false;
076:
077:            protected TCPIPClientSSLSettingsWizardPage(Shell parentShell,
078:                    Map<String, String> sslMap, boolean updateOperation) {
079:                super (parentShell);
080:                this .sslMap = sslMap;
081:                this .updateOperation = updateOperation;
082:            }
083:
084:            protected Control createDialogArea(Composite parent) {
085:                final Composite topLevel = new Composite(parent, SWT.NONE);
086:                final GridLayout gridLayout = new GridLayout();
087:                gridLayout.horizontalSpacing = 10;
088:                topLevel.setLayout(gridLayout);
089:                topLevel.setLayoutData(new GridData(
090:                        GridData.VERTICAL_ALIGN_FILL
091:                                | GridData.HORIZONTAL_ALIGN_FILL));
092:                topLevel.setFont(parent.getFont());
093:
094:                final Composite sslModeComposite = new Composite(topLevel,
095:                        SWT.NONE);
096:                sslModeComposite.setLayoutData(new GridData(SWT.FILL,
097:                        SWT.CENTER, true, false));
098:                final GridLayout gridLayout_3 = new GridLayout();
099:                gridLayout_3.numColumns = 2;
100:                sslModeComposite.setLayout(gridLayout_3);
101:
102:                final Label sslModeLabel = new Label(sslModeComposite, SWT.NONE);
103:                sslModeLabel.setText(I18N.getString(Messages.TCPIP_SSL_MODE));
104:
105:                combo = new Combo(sslModeComposite, SWT.READ_ONLY);
106:                combo.setItems(new String[] { "TLS", "SSL", "SSLv3" });
107:                final GridData gridData_4 = new GridData(SWT.FILL, SWT.CENTER,
108:                        false, false);
109:                gridData_4.widthHint = 387;
110:                combo.setLayoutData(gridData_4);
111:                combo.setText("TLS");
112:
113:                allowAnonymousButton = new Button(topLevel, SWT.CHECK);
114:                allowAnonymousButton.setLayoutData(new GridData(SWT.FILL,
115:                        SWT.CENTER, true, false));
116:                allowAnonymousButton.setSelection(true);
117:                allowAnonymousButton.setText(I18N
118:                        .getString(Messages.TCPIP_SSL_ALLOW_ANONYMOUS));
119:
120:                usePrivateKeyButton = new Button(topLevel, SWT.CHECK);
121:                usePrivateKeyButton.setLayoutData(new GridData(SWT.FILL,
122:                        SWT.CENTER, true, false));
123:                usePrivateKeyButton
124:                        .addSelectionListener(new SelectionAdapter() {
125:                            public void widgetSelected(SelectionEvent e) {
126:                                if (textKeystoreFile == null
127:                                        || textPassword == null
128:                                        || keyFileBrowseButton == null)
129:                                    return;
130:                                if (usePrivateKeyButton.getSelection()) {
131:                                    textKeystoreFile.setEnabled(true);
132:                                    textPassword.setEnabled(true);
133:                                    keyFileBrowseButton.setEnabled(true);
134:                                } else {
135:                                    textKeystoreFile.setEnabled(false);
136:                                    textPassword.setEnabled(false);
137:                                    keyFileBrowseButton.setEnabled(false);
138:                                }
139:                            }
140:                        });
141:                usePrivateKeyButton.setText(I18N
142:                        .getString(Messages.TCPIP_SSL_PRIVATE_KEY));
143:
144:                final Composite composite = new Composite(topLevel, SWT.NONE);
145:                final GridData gridData_1 = new GridData(SWT.FILL, SWT.CENTER,
146:                        true, false);
147:                gridData_1.heightHint = 59;
148:                gridData_1.widthHint = 472;
149:                composite.setLayoutData(gridData_1);
150:                final GridLayout gridLayout_1 = new GridLayout();
151:                gridLayout_1.marginWidth = 0;
152:                gridLayout_1.numColumns = 3;
153:                composite.setLayout(gridLayout_1);
154:
155:                final Label keyLabel = new Label(composite, SWT.NONE);
156:                keyLabel.setText(I18N
157:                        .getString(Messages.TCPIP_SSL_KEYSTORE_FILE));
158:
159:                textKeystoreFile = new Text(composite, SWT.BORDER);
160:                textKeystoreFile.setEnabled(false);
161:                final GridData gridData = new GridData(SWT.FILL, SWT.CENTER,
162:                        true, false);
163:                gridData.widthHint = 319;
164:                textKeystoreFile.setLayoutData(gridData);
165:
166:                keyFileBrowseButton = new Button(composite, SWT.NONE);
167:                keyFileBrowseButton
168:                        .addSelectionListener(new SelectionAdapter() {
169:                            public void widgetSelected(SelectionEvent e) {
170:                                FileEditorInput editorInput = (FileEditorInput) PlatformUI
171:                                        .getWorkbench()
172:                                        .getActiveWorkbenchWindow()
173:                                        .getActivePage().getActiveEditor()
174:                                        .getEditorInput();
175:                                String projectName = editorInput.getFile()
176:                                        .getProject().getName();
177:                                BaseFileBrowser browser = new BaseFileBrowser(
178:                                        ComponentFlowEditorDiagramEditorPlugin
179:                                                .getInstance(),
180:                                        topLevel.getShell(),
181:                                        textKeystoreFile,
182:                                        projectName,
183:                                        ".jks",
184:                                        "auth/keys",
185:                                        I18N
186:                                                .getString(Messages.SELECT_KEY_FILE));
187:                                browser.open();
188:                            }
189:                        });
190:                keyFileBrowseButton.setEnabled(false);
191:                keyFileBrowseButton.setText(I18N
192:                        .getString(Messages.TCPIP_BROWSE));
193:
194:                final Label passwordLabel = new Label(composite, SWT.NONE);
195:                passwordLabel.setLayoutData(new GridData());
196:                passwordLabel.setText(I18N.getString(Messages.TCPIP_PASSWORD));
197:
198:                textPassword = new Text(composite, SWT.PASSWORD | SWT.BORDER);
199:                textPassword.setEnabled(false);
200:                final GridData gridData_2 = new GridData(SWT.FILL, SWT.CENTER,
201:                        false, false, 2, 1);
202:                gridData_2.widthHint = 100;
203:                textPassword.setLayoutData(gridData_2);
204:                new Label(composite, SWT.NONE);
205:
206:                buttonAuthenticateServer = new Button(topLevel, SWT.CHECK);
207:                buttonAuthenticateServer.setLayoutData(new GridData(SWT.FILL,
208:                        SWT.CENTER, true, false));
209:                buttonAuthenticateServer.setText(I18N
210:                        .getString(Messages.TCPIP_SSL_AUTHENTICATE_SERVER));
211:                buttonAuthenticateServer
212:                        .addSelectionListener(new SelectionAdapter() {
213:                            public void widgetSelected(SelectionEvent e) {
214:                                if (buttonAuthenticateServer.getSelection()) {
215:                                    buttonUseDefaultTruststore.setEnabled(true);
216:                                    if (buttonUseDefaultTruststore
217:                                            .getSelection()) {
218:                                        text.setEnabled(false);
219:                                        browseButton.setEnabled(false);
220:                                        truststorefilePassword
221:                                                .setEnabled(false);
222:                                    } else {
223:                                        text.setEnabled(true);
224:                                        browseButton.setEnabled(true);
225:                                        truststorefilePassword.setEnabled(true);
226:                                    }
227:                                } else {
228:                                    buttonUseDefaultTruststore
229:                                            .setEnabled(false);
230:                                    text.setEnabled(false);
231:                                    browseButton.setEnabled(false);
232:                                    truststorefilePassword.setEnabled(false);
233:                                }
234:                            }
235:                        });
236:
237:                buttonUseDefaultTruststore = new Button(topLevel, SWT.CHECK);
238:                buttonUseDefaultTruststore.setEnabled(false);
239:                buttonUseDefaultTruststore
240:                        .addSelectionListener(new SelectionAdapter() {
241:                            public void widgetSelected(SelectionEvent e) {
242:                                if (text == null || browseButton == null)
243:                                    return;
244:                                if (buttonUseDefaultTruststore.getSelection()) {
245:                                    text.setEnabled(false);
246:                                    browseButton.setEnabled(false);
247:                                    truststorefilePassword.setEnabled(false);
248:                                } else {
249:                                    text.setEnabled(true);
250:                                    browseButton.setEnabled(true);
251:                                    truststorefilePassword.setEnabled(true);
252:                                }
253:                            }
254:                        });
255:                final GridData gridData_5 = new GridData(SWT.FILL, SWT.CENTER,
256:                        true, false);
257:                gridData_5.widthHint = 157;
258:                buttonUseDefaultTruststore.setLayoutData(gridData_5);
259:                buttonUseDefaultTruststore.setSelection(true);
260:                buttonUseDefaultTruststore.setText(I18N
261:                        .getString(Messages.TCPIP_SSL_USE_DEFAULT_TRUSTSTORE));
262:
263:                final Composite composite_1 = new Composite(topLevel, SWT.NONE);
264:                final GridData gridData_3 = new GridData(SWT.FILL, SWT.FILL,
265:                        true, false);
266:                gridData_3.heightHint = 52;
267:                composite_1.setLayoutData(gridData_3);
268:                final GridLayout gridLayout_2 = new GridLayout();
269:                gridLayout_2.numColumns = 3;
270:                composite_1.setLayout(gridLayout_2);
271:
272:                final Label truststoreFileLabel = new Label(composite_1,
273:                        SWT.NONE);
274:                truststoreFileLabel
275:                        .setLayoutData(new GridData(97, SWT.DEFAULT));
276:                truststoreFileLabel.setText(I18N
277:                        .getString(Messages.TCPIP_SSL_TRUSTSTORE_FILE));
278:
279:                text = new Text(composite_1, SWT.BORDER);
280:                text.setEnabled(false);
281:                text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
282:                        false));
283:
284:                browseButton = new Button(composite_1, SWT.NONE);
285:                browseButton.addSelectionListener(new SelectionAdapter() {
286:                    public void widgetSelected(SelectionEvent e) {
287:                        FileEditorInput editorInput = (FileEditorInput) PlatformUI
288:                                .getWorkbench().getActiveWorkbenchWindow()
289:                                .getActivePage().getActiveEditor()
290:                                .getEditorInput();
291:                        String projectName = editorInput.getFile().getProject()
292:                                .getName();
293:                        BaseFileBrowser browser = new BaseFileBrowser(
294:                                ComponentFlowEditorDiagramEditorPlugin
295:                                        .getInstance(),
296:                                topLevel.getShell(),
297:                                text,
298:                                projectName,
299:                                ".jks",
300:                                "auth/certs",
301:                                I18N
302:                                        .getString(Messages.SELECT_CERTIFICATE_FILE));
303:                        browser.open();
304:                    }
305:                });
306:                browseButton.setEnabled(false);
307:                browseButton.setText(I18N.getString(Messages.TCPIP_BROWSE));
308:
309:                final Label passwordLabel_1 = new Label(composite_1, SWT.NONE);
310:                passwordLabel_1
311:                        .setText(I18N.getString(Messages.TCPIP_PASSWORD));
312:
313:                truststorefilePassword = new Text(composite_1, SWT.BORDER
314:                        | SWT.PASSWORD);
315:                truststorefilePassword.setLayoutData(new GridData(SWT.FILL,
316:                        SWT.CENTER, true, false, 2, 1));
317:                truststorefilePassword.setEnabled(false);
318:                new Label(composite_1, SWT.NONE);
319:
320:                new Label(topLevel, SWT.NONE);
321:
322:                if (updateOperation || sslMap.size() != 0) {
323:                    modelsToControl();
324:                }
325:                return null;
326:            }
327:
328:            private void modelsToControl() {
329:                if (sslMap.get("sslProtocol") != null
330:                        && !"".equals(sslMap.get("sslProtocol"))) {
331:                    combo.setText(sslMap.get("sslProtocol"));
332:                } else {
333:                    combo.setText("TLS");
334:                }
335:                allowAnonymousButton.setSelection(Boolean.parseBoolean(sslMap
336:                        .get("allowAnonymous")));
337:                usePrivateKeyButton.setSelection(Boolean.parseBoolean(sslMap
338:                        .get("usePrivateKey")));
339:                if (sslMap.get("keyStoreFile") != null
340:                        && !"".equals(sslMap.get("keyStoreFile"))) {
341:                    textKeystoreFile.setText(sslMap.get("keyStoreFile"));
342:
343:                } else {
344:                    textKeystoreFile.setText("");
345:                }
346:                if (usePrivateKeyButton.getSelection()) {
347:                    textKeystoreFile.setEnabled(true);
348:                    keyFileBrowseButton.setEnabled(true);
349:                    textPassword.setEnabled(true);
350:                } else {
351:                    textKeystoreFile.setEnabled(false);
352:                    keyFileBrowseButton.setEnabled(false);
353:                    textPassword.setEnabled(false);
354:                }
355:                if (sslMap.get("keyStorePassword") != null
356:                        && !"".equals(sslMap.get("keyStorePassword"))) {
357:                    textPassword.setText(sslMap.get("keyStorePassword"));
358:                } else {
359:                    textPassword.setText("");
360:                }
361:                buttonAuthenticateServer.setSelection(Boolean
362:                        .parseBoolean(sslMap.get("authenticateServer")));
363:                if (buttonAuthenticateServer.getSelection()) {
364:                    buttonUseDefaultTruststore.setEnabled(true);
365:                } else {
366:                    buttonUseDefaultTruststore.setEnabled(false);
367:                }
368:                buttonUseDefaultTruststore.setSelection(Boolean
369:                        .parseBoolean(sslMap.get("useDefaultTrustStore")));
370:                if (sslMap.get("trustStoreFile") != null
371:                        && !"".equals(sslMap.get("trustStoreFile"))) {
372:                    text.setText(sslMap.get("trustStoreFile"));
373:                } else {
374:                    text.setText("");
375:                }
376:                if (sslMap.get("trustStorePassword") != null
377:                        && !"".equals(sslMap.get("trustStorePassword"))) {
378:                    truststorefilePassword.setText(sslMap
379:                            .get("trustStorePassword"));
380:                } else {
381:                    truststorefilePassword.setText("");
382:                }
383:                if (!buttonUseDefaultTruststore.getSelection()
384:                        && buttonAuthenticateServer.getSelection()) {
385:                    text.setEnabled(true);
386:                    browseButton.setEnabled(true);
387:                    truststorefilePassword.setEnabled(true);
388:                } else {
389:                    text.setEnabled(false);
390:                    browseButton.setEnabled(false);
391:                    truststorefilePassword.setEnabled(false);
392:                }
393:            }
394:
395:            private void controlToModels() {
396:                sslMap.put("sslProtocol", combo.getText());
397:                sslMap.put("allowAnonymous", Boolean
398:                        .toString(allowAnonymousButton.getSelection()));
399:                sslMap.put("usePrivateKey", Boolean
400:                        .toString(usePrivateKeyButton.getSelection()));
401:                sslMap.put("keyStoreFile", textKeystoreFile.getText());
402:                sslMap.put("keyStorePassword", textPassword.getText());
403:                sslMap.put("authenticateServer", Boolean
404:                        .toString(buttonAuthenticateServer.getSelection()));
405:                sslMap.put("useDefaultTrustStore", Boolean
406:                        .toString(buttonUseDefaultTruststore.getSelection()));
407:                sslMap.put("trustStoreFile", text.getText());
408:                sslMap.put("trustStorePassword", truststorefilePassword
409:                        .getText());
410:            }
411:
412:            protected void okPressed() {
413:                controlToModels();
414:                super .okPressed();
415:            }
416:
417:            @Override
418:            protected void cancelPressed() {
419:                super .cancelPressed();
420:            }
421:
422:            /**
423:             * Create contents of the button bar
424:             * 
425:             * @param parent
426:             */
427:            @Override
428:            protected void createButtonsForButtonBar(Composite parent) {
429:                createButton(parent, IDialogConstants.OK_ID,
430:                        IDialogConstants.OK_LABEL, true);
431:                createButton(parent, IDialogConstants.CANCEL_ID,
432:                        IDialogConstants.CANCEL_LABEL, false);
433:            }
434:
435:            /**
436:             * Return the initial size of the dialog
437:             */
438:            @Override
439:            protected Point getInitialSize() {
440:                return new Point(549, 406);
441:            }
442:
443:            protected void configureShell(Shell newShell) {
444:                super.configureShell(newShell);
445:                newShell.setText(I18N
446:                        .getString(Messages.TCPIP_SSL_CLIENT_DIALOG));
447:            }
448:        }
ww___w_._j__av___a___2_s__.c___o___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.