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:
025: package com.bostechcorp.cbesb.ui.ide.security;
026:
027: import org.eclipse.jface.resource.ImageDescriptor;
028: import org.eclipse.jface.wizard.IWizardPage;
029: import org.eclipse.jface.wizard.WizardPage;
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.layout.GridData;
034: import org.eclipse.swt.layout.GridLayout;
035: import org.eclipse.swt.widgets.Button;
036: import org.eclipse.swt.widgets.Composite;
037: import org.eclipse.swt.widgets.Group;
038:
039: import com.bostechcorp.cbesb.common.i18n.I18N;
040: import com.bostechcorp.cbesb.common.i18n.Messages;
041:
042: public class CMWMainPage extends CMWContextAwarePage {
043:
044: private Button otherFunctionsButton;
045: private Button serverModeCertificateButton;
046: private Button clientModeCertificateButton;
047: private Button serverModePointtopointButton;
048: private Button clientModePointtopointButton;
049: private Button useAnonimousNoButton;
050:
051: private WizardPage nextPage;
052:
053: protected CMWMainPage(String pageName, String title,
054: ImageDescriptor titleImage) {
055: super (I18N.getString(Messages.CMW_TITLE), title, titleImage);
056: setTitle(I18N.getString(Messages.CMW_MAIN_TITLE));
057: setDescription(I18N.getString(Messages.CMW_MAIN_DESCRIPTION));
058: }
059:
060: public CMWMainPage(String string) {
061: super (I18N.getString(Messages.CMW_TITLE));
062: setTitle(I18N.getString(Messages.CMW_MAIN_TITLE));
063: setDescription(I18N.getString(Messages.CMW_MAIN_DESCRIPTION));
064: }
065:
066: public void createControl(Composite parent) {
067:
068: final Composite composite = new Composite(parent, SWT.NONE);
069: //composite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
070: composite.setLayout(new GridLayout());
071:
072: final Group chooseAFunctionGroup = new Group(composite,
073: SWT.NONE);
074: chooseAFunctionGroup.setText(I18N
075: .getString(Messages.CMW_MAIN_GROUP));
076: final GridData gridData = new GridData(SWT.FILL, SWT.CENTER,
077: true, false);
078: chooseAFunctionGroup.setLayout(new GridLayout());
079: chooseAFunctionGroup.setLayoutData(gridData);
080:
081: useAnonimousNoButton = new Button(chooseAFunctionGroup,
082: SWT.RADIO);
083: useAnonimousNoButton
084: .addSelectionListener(new SelectionAdapter() {
085: public void widgetSelected(final SelectionEvent e) {
086: checkSelection();
087: }
088:
089: public void widgetDefaultSelected(
090: final SelectionEvent e) {
091: checkSelection();
092: }
093: });
094: useAnonimousNoButton.setLayoutData(new GridData(SWT.FILL,
095: SWT.CENTER, true, false));
096: useAnonimousNoButton.setText(I18N
097: .getString(Messages.CMW_MAIN_SEL_ANONIMOUS));
098: useAnonimousNoButton.setSelection(true);
099:
100: clientModePointtopointButton = new Button(chooseAFunctionGroup,
101: SWT.RADIO);
102: clientModePointtopointButton
103: .addSelectionListener(new SelectionAdapter() {
104: public void widgetSelected(final SelectionEvent e) {
105: checkSelection();
106: }
107: });
108: clientModePointtopointButton.setLayoutData(new GridData(
109: SWT.FILL, SWT.CENTER, true, false));
110: clientModePointtopointButton.setText(I18N
111: .getString(Messages.CMW_MAIN_SEL_CLIENT_PP));
112:
113: serverModePointtopointButton = new Button(chooseAFunctionGroup,
114: SWT.RADIO);
115: serverModePointtopointButton
116: .addSelectionListener(new SelectionAdapter() {
117: public void widgetSelected(final SelectionEvent e) {
118: checkSelection();
119: }
120: });
121: serverModePointtopointButton.setLayoutData(new GridData(
122: SWT.FILL, SWT.CENTER, true, false));
123: serverModePointtopointButton.setText(I18N
124: .getString(Messages.CMW_MAIN_SEL_SERVER_PP));
125:
126: clientModeCertificateButton = new Button(chooseAFunctionGroup,
127: SWT.RADIO);
128: clientModeCertificateButton
129: .addSelectionListener(new SelectionAdapter() {
130: public void widgetSelected(final SelectionEvent e) {
131: checkSelection();
132: }
133: });
134: clientModeCertificateButton.setLayoutData(new GridData(
135: SWT.FILL, SWT.CENTER, true, false));
136: clientModeCertificateButton.setText(I18N
137: .getString(Messages.CMW_MAIN_SEL_CLIENT_ASS));
138:
139: serverModeCertificateButton = new Button(chooseAFunctionGroup,
140: SWT.RADIO);
141: serverModeCertificateButton
142: .addSelectionListener(new SelectionAdapter() {
143: public void widgetSelected(final SelectionEvent e) {
144: checkSelection();
145: }
146: });
147: serverModeCertificateButton.setLayoutData(new GridData(
148: SWT.FILL, SWT.CENTER, true, false));
149: serverModeCertificateButton.setText(I18N
150: .getString(Messages.CMW_MAIN_SEL_SERVER_AAS));
151:
152: otherFunctionsButton = new Button(chooseAFunctionGroup,
153: SWT.RADIO);
154: otherFunctionsButton
155: .addSelectionListener(new SelectionAdapter() {
156: public void widgetSelected(final SelectionEvent e) {
157: checkSelection();
158: }
159: });
160: otherFunctionsButton.setLayoutData(new GridData(SWT.FILL,
161: SWT.CENTER, true, false));
162: otherFunctionsButton.setText(I18N
163: .getString(Messages.CMW_MAIN_SEL_OTHER));
164:
165: setControl(composite);
166: checkSelection();
167: }
168:
169: protected void checkSelection() {
170: CertificateManagerWizard parent = (CertificateManagerWizard) this
171: .getWizard();
172: if (useAnonimousNoButton.getSelection()) {
173: setPageComplete(true);
174: nextPage = parent.getAnonimousPage();
175: return;
176: } else if (clientModeCertificateButton.getSelection()) {
177: setPageComplete(true);
178: nextPage = parent.getClientAas();
179: return;
180: } else if (clientModePointtopointButton.getSelection()) {
181: setPageComplete(true);
182: nextPage = parent.getClientp2p();
183: return;
184: } else if (serverModeCertificateButton.getSelection()) {
185: setPageComplete(true);
186: nextPage = parent.getServerAas();
187: return;
188: } else if (serverModePointtopointButton.getSelection()) {
189: nextPage = parent.getServerp2p();
190: //setPageComplete(true);
191: return;
192: } else if (otherFunctionsButton.getSelection()) {
193: nextPage = parent.getAdvanced();
194: //setPageComplete(true);
195: return;
196: }
197: setPageComplete(false);
198: }
199:
200: @Override
201: public IWizardPage getNextPage() {
202: CertificateManagerWizard parent = (CertificateManagerWizard) getWizard();
203: parent.setPrevious(nextPage);
204: parent.setNext(null);
205: return nextPage;
206: }
207:
208: @Override
209: public IWizardPage getPreviousPage() {
210: CertificateManagerWizard parent = (CertificateManagerWizard) getWizard();
211: parent.setPrevious(null);
212: parent.setNext(null);
213: return null;
214: }
215:
216: protected Button getUseAnonimousNoButton() {
217: return useAnonimousNoButton;
218: }
219:
220: protected Button getClientModePointtopointButton() {
221: return clientModePointtopointButton;
222: }
223:
224: protected Button getServerModePointtopointButton() {
225: return serverModePointtopointButton;
226: }
227:
228: protected Button getClientModeCertificateButton() {
229: return clientModeCertificateButton;
230: }
231:
232: protected Button getServerModeCertificateButton() {
233: return serverModeCertificateButton;
234: }
235:
236: protected Button getOtherFunctionsButton() {
237: return otherFunctionsButton;
238: }
239:
240: @Override
241: protected void updatePageComplete() {
242:
243: }
244: }
|