KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mc4j > console > connection > create > CreateWizardDescriptor


1 /*
2  * Copyright 2002-2004 Greg Hinkle
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.mc4j.console.connection.create;
18
19 import org.mc4j.ems.connection.EmsConnection;
20 import org.openide.WizardDescriptor;
21 import org.openide.util.NbBundle;
22
23 import java.awt.*;
24 import java.net.MalformedURLException JavaDoc;
25 import java.net.URL JavaDoc;
26
27 /**
28  *
29  * @author Greg Hinkle (ghinkle@users.sourceforge.net), January 2002
30  * @version $Revision: 570 $($Author: ghinkl $ / $Date: 2006-04-12 15:14:16 -0400 (Wed, 12 Apr 2006) $)
31  */

32 public class CreateWizardDescriptor extends WizardDescriptor {
33
34     private final CreateWizardIterator iterator;
35
36     private CreateMBeanData data;
37     private EmsConnection connection;
38
39     /** Make a descriptor suited to use ConnectionIterator.
40      * Sets up various wizard properties to follow recommended
41      * style guidelines.
42      */

43     public CreateWizardDescriptor(EmsConnection connection) {
44         this(new CreateWizardIterator());
45         this.connection = connection;
46         this.data = new CreateMBeanData();
47
48         this.iterator.setDescriptor(this);
49     }
50
51     public CreateWizardIterator getIterator() {
52         return iterator;
53     }
54
55     public EmsConnection getConnection() {
56         return connection;
57     }
58
59
60     private CreateWizardDescriptor(CreateWizardIterator iterator) {
61         super(iterator);
62         this.iterator = iterator;
63
64         // Set title for the dialog:
65
setTitle(NbBundle.getMessage(CreateWizardDescriptor.class, "TITLE_wizard"));
66         // Make the left pane appear:
67
putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N
68
// Make the left pane show list of steps etc.:
69
putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N
70
// Number the steps.
71
putProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N
72

73
74
75         // Optional: make nonmodal.
76
//setModal(false);
77
// (If you make the wizard nonmodal, you will call it differently;
78
// see ConnectionAction for instructions.)
79

80         // Optional: show a help tab with special info about the pane:
81
putProperty("WizardPanel_helpDisplayed", Boolean.TRUE); // NOI18N
82
// Optional: set the size of the left pane explicitly:
83
putProperty("WizardPanel_leftDimension", new Dimension(100, 400)); // NOI18N
84

85         
86         // Optional: if you want a special background image for the left pane:
87
try {
88             putProperty("WizardPanel_image", // NOI18N
89
Toolkit.getDefaultToolkit().getImage
90                 (new URL JavaDoc("nbresloc:/org/mc4j/console/Wizard.gif"))); // NOI18N
91
} catch (MalformedURLException JavaDoc mfue) {
92             throw new IllegalStateException JavaDoc(mfue.toString());
93         }
94          
95
96     }
97
98     // Called when user moves forward or backward etc.:
99
protected void updateState() {
100         super.updateState();
101         putProperty("WizardPanel_contentData", iterator.getSteps()); // NOI18N
102
putProperty("WizardPanel_contentSelectedIndex", new Integer JavaDoc(iterator.getIndex())); // NOI18N
103
}
104
105
106
107     public CreateMBeanData getData() {
108         return this.data;
109     }
110
111 }
112
Popular Tags