KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mc4j > console > connection > wizard > ConnectionDescriptor


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.wizard;
18
19 import org.mc4j.ems.connection.settings.ConnectionSettings;
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 ConnectionDescriptor extends WizardDescriptor {
33
34     private final ConnectionIterator iterator;
35
36     protected ConnectionSettings settings;
37     
38     /** Make a descriptor suited to use ConnectionIterator.
39      * Sets up various wizard properties to follow recommended
40      * style guidelines.
41      */

42     public ConnectionDescriptor() {
43         this(new ConnectionIterator());
44         this.settings = new ConnectionSettings();
45         
46         this.iterator.setDescriptor(this);
47     }
48     
49     private ConnectionDescriptor(ConnectionIterator iterator) {
50         super(iterator);
51         this.iterator = iterator;
52
53         // Set title for the dialog:
54
setTitle(NbBundle.getMessage(ConnectionDescriptor.class, "TITLE_wizard"));
55         // Make the left pane appear:
56
putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N
57
// Make the left pane show list of steps etc.:
58
putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N
59
// Number the steps.
60
putProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N
61

62
63
64         // Optional: make nonmodal.
65
//setModal(false);
66
// (If you make the wizard nonmodal, you will call it differently;
67
// see ConnectionAction for instructions.)
68

69         // Optional: show a help tab with special info about the pane:
70
putProperty("WizardPanel_helpDisplayed", Boolean.TRUE); // NOI18N
71
// Optional: set the size of the left pane explicitly:
72
putProperty("WizardPanel_leftDimension", new Dimension(100, 400)); // NOI18N
73

74         
75         // Optional: if you want a special background image for the left pane:
76
try {
77             putProperty("WizardPanel_image", // NOI18N
78
Toolkit.getDefaultToolkit().getImage
79                 (new URL JavaDoc("nbresloc:/org/mc4j/console/Wizard.gif"))); // NOI18N
80
} catch (MalformedURLException JavaDoc mfue) {
81             throw new IllegalStateException JavaDoc(mfue.toString());
82         }
83          
84
85     }
86
87     // Called when user moves forward or backward etc.:
88
protected void updateState() {
89         super.updateState();
90         putProperty("WizardPanel_contentData", iterator.getSteps()); // NOI18N
91
putProperty("WizardPanel_contentSelectedIndex", new Integer JavaDoc(iterator.getIndex())); // NOI18N
92
}
93
94
95
96     public ConnectionSettings getSettings() {
97         return this.settings;
98     }
99
100 }
101
Popular Tags