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 * <p>Represents an HTML <code>label</code> element, used to define
55 * an accessible label for a corresponding input element.</p>
56 * <p>By default, the <code>rendererType</code> property must be set to "<code>javax.faces.Label</code>".
57 * This value can be changed by calling the <code>setRendererType()</code> method.</p>
58 */
59 public class HtmlOutputLabel extends javax.faces.component.UIOutput {
60
61
62
63 private static final String[] OPTIMIZED_PACKAGES = {
64 "javax.faces.component",
65 "javax.faces.component.html"
66 };
67
68 public HtmlOutputLabel() {
69 super();
70 setRendererType("javax.faces.Label");
71 }
72
73
74 /**
75 * <p>The standard component type for this component.</p>
76 */
77 public static final String COMPONENT_TYPE = "javax.faces.HtmlOutputLabel";
78
79
80 private java.lang.String accesskey;
81 /**
82 * <p>Return the value of the <code>accesskey</code> property.</p>
83 * <p>Contents: Access key that, when pressed, transfers focus
84 * to this element.
85 */
86 public java.lang.String getAccesskey() {
87 if (null != this.accesskey) {
88 return this.accesskey;
89 }
90 ValueExpression _ve = getValueExpression("accesskey");
91 if (_ve != null) {
92 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
93 } else {
94 return null;
95 }
96 }
97
98 /**
99 * <p>Set the value of the <code>accesskey</code> property.</p>
100 */
101 public void setAccesskey(java.lang.String accesskey) {
102 this.accesskey = accesskey;
103 handleAttribute("accesskey", accesskey);
104 }
105
106
107 private java.lang.String dir;
108 /**
109 * <p>Return the value of the <code>dir</code> property.</p>
110 * <p>Contents: Direction indication for text that does not inherit directionality.
111 * Valid values are "LTR" (left-to-right) and "RTL" (right-to-left).
112 */
113 public java.lang.String getDir() {
114 if (null != this.dir) {
115 return this.dir;
116 }
117 ValueExpression _ve = getValueExpression("dir");
118 if (_ve != null) {
119 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
120 } else {
121 return null;
122 }
123 }
124
125 /**
126 * <p>Set the value of the <code>dir</code> property.</p>
127 */
128 public void setDir(java.lang.String dir) {
129 this.dir = dir;
130 handleAttribute("dir", dir);
131 }
132
133
134 private java.lang.Boolean escape;
135 /**
136 * <p>Return the value of the <code>escape</code> property.</p>
137 * <p>Contents: Flag indicating that characters that are sensitive
138 * in HTML and XML markup must be escaped. If omitted, this
139 * flag is assumed to be "true".
140 */
141 public boolean isEscape() {
142 if (null != this.escape) {
143 return this.escape;
144 }
145 ValueExpression _ve = getValueExpression("escape");
146 if (_ve != null) {
147 return (java.lang.Boolean) _ve.getValue(getFacesContext().getELContext());
148 } else {
149 return true;
150 }
151 }
152
153 /**
154 * <p>Set the value of the <code>escape</code> property.</p>
155 */
156 public void setEscape(boolean escape) {
157 this.escape = escape;
158 }
159
160
161 private java.lang.String _for;
162 /**
163 * <p>Return the value of the <code>for</code> property.</p>
164 * <p>Contents: Client identifier of the component for which this element
165 * is a label.
166 */
167 public java.lang.String getFor() {
168 if (null != this._for) {
169 return this._for;
170 }
171 ValueExpression _ve = getValueExpression("for");
172 if (_ve != null) {
173 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
174 } else {
175 return null;
176 }
177 }
178
179 /**
180 * <p>Set the value of the <code>for</code> property.</p>
181 */
182 public void setFor(java.lang.String _for) {
183 this._for = _for;
184 }
185
186
187 private java.lang.String lang;
188 /**
189 * <p>Return the value of the <code>lang</code> property.</p>
190 * <p>Contents: Code describing the language used in the generated markup
191 * for this component.
192 */
193 public java.lang.String getLang() {
194 if (null != this.lang) {
195 return this.lang;
196 }
197 ValueExpression _ve = getValueExpression("lang");
198 if (_ve != null) {
199 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
200 } else {
201 return null;
202 }
203 }
204
205 /**
206 * <p>Set the value of the <code>lang</code> property.</p>
207 */
208 public void setLang(java.lang.String lang) {
209 this.lang = lang;
210 handleAttribute("lang", lang);
211 }
212
213
214 private java.lang.String onblur;
215 /**
216 * <p>Return the value of the <code>onblur</code> property.</p>
217 * <p>Contents: Javascript code executed when this element loses focus.
218 */
219 public java.lang.String getOnblur() {
220 if (null != this.onblur) {
221 return this.onblur;
222 }
223 ValueExpression _ve = getValueExpression("onblur");
224 if (_ve != null) {
225 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
226 } else {
227 return null;
228 }
229 }
230
231 /**
232 * <p>Set the value of the <code>onblur</code> property.</p>
233 */
234 public void setOnblur(java.lang.String onblur) {
235 this.onblur = onblur;
236 handleAttribute("onblur", onblur);
237 }
238
239
240 private java.lang.String onclick;
241 /**
242 * <p>Return the value of the <code>onclick</code> property.</p>
243 * <p>Contents: Javascript code executed when a pointer button is
244 * clicked over this element.
245 */
246 public java.lang.String getOnclick() {
247 if (null != this.onclick) {
248 return this.onclick;
249 }
250 ValueExpression _ve = getValueExpression("onclick");
251 if (_ve != null) {
252 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
253 } else {
254 return null;
255 }
256 }
257
258 /**
259 * <p>Set the value of the <code>onclick</code> property.</p>
260 */
261 public void setOnclick(java.lang.String onclick) {
262 this.onclick = onclick;
263 handleAttribute("onclick", onclick);
264 }
265
266
267 private java.lang.String ondblclick;
268 /**
269 * <p>Return the value of the <code>ondblclick</code> property.</p>
270 * <p>Contents: Javascript code executed when a pointer button is
271 * double clicked over this element.
272 */
273 public java.lang.String getOndblclick() {
274 if (null != this.ondblclick) {
275 return this.ondblclick;
276 }
277 ValueExpression _ve = getValueExpression("ondblclick");
278 if (_ve != null) {
279 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
280 } else {
281 return null;
282 }
283 }
284
285 /**
286 * <p>Set the value of the <code>ondblclick</code> property.</p>
287 */
288 public void setOndblclick(java.lang.String ondblclick) {
289 this.ondblclick = ondblclick;
290 handleAttribute("ondblclick", ondblclick);
291 }
292
293
294 private java.lang.String onfocus;
295 /**
296 * <p>Return the value of the <code>onfocus</code> property.</p>
297 * <p>Contents: Javascript code executed when this element receives focus.
298 */
299 public java.lang.String getOnfocus() {
300 if (null != this.onfocus) {
301 return this.onfocus;
302 }
303 ValueExpression _ve = getValueExpression("onfocus");
304 if (_ve != null) {
305 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
306 } else {
307 return null;
308 }
309 }
310
311 /**
312 * <p>Set the value of the <code>onfocus</code> property.</p>
313 */
314 public void setOnfocus(java.lang.String onfocus) {
315 this.onfocus = onfocus;
316 handleAttribute("onfocus", onfocus);
317 }
318
319
320 private java.lang.String onkeydown;
321 /**
322 * <p>Return the value of the <code>onkeydown</code> property.</p>
323 * <p>Contents: Javascript code executed when a key is
324 * pressed down over this element.
325 */
326 public java.lang.String getOnkeydown() {
327 if (null != this.onkeydown) {
328 return this.onkeydown;
329 }
330 ValueExpression _ve = getValueExpression("onkeydown");
331 if (_ve != null) {
332 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
333 } else {
334 return null;
335 }
336 }
337
338 /**
339 * <p>Set the value of the <code>onkeydown</code> property.</p>
340 */
341 public void setOnkeydown(java.lang.String onkeydown) {
342 this.onkeydown = onkeydown;
343 handleAttribute("onkeydown", onkeydown);
344 }
345
346
347 private java.lang.String onkeypress;
348 /**
349 * <p>Return the value of the <code>onkeypress</code> property.</p>
350 * <p>Contents: Javascript code executed when a key is
351 * pressed and released over this element.
352 */
353 public java.lang.String getOnkeypress() {
354 if (null != this.onkeypress) {
355 return this.onkeypress;
356 }
357 ValueExpression _ve = getValueExpression("onkeypress");
358 if (_ve != null) {
359 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
360 } else {
361 return null;
362 }
363 }
364
365 /**
366 * <p>Set the value of the <code>onkeypress</code> property.</p>
367 */
368 public void setOnkeypress(java.lang.String onkeypress) {
369 this.onkeypress = onkeypress;
370 handleAttribute("onkeypress", onkeypress);
371 }
372
373
374 private java.lang.String onkeyup;
375 /**
376 * <p>Return the value of the <code>onkeyup</code> property.</p>
377 * <p>Contents: Javascript code executed when a key is
378 * released over this element.
379 */
380 public java.lang.String getOnkeyup() {
381 if (null != this.onkeyup) {
382 return this.onkeyup;
383 }
384 ValueExpression _ve = getValueExpression("onkeyup");
385 if (_ve != null) {
386 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
387 } else {
388 return null;
389 }
390 }
391
392 /**
393 * <p>Set the value of the <code>onkeyup</code> property.</p>
394 */
395 public void setOnkeyup(java.lang.String onkeyup) {
396 this.onkeyup = onkeyup;
397 handleAttribute("onkeyup", onkeyup);
398 }
399
400
401 private java.lang.String onmousedown;
402 /**
403 * <p>Return the value of the <code>onmousedown</code> property.</p>
404 * <p>Contents: Javascript code executed when a pointer button is
405 * pressed down over this element.
406 */
407 public java.lang.String getOnmousedown() {
408 if (null != this.onmousedown) {
409 return this.onmousedown;
410 }
411 ValueExpression _ve = getValueExpression("onmousedown");
412 if (_ve != null) {
413 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
414 } else {
415 return null;
416 }
417 }
418
419 /**
420 * <p>Set the value of the <code>onmousedown</code> property.</p>
421 */
422 public void setOnmousedown(java.lang.String onmousedown) {
423 this.onmousedown = onmousedown;
424 handleAttribute("onmousedown", onmousedown);
425 }
426
427
428 private java.lang.String onmousemove;
429 /**
430 * <p>Return the value of the <code>onmousemove</code> property.</p>
431 * <p>Contents: Javascript code executed when a pointer button is
432 * moved within this element.
433 */
434 public java.lang.String getOnmousemove() {
435 if (null != this.onmousemove) {
436 return this.onmousemove;
437 }
438 ValueExpression _ve = getValueExpression("onmousemove");
439 if (_ve != null) {
440 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
441 } else {
442 return null;
443 }
444 }
445
446 /**
447 * <p>Set the value of the <code>onmousemove</code> property.</p>
448 */
449 public void setOnmousemove(java.lang.String onmousemove) {
450 this.onmousemove = onmousemove;
451 handleAttribute("onmousemove", onmousemove);
452 }
453
454
455 private java.lang.String onmouseout;
456 /**
457 * <p>Return the value of the <code>onmouseout</code> property.</p>
458 * <p>Contents: Javascript code executed when a pointer button is
459 * moved away from this element.
460 */
461 public java.lang.String getOnmouseout() {
462 if (null != this.onmouseout) {
463 return this.onmouseout;
464 }
465 ValueExpression _ve = getValueExpression("onmouseout");
466 if (_ve != null) {
467 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
468 } else {
469 return null;
470 }
471 }
472
473 /**
474 * <p>Set the value of the <code>onmouseout</code> property.</p>
475 */
476 public void setOnmouseout(java.lang.String onmouseout) {
477 this.onmouseout = onmouseout;
478 handleAttribute("onmouseout", onmouseout);
479 }
480
481
482 private java.lang.String onmouseover;
483 /**
484 * <p>Return the value of the <code>onmouseover</code> property.</p>
485 * <p>Contents: Javascript code executed when a pointer button is
486 * moved onto this element.
487 */
488 public java.lang.String getOnmouseover() {
489 if (null != this.onmouseover) {
490 return this.onmouseover;
491 }
492 ValueExpression _ve = getValueExpression("onmouseover");
493 if (_ve != null) {
494 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
495 } else {
496 return null;
497 }
498 }
499
500 /**
501 * <p>Set the value of the <code>onmouseover</code> property.</p>
502 */
503 public void setOnmouseover(java.lang.String onmouseover) {
504 this.onmouseover = onmouseover;
505 handleAttribute("onmouseover", onmouseover);
506 }
507
508
509 private java.lang.String onmouseup;
510 /**
511 * <p>Return the value of the <code>onmouseup</code> property.</p>
512 * <p>Contents: Javascript code executed when a pointer button is
513 * released over this element.
514 */
515 public java.lang.String getOnmouseup() {
516 if (null != this.onmouseup) {
517 return this.onmouseup;
518 }
519 ValueExpression _ve = getValueExpression("onmouseup");
520 if (_ve != null) {
521 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
522 } else {
523 return null;
524 }
525 }
526
527 /**
528 * <p>Set the value of the <code>onmouseup</code> property.</p>
529 */
530 public void setOnmouseup(java.lang.String onmouseup) {
531 this.onmouseup = onmouseup;
532 handleAttribute("onmouseup", onmouseup);
533 }
534
535
536 private java.lang.String style;
537 /**
538 * <p>Return the value of the <code>style</code> property.</p>
539 * <p>Contents: CSS style(s) to be applied when this component is rendered.
540 */
541 public java.lang.String getStyle() {
542 if (null != this.style) {
543 return this.style;
544 }
545 ValueExpression _ve = getValueExpression("style");
546 if (_ve != null) {
547 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
548 } else {
549 return null;
550 }
551 }
552
553 /**
554 * <p>Set the value of the <code>style</code> property.</p>
555 */
556 public void setStyle(java.lang.String style) {
557 this.style = style;
558 handleAttribute("style", style);
559 }
560
561
562 private java.lang.String styleClass;
563 /**
564 * <p>Return the value of the <code>styleClass</code> property.</p>
565 * <p>Contents: Space-separated list of CSS style class(es) to be applied when
566 * this element is rendered. This value must be passed through
567 * as the "class" attribute on generated markup.
568 */
569 public java.lang.String getStyleClass() {
570 if (null != this.styleClass) {
571 return this.styleClass;
572 }
573 ValueExpression _ve = getValueExpression("styleClass");
574 if (_ve != null) {
575 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
576 } else {
577 return null;
578 }
579 }
580
581 /**
582 * <p>Set the value of the <code>styleClass</code> property.</p>
583 */
584 public void setStyleClass(java.lang.String styleClass) {
585 this.styleClass = styleClass;
586 }
587
588
589 private java.lang.String tabindex;
590 /**
591 * <p>Return the value of the <code>tabindex</code> property.</p>
592 * <p>Contents: Position of this element in the tabbing order
593 * for the current document. This value must be
594 * an integer between 0 and 32767.
595 */
596 public java.lang.String getTabindex() {
597 if (null != this.tabindex) {
598 return this.tabindex;
599 }
600 ValueExpression _ve = getValueExpression("tabindex");
601 if (_ve != null) {
602 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
603 } else {
604 return null;
605 }
606 }
607
608 /**
609 * <p>Set the value of the <code>tabindex</code> property.</p>
610 */
611 public void setTabindex(java.lang.String tabindex) {
612 this.tabindex = tabindex;
613 handleAttribute("tabindex", tabindex);
614 }
615
616
617 private java.lang.String title;
618 /**
619 * <p>Return the value of the <code>title</code> property.</p>
620 * <p>Contents: Advisory title information about markup elements generated
621 * for this component.
622 */
623 public java.lang.String getTitle() {
624 if (null != this.title) {
625 return this.title;
626 }
627 ValueExpression _ve = getValueExpression("title");
628 if (_ve != null) {
629 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
630 } else {
631 return null;
632 }
633 }
634
635 /**
636 * <p>Set the value of the <code>title</code> property.</p>
637 */
638 public void setTitle(java.lang.String title) {
639 this.title = title;
640 handleAttribute("title", title);
641 }
642
643
644 private Object[] _values;
645
646 public Object saveState(FacesContext _context) {
647 if (_values == null) {
648 _values = new Object[22];
649 }
650 _values[0] = super.saveState(_context);
651 _values[1] = accesskey;
652 _values[2] = dir;
653 _values[3] = escape;
654 _values[4] = _for;
655 _values[5] = lang;
656 _values[6] = onblur;
657 _values[7] = onclick;
658 _values[8] = ondblclick;
659 _values[9] = onfocus;
660 _values[10] = onkeydown;
661 _values[11] = onkeypress;
662 _values[12] = onkeyup;
663 _values[13] = onmousedown;
664 _values[14] = onmousemove;
665 _values[15] = onmouseout;
666 _values[16] = onmouseover;
667 _values[17] = onmouseup;
668 _values[18] = style;
669 _values[19] = styleClass;
670 _values[20] = tabindex;
671 _values[21] = title;
672 return _values;
673 }
674
675
676 public void restoreState(FacesContext _context, Object _state) {
677 _values = (Object[]) _state;
678 super.restoreState(_context, _values[0]);
679 this.accesskey = (java.lang.String) _values[1];
680 this.dir = (java.lang.String) _values[2];
681 this.escape = (java.lang.Boolean) _values[3];
682 this._for = (java.lang.String) _values[4];
683 this.lang = (java.lang.String) _values[5];
684 this.onblur = (java.lang.String) _values[6];
685 this.onclick = (java.lang.String) _values[7];
686 this.ondblclick = (java.lang.String) _values[8];
687 this.onfocus = (java.lang.String) _values[9];
688 this.onkeydown = (java.lang.String) _values[10];
689 this.onkeypress = (java.lang.String) _values[11];
690 this.onkeyup = (java.lang.String) _values[12];
691 this.onmousedown = (java.lang.String) _values[13];
692 this.onmousemove = (java.lang.String) _values[14];
693 this.onmouseout = (java.lang.String) _values[15];
694 this.onmouseover = (java.lang.String) _values[16];
695 this.onmouseup = (java.lang.String) _values[17];
696 this.style = (java.lang.String) _values[18];
697 this.styleClass = (java.lang.String) _values[19];
698 this.tabindex = (java.lang.String) _values[20];
699 this.title = (java.lang.String) _values[21];
700 }
701
702
703 private void handleAttribute(String name, Object value) {
704 List<String> setAttributes = null;
705 String pkg = this.getClass().getPackage().getName();
706 if (Arrays.binarySearch(OPTIMIZED_PACKAGES, pkg) >= 0) {
707 setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet");
708 if (setAttributes == null) {
709 setAttributes = new ArrayList<String>(6);
710 this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes);
711 }
712 if (value == null) {
713 setAttributes.remove(name);
714 } else if (!setAttributes.contains(name)) {
715 setAttributes.add(name);
716 }
717 }
718 }
719
720 }