KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > ui > WS70ServerUIWizardIterator


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * WS70ServerUIWiazrdIterator.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.ui;
25 import org.openide.WizardDescriptor;
26 import org.openide.ErrorManager;
27 import java.util.Set JavaDoc;
28 import java.util.ArrayList JavaDoc;
29 import java.util.Enumeration JavaDoc;
30 import java.util.HashSet JavaDoc;
31 import java.util.Iterator JavaDoc;
32 import java.util.List JavaDoc;
33 import java.util.Properties JavaDoc;
34 import java.util.Set JavaDoc;
35 import javax.swing.event.ChangeListener JavaDoc;
36 import javax.swing.JComponent JavaDoc;
37 import java.awt.Component JavaDoc;
38 import java.util.NoSuchElementException JavaDoc;
39 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
40         
41
42 /**
43  *
44  * @author Mukesh Garg
45  */

46 public class WS70ServerUIWizardIterator implements WizardDescriptor.InstantiatingIterator {
47
48     private final static String JavaDoc PROP_CONTENT_DATA = "WizardPanel_contentData"; // NOI18N
49
private final static String JavaDoc PROP_CONTENT_SELECTED_INDEX = "WizardPanel_contentSelectedIndex"; // NOI18N
50
public final static String JavaDoc PROP_ERROR_MESSAGE = "WizardPanel_errorMessage"; // NOI18N
51
private final static String JavaDoc PROP_DISPLAY_NAME = "ServInstWizard_displayName"; // NOI18N
52
public final static String JavaDoc PROP_LOCAL_SERVER = "LocalServer"; // NOI18N
53
public final static String JavaDoc PROP_SSL_PORT = "SSLAdminPort"; // NOI18N
54
private WS70AddServerChoicePanel panel;
55     private WizardDescriptor wizard;
56     /**
57      * Creates a new instance of WS70ServerUIWizardIterator
58      *
59      */

60     public WS70ServerUIWizardIterator() {
61     }
62     
63     //WizardDescriptor.InstantiatingIterator method implementation
64
public void initialize(WizardDescriptor wizard){
65         this.wizard = wizard;
66     }
67     //WizardDescriptor.InstantiatingIterator method implementation
68
public Set JavaDoc instantiate(){
69         WS70AddServerChoiceVisualPanel visualPanel = (WS70AddServerChoiceVisualPanel)panel.getComponent();
70         try {
71             String JavaDoc host = visualPanel.getAdminHost();
72             String JavaDoc port = visualPanel.getAdminPort();
73             String JavaDoc user = visualPanel.getAdminUserName();
74             String JavaDoc password = visualPanel.getAdminPassword();
75             String JavaDoc location = visualPanel.getServerLocation();
76             String JavaDoc displayName = (String JavaDoc)wizard.getProperty(PROP_DISPLAY_NAME);
77             boolean localserver = visualPanel.isLocalServer();
78             boolean sslport = visualPanel.isAdminOnSSL();
79             InstanceProperties ip = WS70URIManager.createInstanceProperties(location, host, port, user, password, displayName);
80             ip.setProperty(PROP_LOCAL_SERVER, Boolean.toString(localserver));
81             ip.setProperty(PROP_SSL_PORT, Boolean.toString(sslport));
82             Set JavaDoc result = new HashSet JavaDoc();
83             result.add(ip);
84             return result;
85         } catch (Exception JavaDoc ex) {
86             ErrorManager.getDefault().log(ErrorManager.EXCEPTION, ex.getMessage());
87             return null;
88         }
89     }
90     //WizardDescriptor.InstantiatingIterator method implementation
91
public void uninitialize(WizardDescriptor wizard){
92         
93     }
94     //WizardDescriptor.Iterator method implementation
95
public WizardDescriptor.Panel current(){
96         if(panel==null){
97             panel = new WS70AddServerChoicePanel();
98         }
99         Component JavaDoc c = panel.getComponent();
100         String JavaDoc[] steps = new String JavaDoc[1];
101         steps[0]=c.getName();
102         if (c instanceof JComponent JavaDoc) { // assume Swing components
103
JComponent JavaDoc jc = (JComponent JavaDoc) c;
104             // Sets steps names for a panel
105
jc.putClientProperty("WizardPanel_contentData", steps); //NOI18N
106
// Turn on subtitle creation on each step
107
jc.putClientProperty("WizardPanel_autoWizardStyle", //NOI18N
108
Boolean.TRUE);
109             // Show steps on the left side with the image on the background
110
jc.putClientProperty("WizardPanel_contentDisplayed", //NOI18N
111
Boolean.TRUE);
112             // Turn on numbering of all steps
113
jc.putClientProperty("WizardPanel_contentNumbered", //NOI18N
114
Boolean.TRUE);
115         }
116         return panel;
117     }
118  
119    //WizardDescriptor.Iterator method implementation
120
public void previousPanel(){
121         throw new NoSuchElementException JavaDoc();
122         
123     }
124    //WizardDescriptor.Iterator method implementation
125
public void nextPanel(){
126         throw new NoSuchElementException JavaDoc();
127     }
128    //WizardDescriptor.Iterator method implementation
129
public boolean hasPrevious(){
130         return false;
131     }
132     //WizardDescriptor.Iterator method implementation
133
public boolean hasNext(){
134         return false;
135     }
136     //WizardDescriptor.Iterator method implementation
137
public void addChangeListener(ChangeListener JavaDoc listener){
138         
139     }
140     //WizardDescriptor.Iterator method implementation
141
public void removeChangeListener(ChangeListener JavaDoc listener){
142         
143     }
144    //WizardDescriptor.Iterator method implementation
145
public String JavaDoc name(){
146         return "";
147     }
148     
149 }
150
Popular Tags