KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > guiframework > view > descriptors > CCWizardWindowDescriptor


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.guiframework.view.descriptors;
25
26 import com.iplanet.jato.RequestContext;
27 import com.iplanet.jato.RequestManager;
28 import com.iplanet.jato.view.ContainerView;
29 import com.iplanet.jato.view.ContainerViewBase;
30 import com.iplanet.jato.view.DisplayField;
31 import com.iplanet.jato.view.View;
32
33 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
34
35 import com.sun.web.ui.model.CCWizardWindowModel;
36 import com.sun.web.ui.model.CCWizardWindowModelInterface;
37 import com.sun.web.ui.view.wizard.CCWizardWindow;
38
39
40 /**
41  *
42  */

43 public class CCWizardWindowDescriptor extends DisplayFieldDescriptor {
44
45     /**
46      * Constructor
47      */

48     public CCWizardWindowDescriptor(String JavaDoc name) {
49     super(name);
50     }
51
52
53     /**
54      * <P>This is a factory method. It will create a CCWizardWindow.</P>
55      *
56      * <P>Several parameters are used to initialize the CCWizardWindowModel
57      * that is passed to the new CCWizardWindow object. Below is a list of
58      * supported parameters that may be defined in the viewXML:</P>
59      *
60      * <UL><LI>MASTHEAD_IMAGE</LI>
61      * <LI>MASTHEAD_ALT_TEXT</LI>
62      * <LI>RESOURCE_BUNDLE</LI>
63      * <LI>BUNDLE_ID</LI>
64      * <LI>WIZARD_TITLE</LI>
65      * <LI>WIZARD_CLASS_NAME</LI>
66      * <LI>WIZARD_NAME</LI>
67      * <LI>WIZARD_WINDOW_NAME</LI>
68      * <LI>BUTTON_LABEL</LI>
69      * <LI>WIZARD_REFRESH_CMDCHILD</LI></UL>
70      *
71      * @param ctx The RequestContext
72      * @param container The container for the newly created
73      * @param name The Name of the View to be created.
74      */

75     public View getInstance(RequestContext ctx, ContainerView container, String JavaDoc name) {
76     CCWizardWindowModelInterface wizModel = new CCWizardWindowModel();
77
78     // Masthead Image
79
String JavaDoc image = (String JavaDoc)getParameter(MASTHEAD_IMAGE);
80     if (image != null) {
81         wizModel.setValue(CCWizardWindowModelInterface.MASTHEAD_SRC, image);
82     }
83     // Masthead Alt Text
84
String JavaDoc alt = (String JavaDoc)getParameter(MASTHEAD_ALT_TEXT);
85     if (alt != null) {
86         wizModel.setValue(CCWizardWindowModelInterface.MASTHEAD_ALT, alt);
87     }
88     // Resource file location
89
String JavaDoc resource = getResourceBundle();
90     if (resource != null) {
91         wizModel.setValue(CCWizardWindowModelInterface.BASENAME, resource);
92     }
93     // Bundle id
94
String JavaDoc bundle = (String JavaDoc)getParameter(BUNDLE_ID);
95     if (bundle != null) {
96         wizModel.setValue(CCWizardWindowModelInterface.BUNDLEID, bundle);
97     }
98     // Wizard title
99
String JavaDoc title = (String JavaDoc)getParameter(WIZARD_TITLE);
100     if (title != null) {
101         wizModel.setValue(CCWizardWindowModelInterface.TITLE, title);
102     }
103     // Wizard impl class name
104
String JavaDoc className = (String JavaDoc)getParameter(WIZARD_CLASS_NAME);
105     if (className != null) {
106         wizModel.setValue(CCWizardWindowModelInterface.WIZARD_CLASS_NAME, className);
107     }
108     // Wizard Name
109
String JavaDoc wizName = (String JavaDoc)getParameter(WIZARD_NAME);
110     if (wizName != null) {
111         wizModel.setValue(CCWizardWindowModelInterface.WIZARD_NAME, wizName);
112     }
113     // Wizard Window Name
114
String JavaDoc wizWindowName = (String JavaDoc)getParameter(WIZARD_WINDOW_NAME);
115     if (wizWindowName != null) {
116         wizModel.setValue(CCWizardWindowModelInterface.WIZARD_WINDOW_NAME, wizWindowName);
117     }
118     // Button label
119
String JavaDoc label = (String JavaDoc)getParameter(BUTTON_LABEL);
120     if (label != null) {
121         wizModel.setValue(CCWizardWindowModelInterface.WIZARD_BUTTON_FORM, label);
122     }
123     // Wizard refresh command child
124
String JavaDoc wizRefresh = (String JavaDoc)getParameter(WIZARD_REFRESH_CMDCHILD);
125     if (wizRefresh != null) {
126         wizModel.setValue(CCWizardWindowModelInterface.WIZARD_REFRESH_CMDCHILD, wizRefresh);
127     }
128
129     // Hack to mark a flag that the Wizard was invoked for the first time
130
// and should reset the model data
131
wizModel.setValue(RESET_MODEL_DATA, "true");
132     
133     return new CCWizardWindow(container, wizModel, name, label);
134     }
135
136
137     /**
138      * mastheadImage
139      */

140     public static final String JavaDoc MASTHEAD_IMAGE = "mastheadImage";
141
142     /**
143      * mastheadAltText
144      */

145     public static final String JavaDoc MASTHEAD_ALT_TEXT = "mastheadAltText";
146
147     /**
148      * bundleId
149      */

150     public static final String JavaDoc BUNDLE_ID = "bundleId";
151
152     /**
153      * wizardTitle
154      */

155     public static final String JavaDoc WIZARD_TITLE = "wizardTitle";
156
157     /**
158      * wizardClassName
159      */

160     public static final String JavaDoc WIZARD_CLASS_NAME = "wizardClassName";
161
162     /**
163      * wizardName
164      */

165     public static final String JavaDoc WIZARD_NAME = "wizardName";
166
167     /**
168      * wizardWindowName
169      */

170     public static final String JavaDoc WIZARD_WINDOW_NAME = "wizardWindowName";
171
172     /**
173      * buttonLabel
174      */

175     public static final String JavaDoc BUTTON_LABEL = "buttonLabel";
176
177     /**
178      * wizardRefreshCmd
179      */

180     public static final String JavaDoc WIZARD_REFRESH_CMDCHILD = "wizardRefreshCmd";
181
182     /**
183      * resetModelData
184      */

185     public static final String JavaDoc RESET_MODEL_DATA = "resetModelData";
186 }
187
Popular Tags