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