01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.mail.gui.config.accountwizard;
17:
18: import java.awt.Dialog;
19: import java.awt.Frame;
20: import java.awt.Window;
21:
22: import javax.help.CSH;
23:
24: import net.javaprog.ui.wizard.DataModel;
25: import net.javaprog.ui.wizard.DefaultWizardModel;
26: import net.javaprog.ui.wizard.JavaHelpSupport;
27: import net.javaprog.ui.wizard.Step;
28: import net.javaprog.ui.wizard.Wizard;
29: import net.javaprog.ui.wizard.WizardModel;
30:
31: import org.columba.core.help.HelpManager;
32: import org.columba.core.resourceloader.IconKeys;
33: import org.columba.core.resourceloader.ImageLoader;
34: import org.columba.mail.util.MailResourceLoader;
35: import org.frapuccino.swing.ActiveWindowTracker;
36:
37: public class AccountWizardLauncher {
38: public AccountWizardLauncher() {
39: }
40:
41: public void launchWizard(boolean firstStart) {
42: DataModel data = new DataModel();
43: Step[] steps;
44:
45: if (firstStart) {
46: steps = new Step[] { new WelcomeStep(),
47: new IdentityStep(data),
48: new IncomingServerStep(data),
49: new OutgoingServerStep(data, false),
50: new FinishStep() };
51: } else {
52: steps = new Step[] { new IdentityStep(data),
53: new IncomingServerStep(data),
54: new OutgoingServerStep(data, true) };
55: }
56:
57: WizardModel model = new DefaultWizardModel(steps);
58: model.addWizardModelListener(new AccountCreator(data));
59:
60: Window w = ActiveWindowTracker.findActiveWindow();
61:
62: Wizard wizard = null;
63:
64: if (w instanceof Frame)
65: wizard = new Wizard((Frame) w, model, MailResourceLoader
66: .getString("dialog", "accountwizard", "title"),
67: ImageLoader.getIcon(IconKeys.PREFERENCES));
68: else
69: wizard = new Wizard((Dialog) w, model, MailResourceLoader
70: .getString("dialog", "accountwizard", "title"),
71: ImageLoader.getIcon(IconKeys.PREFERENCES));
72:
73: wizard.setStepListRenderer(null);
74: CSH.setHelpIDString(wizard, "getting_started_1");
75: JavaHelpSupport.enableHelp(wizard, HelpManager.getInstance()
76: .getHelpBroker());
77: wizard.pack();
78: wizard.setLocationRelativeTo(null);
79: wizard.setVisible(true);
80: }
81: }
|