KickJava   Java API By Example, From Geeks To Geeks.

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


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.view.ContainerView;
28 import com.iplanet.jato.view.View;
29 import com.sun.web.ui.view.html.CCImageField;
30
31
32 /**
33  *
34  */

35 public class CCImageFieldDescriptor extends DisplayFieldDescriptor {
36
37     /**
38      * Constructor
39      */

40     public CCImageFieldDescriptor(String JavaDoc name) {
41     super(name);
42     }
43
44     /**
45      * <p> This is a factory method for CCImageField instances. It supports
46      * the following parameters:<p>
47      *
48      * <ul><li>{@link DisplayFieldDescriptor#DEFAULT_VALUE} ("defaultValue") --
49      * Sets initial value</li>
50      * <li>{@link DisplayFieldDescriptor#MODEL_FIELD_NAME}
51      * ("modelFieldName") -- Sets the Model field name for binding</li>
52      * <li>{@link #ALIGN} ("align") --
53      * Sets the CCImageField align property.</li>
54      * <li>{@link #ALT} ("alt") --
55      * Sets the CCImageField alt property.</li>
56      * <li>{@link #BORDER} ("border") --
57      * Sets the CCImageField border property.</li>
58      * <li>{@link #ELEMENT_ID} ("elementId") --
59      * Sets the CCImageField elementId property.</li>
60      * <li>{@link #HEIGHT} ("height") --
61      * Sets the CCImageField height property.</li>
62      * <li>{@link #HSPACE} ("hspace") --
63      * Sets the CCImageField hspace property.</li>
64      * <li>{@link #IS_MAP} ("isMap") --
65      * Sets the CCImageField isMap property.</li>
66      * <li>{@link #LONG_DESC} ("longDesc") --
67      * Sets the CCImageField longDesc property.</li>
68      * <li>{@link #TITLE} ("title") --
69      * Sets the CCImageField title property.</li>
70      * <li>{@link #USE_MAP} ("useMap") --
71      * Sets the CCImageField useMap property.</li>
72      * <li>{@link #VSPACE} ("vspace") --
73      * Sets the CCImageField vspace property.</li>
74      * <li>{@link #WIDTH} ("width") --
75      * Sets the CCImageField width property.</li>
76      *
77      * @param ctx The RequestContext
78      * @param container The container for the new CCImageField
79      */

80     public View getInstance(RequestContext ctx, ContainerView container, String JavaDoc name) {
81     CCImageField image = new CCImageField(container, name, getInitialValue());
82     setBoundName(image);
83
84     // Align
85
String JavaDoc value = (String JavaDoc)getParameter(ALIGN);
86     if (value != null) {
87         image.setAlign(value);
88     }
89
90     // Alt
91
value = (String JavaDoc)getParameter(ALT);
92     if (value != null) {
93         image.setAlt(value);
94     }
95
96     // Border
97
value = (String JavaDoc)getParameter(BORDER);
98     if (value != null) {
99         image.setBorder(Integer.parseInt(value));
100     }
101
102     // ElementID
103
value = (String JavaDoc)getParameter(ELEMENT_ID);
104     if (value != null) {
105         image.setElementId(value);
106     }
107
108     // Height
109
value = (String JavaDoc)getParameter(HEIGHT);
110     if (value != null) {
111         image.setHeight(Integer.parseInt(value));
112     }
113
114     // HSpace
115
value = (String JavaDoc)getParameter(HSPACE);
116     if (value != null) {
117         image.setHspace(Integer.parseInt(value));
118     }
119
120     // IsMap
121
value = (String JavaDoc)getParameter(IS_MAP);
122     if (value != null) {
123         image.setIsMap(Boolean.valueOf(value).booleanValue());
124     }
125
126     // LongDesc
127
value = (String JavaDoc)getParameter(IS_MAP);
128     if (value != null) {
129         image.setLongDesc(value);
130     }
131
132     // Title
133
value = (String JavaDoc)getParameter(TITLE);
134     if (value != null) {
135         image.setTitle(value);
136     }
137
138     // UseMap
139
value = (String JavaDoc)getParameter(USE_MAP);
140     if (value != null) {
141         image.setUseMap(value);
142     }
143
144     // VSpace
145
value = (String JavaDoc)getParameter(VSPACE);
146     if (value != null) {
147         image.setVspace(Integer.parseInt(value));
148     }
149
150     // Width
151
value = (String JavaDoc)getParameter(WIDTH);
152     if (value != null) {
153         image.setWidth(Integer.parseInt(value));
154     }
155
156     return image;
157     }
158
159     /**
160      * <p> Parameter name to set the CCImageField align property value
161      * ("align").</p>
162      */

163     public static final String JavaDoc ALIGN = "align";
164
165     /**
166      * <p> Parameter name to set the CCImageField alt property value
167      * ("alt").</p>
168      */

169     public static final String JavaDoc ALT = "alt";
170
171     /**
172      * <p> Parameter name to set the CCImageField border property value
173      * ("border").</p>
174      */

175     public static final String JavaDoc BORDER = "border";
176
177     /**
178      * <p> Parameter name to set the CCImageField elementId property value
179      * ("elementId").</p>
180      */

181     public static final String JavaDoc ELEMENT_ID = "elementId";
182
183     /**
184      * <p> Parameter name to set the CCImageField height property value
185      * ("height").</p>
186      */

187     public static final String JavaDoc HEIGHT = "height";
188
189     /**
190      * <p> Parameter name to set the CCImageField hspace property value
191      * ("hspace").</p>
192      */

193     public static final String JavaDoc HSPACE = "hspace";
194
195     /**
196      * <p> Parameter name to set the CCImageField isMap property value
197      * ("isMap").</p>
198      */

199     public static final String JavaDoc IS_MAP = "isMap";
200
201     /**
202      * <p> Parameter name to set the CCImageField longDesc property value
203      * ("longDesc").</p>
204      */

205     public static final String JavaDoc LONG_DESC = "longDesc";
206
207     /**
208      * <p> Parameter name to set the CCImageField title property value
209      * ("title").</p>
210      */

211     public static final String JavaDoc TITLE = "title";
212
213     /**
214      * <p> Parameter name to set the CCImageField useMap property value
215      * ("useMap").</p>
216      */

217     public static final String JavaDoc USE_MAP = "useMap";
218
219     /**
220      * <p> Parameter name to set the CCImageField vspace property value
221      * ("vspace").</p>
222      */

223     public static final String JavaDoc VSPACE = "vspace";
224
225     /**
226      * <p> Parameter name to set the CCImageField width property value
227      * ("width").</p>
228      */

229     public static final String JavaDoc WIDTH = "width";
230 }
231
Popular Tags