KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > gui > config > accountwizard > AccountWizardLauncher


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
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 JavaDoc;
19 import java.awt.Frame JavaDoc;
20 import java.awt.Window JavaDoc;
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(), new IdentityStep(data),
47                     new IncomingServerStep(data),
48                     new OutgoingServerStep(data, false), new FinishStep() };
49         } else {
50             steps = new Step[] { new IdentityStep(data),
51                     new IncomingServerStep(data),
52                     new OutgoingServerStep(data, true) };
53         }
54
55         WizardModel model = new DefaultWizardModel(steps);
56         model.addWizardModelListener(new AccountCreator(data));
57
58         Window JavaDoc w = ActiveWindowTracker.findActiveWindow();
59
60         Wizard wizard = null;
61
62         if (w instanceof Frame JavaDoc)
63             wizard = new Wizard((Frame JavaDoc) w, model, MailResourceLoader.getString(
64                     "dialog", "accountwizard", "title"), ImageLoader
65                     .getIcon(IconKeys.PREFERENCES));
66         else
67             wizard = new Wizard((Dialog JavaDoc) w, model, MailResourceLoader
68                     .getString("dialog", "accountwizard", "title"), ImageLoader
69                     .getIcon(IconKeys.PREFERENCES));
70
71         wizard.setStepListRenderer(null);
72         CSH.setHelpIDString(wizard, "getting_started_1");
73         JavaHelpSupport.enableHelp(wizard, HelpManager.getInstance()
74                 .getHelpBroker());
75         wizard.pack();
76         wizard.setLocationRelativeTo(null);
77         wizard.setVisible(true);
78     }
79 }
80
Popular Tags