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.Messages</code>".
56 * This value can be changed by calling the <code>setRendererType()</code> method.</p>
57 */
58 public class HtmlMessages extends javax.faces.component.UIMessages {
59
60
61
62 private static final String[] OPTIMIZED_PACKAGES = {
63 "javax.faces.component",
64 "javax.faces.component.html"
65 };
66
67 public HtmlMessages() {
68 super();
69 setRendererType("javax.faces.Messages");
70 }
71
72
73 /**
74 * <p>The standard component type for this component.</p>
75 */
76 public static final String COMPONENT_TYPE = "javax.faces.HtmlMessages";
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 layout;
290 /**
291 * <p>Return the value of the <code>layout</code> property.</p>
292 * <p>Contents: The type of layout markup to use when rendering
293 * error messages. Valid values are "table" (an HTML
294 * table) and "list" (an HTML list). If not specified,
295 * the default value is "list".
296 */
297 public java.lang.String getLayout() {
298 if (null != this.layout) {
299 return this.layout;
300 }
301 ValueExpression _ve = getValueExpression("layout");
302 if (_ve != null) {
303 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
304 } else {
305 return "list";
306 }
307 }
308
309 /**
310 * <p>Set the value of the <code>layout</code> property.</p>
311 */
312 public void setLayout(java.lang.String layout) {
313 this.layout = layout;
314 }
315
316
317 private java.lang.String style;
318 /**
319 * <p>Return the value of the <code>style</code> property.</p>
320 * <p>Contents: CSS style(s) to be applied when this component is rendered.
321 */
322 public java.lang.String getStyle() {
323 if (null != this.style) {
324 return this.style;
325 }
326 ValueExpression _ve = getValueExpression("style");
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>style</code> property.</p>
336 */
337 public void setStyle(java.lang.String style) {
338 this.style = style;
339 handleAttribute("style", style);
340 }
341
342
343 private java.lang.String styleClass;
344 /**
345 * <p>Return the value of the <code>styleClass</code> property.</p>
346 * <p>Contents: Space-separated list of CSS style class(es) to be applied when
347 * this element is rendered. This value must be passed through
348 * as the "class" attribute on generated markup.
349 */
350 public java.lang.String getStyleClass() {
351 if (null != this.styleClass) {
352 return this.styleClass;
353 }
354 ValueExpression _ve = getValueExpression("styleClass");
355 if (_ve != null) {
356 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
357 } else {
358 return null;
359 }
360 }
361
362 /**
363 * <p>Set the value of the <code>styleClass</code> property.</p>
364 */
365 public void setStyleClass(java.lang.String styleClass) {
366 this.styleClass = styleClass;
367 }
368
369
370 private java.lang.String title;
371 /**
372 * <p>Return the value of the <code>title</code> property.</p>
373 * <p>Contents: Advisory title information about markup elements generated
374 * for this component.
375 */
376 public java.lang.String getTitle() {
377 if (null != this.title) {
378 return this.title;
379 }
380 ValueExpression _ve = getValueExpression("title");
381 if (_ve != null) {
382 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
383 } else {
384 return null;
385 }
386 }
387
388 /**
389 * <p>Set the value of the <code>title</code> property.</p>
390 */
391 public void setTitle(java.lang.String title) {
392 this.title = title;
393 handleAttribute("title", title);
394 }
395
396
397 private java.lang.Boolean tooltip;
398 /**
399 * <p>Return the value of the <code>tooltip</code> property.</p>
400 * <p>Contents: Flag indicating whether the detail portion of the
401 * message should be displayed as a tooltip.
402 */
403 public boolean isTooltip() {
404 if (null != this.tooltip) {
405 return this.tooltip;
406 }
407 ValueExpression _ve = getValueExpression("tooltip");
408 if (_ve != null) {
409 return (java.lang.Boolean) _ve.getValue(getFacesContext().getELContext());
410 } else {
411 return false;
412 }
413 }
414
415 /**
416 * <p>Set the value of the <code>tooltip</code> property.</p>
417 */
418 public void setTooltip(boolean tooltip) {
419 this.tooltip = tooltip;
420 }
421
422
423 private java.lang.String warnClass;
424 /**
425 * <p>Return the value of the <code>warnClass</code> property.</p>
426 * <p>Contents: CSS style class to apply to any message
427 * with a severity class of "WARN".
428 */
429 public java.lang.String getWarnClass() {
430 if (null != this.warnClass) {
431 return this.warnClass;
432 }
433 ValueExpression _ve = getValueExpression("warnClass");
434 if (_ve != null) {
435 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
436 } else {
437 return null;
438 }
439 }
440
441 /**
442 * <p>Set the value of the <code>warnClass</code> property.</p>
443 */
444 public void setWarnClass(java.lang.String warnClass) {
445 this.warnClass = warnClass;
446 }
447
448
449 private java.lang.String warnStyle;
450 /**
451 * <p>Return the value of the <code>warnStyle</code> property.</p>
452 * <p>Contents: CSS style(s) to apply to any message
453 * with a severity class of "WARN".
454 */
455 public java.lang.String getWarnStyle() {
456 if (null != this.warnStyle) {
457 return this.warnStyle;
458 }
459 ValueExpression _ve = getValueExpression("warnStyle");
460 if (_ve != null) {
461 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
462 } else {
463 return null;
464 }
465 }
466
467 /**
468 * <p>Set the value of the <code>warnStyle</code> property.</p>
469 */
470 public void setWarnStyle(java.lang.String warnStyle) {
471 this.warnStyle = warnStyle;
472 }
473
474
475 private Object[] _values;
476
477 public Object saveState(FacesContext _context) {
478 if (_values == null) {
479 _values = new Object[16];
480 }
481 _values[0] = super.saveState(_context);
482 _values[1] = dir;
483 _values[2] = errorClass;
484 _values[3] = errorStyle;
485 _values[4] = fatalClass;
486 _values[5] = fatalStyle;
487 _values[6] = infoClass;
488 _values[7] = infoStyle;
489 _values[8] = lang;
490 _values[9] = layout;
491 _values[10] = style;
492 _values[11] = styleClass;
493 _values[12] = title;
494 _values[13] = tooltip;
495 _values[14] = warnClass;
496 _values[15] = warnStyle;
497 return _values;
498 }
499
500
501 public void restoreState(FacesContext _context, Object _state) {
502 _values = (Object[]) _state;
503 super.restoreState(_context, _values[0]);
504 this.dir = (java.lang.String) _values[1];
505 this.errorClass = (java.lang.String) _values[2];
506 this.errorStyle = (java.lang.String) _values[3];
507 this.fatalClass = (java.lang.String) _values[4];
508 this.fatalStyle = (java.lang.String) _values[5];
509 this.infoClass = (java.lang.String) _values[6];
510 this.infoStyle = (java.lang.String) _values[7];
511 this.lang = (java.lang.String) _values[8];
512 this.layout = (java.lang.String) _values[9];
513 this.style = (java.lang.String) _values[10];
514 this.styleClass = (java.lang.String) _values[11];
515 this.title = (java.lang.String) _values[12];
516 this.tooltip = (java.lang.Boolean) _values[13];
517 this.warnClass = (java.lang.String) _values[14];
518 this.warnStyle = (java.lang.String) _values[15];
519 }
520
521
522 private void handleAttribute(String name, Object value) {
523 List<String> setAttributes = null;
524 String pkg = this.getClass().getPackage().getName();
525 if (Arrays.binarySearch(OPTIMIZED_PACKAGES, pkg) >= 0) {
526 setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet");
527 if (setAttributes == null) {
528 setAttributes = new ArrayList<String>(6);
529 this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes);
530 }
531 if (value == null) {
532 setAttributes.remove(name);
533 } else if (!setAttributes.contains(name)) {
534 setAttributes.add(name);
535 }
536 }
537 }
538
539 }