1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License("CDDL") (collectively, the "License"). You
9 * may not use this file except in compliance with the License. You can obtain
10 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
12 * language governing permissions and limitations under the License.
13 *
14 * When distributing the software, include this License Header Notice in each
15 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
16 * Sun designates this particular file as subject to the "Classpath" exception
17 * as provided by Sun in the GPL Version 2 section of the License file that
18 * accompanied this code. If applicable, add the following below the License
19 * Header, with the fields enclosed by brackets [] replaced by your own
20 * identifying information: "Portions Copyrighted [year]
21 * [name of copyright owner]"
22 *
23 * Contributor(s):
24 *
25 * If you wish your version of this file to be governed by only the CDDL or
26 * only the GPL Version 2, indicate your decision by adding "[Contributor]
27 * elects to include this software in this distribution under the [CDDL or GPL
28 * Version 2] license." If you don't indicate a single choice of license, a
29 * recipient has the option to distribute your version of this file under
30 * either the CDDL, the GPL Version 2 or to extend the choice of license to
31 * its licensees as provided above. However, if you add GPL Version 2 code
32 * and therefore, elected the GPL Version 2 license, then the option applies
33 * only if the new code is made subject to such option by the copyright
34 * holder.
35 */
36 package javax.faces.component.html;
37
38 import java.io.IOException;
39 import java.util.List;
40 import java.util.ArrayList;
41 import java.util.Arrays;
42
43 import javax.faces.context.FacesContext;
44 import javax.el.MethodExpression;
45 import javax.el.ValueExpression;
46
47
48 /*
49 * ******* GENERATED CODE - DO NOT EDIT *******
50 */
51
52
53 /**
54 *
55 * <p>By default, the <code>rendererType</code> property must be set to "<code>javax.faces.Message</code>".
56 * This value can be changed by calling the <code>setRendererType()</code> method.</p>
57 */
58 public class HtmlMessage extends javax.faces.component.UIMessage {
59
60
61
62 private static final String[] OPTIMIZED_PACKAGES = {
63 "javax.faces.component",
64 "javax.faces.component.html"
65 };
66
67 public HtmlMessage() {
68 super();
69 setRendererType("javax.faces.Message");
70 }
71
72
73 /**
74 * <p>The standard component type for this component.</p>
75 */
76 public static final String COMPONENT_TYPE = "javax.faces.HtmlMessage";
77
78
79 private java.lang.String dir;
80 /**
81 * <p>Return the value of the <code>dir</code> property.</p>
82 * <p>Contents: Direction indication for text that does not inherit directionality.
83 * Valid values are "LTR" (left-to-right) and "RTL" (right-to-left).
84 */
85 public java.lang.String getDir() {
86 if (null != this.dir) {
87 return this.dir;
88 }
89 ValueExpression _ve = getValueExpression("dir");
90 if (_ve != null) {
91 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
92 } else {
93 return null;
94 }
95 }
96
97 /**
98 * <p>Set the value of the <code>dir</code> property.</p>
99 */
100 public void setDir(java.lang.String dir) {
101 this.dir = dir;
102 handleAttribute("dir", dir);
103 }
104
105
106 private java.lang.String errorClass;
107 /**
108 * <p>Return the value of the <code>errorClass</code> property.</p>
109 * <p>Contents: CSS style class to apply to any message
110 * with a severity class of "ERROR".
111 */
112 public java.lang.String getErrorClass() {
113 if (null != this.errorClass) {
114 return this.errorClass;
115 }
116 ValueExpression _ve = getValueExpression("errorClass");
117 if (_ve != null) {
118 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
119 } else {
120 return null;
121 }
122 }
123
124 /**
125 * <p>Set the value of the <code>errorClass</code> property.</p>
126 */
127 public void setErrorClass(java.lang.String errorClass) {
128 this.errorClass = errorClass;
129 }
130
131
132 private java.lang.String errorStyle;
133 /**
134 * <p>Return the value of the <code>errorStyle</code> property.</p>
135 * <p>Contents: CSS style(s) to apply to any message
136 * with a severity class of "ERROR".
137 */
138 public java.lang.String getErrorStyle() {
139 if (null != this.errorStyle) {
140 return this.errorStyle;
141 }
142 ValueExpression _ve = getValueExpression("errorStyle");
143 if (_ve != null) {
144 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
145 } else {
146 return null;
147 }
148 }
149
150 /**
151 * <p>Set the value of the <code>errorStyle</code> property.</p>
152 */
153 public void setErrorStyle(java.lang.String errorStyle) {
154 this.errorStyle = errorStyle;
155 }
156
157
158 private java.lang.String fatalClass;
159 /**
160 * <p>Return the value of the <code>fatalClass</code> property.</p>
161 * <p>Contents: CSS style class to apply to any message
162 * with a severity class of "FATAL".
163 */
164 public java.lang.String getFatalClass() {
165 if (null != this.fatalClass) {
166 return this.fatalClass;
167 }
168 ValueExpression _ve = getValueExpression("fatalClass");
169 if (_ve != null) {
170 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
171 } else {
172 return null;
173 }
174 }
175
176 /**
177 * <p>Set the value of the <code>fatalClass</code> property.</p>
178 */
179 public void setFatalClass(java.lang.String fatalClass) {
180 this.fatalClass = fatalClass;
181 }
182
183
184 private java.lang.String fatalStyle;
185 /**
186 * <p>Return the value of the <code>fatalStyle</code> property.</p>
187 * <p>Contents: CSS style(s) to apply to any message
188 * with a severity class of "FATAL".
189 */
190 public java.lang.String getFatalStyle() {
191 if (null != this.fatalStyle) {
192 return this.fatalStyle;
193 }
194 ValueExpression _ve = getValueExpression("fatalStyle");
195 if (_ve != null) {
196 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
197 } else {
198 return null;
199 }
200 }
201
202 /**
203 * <p>Set the value of the <code>fatalStyle</code> property.</p>
204 */
205 public void setFatalStyle(java.lang.String fatalStyle) {
206 this.fatalStyle = fatalStyle;
207 }
208
209
210 private java.lang.String infoClass;
211 /**
212 * <p>Return the value of the <code>infoClass</code> property.</p>
213 * <p>Contents: CSS style class to apply to any message
214 * with a severity class of "INFO".
215 */
216 public java.lang.String getInfoClass() {
217 if (null != this.infoClass) {
218 return this.infoClass;
219 }
220 ValueExpression _ve = getValueExpression("infoClass");
221 if (_ve != null) {
222 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
223 } else {
224 return null;
225 }
226 }
227
228 /**
229 * <p>Set the value of the <code>infoClass</code> property.</p>
230 */
231 public void setInfoClass(java.lang.String infoClass) {
232 this.infoClass = infoClass;
233 }
234
235
236 private java.lang.String infoStyle;
237 /**
238 * <p>Return the value of the <code>infoStyle</code> property.</p>
239 * <p>Contents: CSS style(s) to apply to any message
240 * with a severity class of "INFO".
241 */
242 public java.lang.String getInfoStyle() {
243 if (null != this.infoStyle) {
244 return this.infoStyle;
245 }
246 ValueExpression _ve = getValueExpression("infoStyle");
247 if (_ve != null) {
248 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
249 } else {
250 return null;
251 }
252 }
253
254 /**
255 * <p>Set the value of the <code>infoStyle</code> property.</p>
256 */
257 public void setInfoStyle(java.lang.String infoStyle) {
258 this.infoStyle = infoStyle;
259 }
260
261
262 private java.lang.String lang;
263 /**
264 * <p>Return the value of the <code>lang</code> property.</p>
265 * <p>Contents: Code describing the language used in the generated markup
266 * for this component.
267 */
268 public java.lang.String getLang() {
269 if (null != this.lang) {
270 return this.lang;
271 }
272 ValueExpression _ve = getValueExpression("lang");
273 if (_ve != null) {
274 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
275 } else {
276 return null;
277 }
278 }
279
280 /**
281 * <p>Set the value of the <code>lang</code> property.</p>
282 */
283 public void setLang(java.lang.String lang) {
284 this.lang = lang;
285 handleAttribute("lang", lang);
286 }
287
288
289 private java.lang.String style;
290 /**
291 * <p>Return the value of the <code>style</code> property.</p>
292 * <p>Contents: CSS style(s) to be applied when this component is rendered.
293 */
294 public java.lang.String getStyle() {
295 if (null != this.style) {
296 return this.style;
297 }
298 ValueExpression _ve = getValueExpression("style");
299 if (_ve != null) {
300 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
301 } else {
302 return null;
303 }
304 }
305
306 /**
307 * <p>Set the value of the <code>style</code> property.</p>
308 */
309 public void setStyle(java.lang.String style) {
310 this.style = style;
311 handleAttribute("style", style);
312 }
313
314
315 private java.lang.String styleClass;
316 /**
317 * <p>Return the value of the <code>styleClass</code> property.</p>
318 * <p>Contents: Space-separated list of CSS style class(es) to be applied when
319 * this element is rendered. This value must be passed through
320 * as the "class" attribute on generated markup.
321 */
322 public java.lang.String getStyleClass() {
323 if (null != this.styleClass) {
324 return this.styleClass;
325 }
326 ValueExpression _ve = getValueExpression("styleClass");
327 if (_ve != null) {
328 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
329 } else {
330 return null;
331 }
332 }
333
334 /**
335 * <p>Set the value of the <code>styleClass</code> property.</p>
336 */
337 public void setStyleClass(java.lang.String styleClass) {
338 this.styleClass = styleClass;
339 }
340
341
342 private java.lang.String title;
343 /**
344 * <p>Return the value of the <code>title</code> property.</p>
345 * <p>Contents: Advisory title information about markup elements generated
346 * for this component.
347 */
348 public java.lang.String getTitle() {
349 if (null != this.title) {
350 return this.title;
351 }
352 ValueExpression _ve = getValueExpression("title");
353 if (_ve != null) {
354 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
355 } else {
356 return null;
357 }
358 }
359
360 /**
361 * <p>Set the value of the <code>title</code> property.</p>
362 */
363 public void setTitle(java.lang.String title) {
364 this.title = title;
365 handleAttribute("title", title);
366 }
367
368
369 private java.lang.Boolean tooltip;
370 /**
371 * <p>Return the value of the <code>tooltip</code> property.</p>
372 * <p>Contents: Flag indicating whether the detail portion of the
373 * message should be displayed as a tooltip.
374 */
375 public boolean isTooltip() {
376 if (null != this.tooltip) {
377 return this.tooltip;
378 }
379 ValueExpression _ve = getValueExpression("tooltip");
380 if (_ve != null) {
381 return (java.lang.Boolean) _ve.getValue(getFacesContext().getELContext());
382 } else {
383 return false;
384 }
385 }
386
387 /**
388 * <p>Set the value of the <code>tooltip</code> property.</p>
389 */
390 public void setTooltip(boolean tooltip) {
391 this.tooltip = tooltip;
392 }
393
394
395 private java.lang.String warnClass;
396 /**
397 * <p>Return the value of the <code>warnClass</code> property.</p>
398 * <p>Contents: CSS style class to apply to any message
399 * with a severity class of "WARN".
400 */
401 public java.lang.String getWarnClass() {
402 if (null != this.warnClass) {
403 return this.warnClass;
404 }
405 ValueExpression _ve = getValueExpression("warnClass");
406 if (_ve != null) {
407 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
408 } else {
409 return null;
410 }
411 }
412
413 /**
414 * <p>Set the value of the <code>warnClass</code> property.</p>
415 */
416 public void setWarnClass(java.lang.String warnClass) {
417 this.warnClass = warnClass;
418 }
419
420
421 private java.lang.String warnStyle;
422 /**
423 * <p>Return the value of the <code>warnStyle</code> property.</p>
424 * <p>Contents: CSS style(s) to apply to any message
425 * with a severity class of "WARN".
426 */
427 public java.lang.String getWarnStyle() {
428 if (null != this.warnStyle) {
429 return this.warnStyle;
430 }
431 ValueExpression _ve = getValueExpression("warnStyle");
432 if (_ve != null) {
433 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
434 } else {
435 return null;
436 }
437 }
438
439 /**
440 * <p>Set the value of the <code>warnStyle</code> property.</p>
441 */
442 public void setWarnStyle(java.lang.String warnStyle) {
443 this.warnStyle = warnStyle;
444 }
445
446
447 private Object[] _values;
448
449 public Object saveState(FacesContext _context) {
450 if (_values == null) {
451 _values = new Object[15];
452 }
453 _values[0] = super.saveState(_context);
454 _values[1] = dir;
455 _values[2] = errorClass;
456 _values[3] = errorStyle;
457 _values[4] = fatalClass;
458 _values[5] = fatalStyle;
459 _values[6] = infoClass;
460 _values[7] = infoStyle;
461 _values[8] = lang;
462 _values[9] = style;
463 _values[10] = styleClass;
464 _values[11] = title;
465 _values[12] = tooltip;
466 _values[13] = warnClass;
467 _values[14] = warnStyle;
468 return _values;
469 }
470
471
472 public void restoreState(FacesContext _context, Object _state) {
473 _values = (Object[]) _state;
474 super.restoreState(_context, _values[0]);
475 this.dir = (java.lang.String) _values[1];
476 this.errorClass = (java.lang.String) _values[2];
477 this.errorStyle = (java.lang.String) _values[3];
478 this.fatalClass = (java.lang.String) _values[4];
479 this.fatalStyle = (java.lang.String) _values[5];
480 this.infoClass = (java.lang.String) _values[6];
481 this.infoStyle = (java.lang.String) _values[7];
482 this.lang = (java.lang.String) _values[8];
483 this.style = (java.lang.String) _values[9];
484 this.styleClass = (java.lang.String) _values[10];
485 this.title = (java.lang.String) _values[11];
486 this.tooltip = (java.lang.Boolean) _values[12];
487 this.warnClass = (java.lang.String) _values[13];
488 this.warnStyle = (java.lang.String) _values[14];
489 }
490
491
492 private void handleAttribute(String name, Object value) {
493 List<String> setAttributes = null;
494 String pkg = this.getClass().getPackage().getName();
495 if (Arrays.binarySearch(OPTIMIZED_PACKAGES, pkg) >= 0) {
496 setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet");
497 if (setAttributes == null) {
498 setAttributes = new ArrayList<String>(6);
499 this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes);
500 }
501 if (value == null) {
502 setAttributes.remove(name);
503 } else if (!setAttributes.contains(name)) {
504 setAttributes.add(name);
505 }
506 }
507 }
508
509 }