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>form</code> element. Child input components
55 * will be submitted unless they have been disabled.</p>
56 * <p>By default, the <code>rendererType</code> property must be set to "<code>javax.faces.Form</code>".
57 * This value can be changed by calling the <code>setRendererType()</code> method.</p>
58 */
59 public class HtmlForm extends javax.faces.component.UIForm {
60
61
62
63 private static final String[] OPTIMIZED_PACKAGES = {
64 "javax.faces.component",
65 "javax.faces.component.html"
66 };
67
68 public HtmlForm() {
69 super();
70 setRendererType("javax.faces.Form");
71 handleAttribute("enctype", "application/x-www-form-urlencoded");
72 }
73
74
75 /**
76 * <p>The standard component type for this component.</p>
77 */
78 public static final String COMPONENT_TYPE = "javax.faces.HtmlForm";
79
80
81 private java.lang.String accept;
82 /**
83 * <p>Return the value of the <code>accept</code> property.</p>
84 * <p>Contents: List of content types that a server processing this form
85 * will handle correctly
86 */
87 public java.lang.String getAccept() {
88 if (null != this.accept) {
89 return this.accept;
90 }
91 ValueExpression _ve = getValueExpression("accept");
92 if (_ve != null) {
93 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
94 } else {
95 return null;
96 }
97 }
98
99 /**
100 * <p>Set the value of the <code>accept</code> property.</p>
101 */
102 public void setAccept(java.lang.String accept) {
103 this.accept = accept;
104 handleAttribute("accept", accept);
105 }
106
107
108 private java.lang.String acceptcharset;
109 /**
110 * <p>Return the value of the <code>acceptcharset</code> property.</p>
111 * <p>Contents: List of character encodings for input data
112 * that are accepted by the server processing
113 * this form.
114 */
115 public java.lang.String getAcceptcharset() {
116 if (null != this.acceptcharset) {
117 return this.acceptcharset;
118 }
119 ValueExpression _ve = getValueExpression("acceptcharset");
120 if (_ve != null) {
121 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
122 } else {
123 return null;
124 }
125 }
126
127 /**
128 * <p>Set the value of the <code>acceptcharset</code> property.</p>
129 */
130 public void setAcceptcharset(java.lang.String acceptcharset) {
131 this.acceptcharset = acceptcharset;
132 }
133
134
135 private java.lang.String dir;
136 /**
137 * <p>Return the value of the <code>dir</code> property.</p>
138 * <p>Contents: Direction indication for text that does not inherit directionality.
139 * Valid values are "LTR" (left-to-right) and "RTL" (right-to-left).
140 */
141 public java.lang.String getDir() {
142 if (null != this.dir) {
143 return this.dir;
144 }
145 ValueExpression _ve = getValueExpression("dir");
146 if (_ve != null) {
147 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
148 } else {
149 return null;
150 }
151 }
152
153 /**
154 * <p>Set the value of the <code>dir</code> property.</p>
155 */
156 public void setDir(java.lang.String dir) {
157 this.dir = dir;
158 handleAttribute("dir", dir);
159 }
160
161
162 private java.lang.String enctype;
163 /**
164 * <p>Return the value of the <code>enctype</code> property.</p>
165 * <p>Contents: Content type used to submit the form to the server. If not
166 * specified, the default value is
167 * "application/x-www-form-urlencoded".
168 */
169 public java.lang.String getEnctype() {
170 if (null != this.enctype) {
171 return this.enctype;
172 }
173 ValueExpression _ve = getValueExpression("enctype");
174 if (_ve != null) {
175 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
176 } else {
177 return "application/x-www-form-urlencoded";
178 }
179 }
180
181 /**
182 * <p>Set the value of the <code>enctype</code> property.</p>
183 */
184 public void setEnctype(java.lang.String enctype) {
185 this.enctype = enctype;
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 onclick;
217 /**
218 * <p>Return the value of the <code>onclick</code> property.</p>
219 * <p>Contents: Javascript code executed when a pointer button is
220 * clicked over this element.
221 */
222 public java.lang.String getOnclick() {
223 if (null != this.onclick) {
224 return this.onclick;
225 }
226 ValueExpression _ve = getValueExpression("onclick");
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>onclick</code> property.</p>
236 */
237 public void setOnclick(java.lang.String onclick) {
238 this.onclick = onclick;
239 handleAttribute("onclick", onclick);
240 }
241
242
243 private java.lang.String ondblclick;
244 /**
245 * <p>Return the value of the <code>ondblclick</code> property.</p>
246 * <p>Contents: Javascript code executed when a pointer button is
247 * double clicked over this element.
248 */
249 public java.lang.String getOndblclick() {
250 if (null != this.ondblclick) {
251 return this.ondblclick;
252 }
253 ValueExpression _ve = getValueExpression("ondblclick");
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>ondblclick</code> property.</p>
263 */
264 public void setOndblclick(java.lang.String ondblclick) {
265 this.ondblclick = ondblclick;
266 handleAttribute("ondblclick", ondblclick);
267 }
268
269
270 private java.lang.String onkeydown;
271 /**
272 * <p>Return the value of the <code>onkeydown</code> property.</p>
273 * <p>Contents: Javascript code executed when a key is
274 * pressed down over this element.
275 */
276 public java.lang.String getOnkeydown() {
277 if (null != this.onkeydown) {
278 return this.onkeydown;
279 }
280 ValueExpression _ve = getValueExpression("onkeydown");
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>onkeydown</code> property.</p>
290 */
291 public void setOnkeydown(java.lang.String onkeydown) {
292 this.onkeydown = onkeydown;
293 handleAttribute("onkeydown", onkeydown);
294 }
295
296
297 private java.lang.String onkeypress;
298 /**
299 * <p>Return the value of the <code>onkeypress</code> property.</p>
300 * <p>Contents: Javascript code executed when a key is
301 * pressed and released over this element.
302 */
303 public java.lang.String getOnkeypress() {
304 if (null != this.onkeypress) {
305 return this.onkeypress;
306 }
307 ValueExpression _ve = getValueExpression("onkeypress");
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>onkeypress</code> property.</p>
317 */
318 public void setOnkeypress(java.lang.String onkeypress) {
319 this.onkeypress = onkeypress;
320 handleAttribute("onkeypress", onkeypress);
321 }
322
323
324 private java.lang.String onkeyup;
325 /**
326 * <p>Return the value of the <code>onkeyup</code> property.</p>
327 * <p>Contents: Javascript code executed when a key is
328 * released over this element.
329 */
330 public java.lang.String getOnkeyup() {
331 if (null != this.onkeyup) {
332 return this.onkeyup;
333 }
334 ValueExpression _ve = getValueExpression("onkeyup");
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>onkeyup</code> property.</p>
344 */
345 public void setOnkeyup(java.lang.String onkeyup) {
346 this.onkeyup = onkeyup;
347 handleAttribute("onkeyup", onkeyup);
348 }
349
350
351 private java.lang.String onmousedown;
352 /**
353 * <p>Return the value of the <code>onmousedown</code> property.</p>
354 * <p>Contents: Javascript code executed when a pointer button is
355 * pressed down over this element.
356 */
357 public java.lang.String getOnmousedown() {
358 if (null != this.onmousedown) {
359 return this.onmousedown;
360 }
361 ValueExpression _ve = getValueExpression("onmousedown");
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>onmousedown</code> property.</p>
371 */
372 public void setOnmousedown(java.lang.String onmousedown) {
373 this.onmousedown = onmousedown;
374 handleAttribute("onmousedown", onmousedown);
375 }
376
377
378 private java.lang.String onmousemove;
379 /**
380 * <p>Return the value of the <code>onmousemove</code> property.</p>
381 * <p>Contents: Javascript code executed when a pointer button is
382 * moved within this element.
383 */
384 public java.lang.String getOnmousemove() {
385 if (null != this.onmousemove) {
386 return this.onmousemove;
387 }
388 ValueExpression _ve = getValueExpression("onmousemove");
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>onmousemove</code> property.</p>
398 */
399 public void setOnmousemove(java.lang.String onmousemove) {
400 this.onmousemove = onmousemove;
401 handleAttribute("onmousemove", onmousemove);
402 }
403
404
405 private java.lang.String onmouseout;
406 /**
407 * <p>Return the value of the <code>onmouseout</code> property.</p>
408 * <p>Contents: Javascript code executed when a pointer button is
409 * moved away from this element.
410 */
411 public java.lang.String getOnmouseout() {
412 if (null != this.onmouseout) {
413 return this.onmouseout;
414 }
415 ValueExpression _ve = getValueExpression("onmouseout");
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>onmouseout</code> property.</p>
425 */
426 public void setOnmouseout(java.lang.String onmouseout) {
427 this.onmouseout = onmouseout;
428 handleAttribute("onmouseout", onmouseout);
429 }
430
431
432 private java.lang.String onmouseover;
433 /**
434 * <p>Return the value of the <code>onmouseover</code> property.</p>
435 * <p>Contents: Javascript code executed when a pointer button is
436 * moved onto this element.
437 */
438 public java.lang.String getOnmouseover() {
439 if (null != this.onmouseover) {
440 return this.onmouseover;
441 }
442 ValueExpression _ve = getValueExpression("onmouseover");
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>onmouseover</code> property.</p>
452 */
453 public void setOnmouseover(java.lang.String onmouseover) {
454 this.onmouseover = onmouseover;
455 handleAttribute("onmouseover", onmouseover);
456 }
457
458
459 private java.lang.String onmouseup;
460 /**
461 * <p>Return the value of the <code>onmouseup</code> property.</p>
462 * <p>Contents: Javascript code executed when a pointer button is
463 * released over this element.
464 */
465 public java.lang.String getOnmouseup() {
466 if (null != this.onmouseup) {
467 return this.onmouseup;
468 }
469 ValueExpression _ve = getValueExpression("onmouseup");
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>onmouseup</code> property.</p>
479 */
480 public void setOnmouseup(java.lang.String onmouseup) {
481 this.onmouseup = onmouseup;
482 handleAttribute("onmouseup", onmouseup);
483 }
484
485
486 private java.lang.String onreset;
487 /**
488 * <p>Return the value of the <code>onreset</code> property.</p>
489 * <p>Contents: Javascript code executed when this form is reset.
490 */
491 public java.lang.String getOnreset() {
492 if (null != this.onreset) {
493 return this.onreset;
494 }
495 ValueExpression _ve = getValueExpression("onreset");
496 if (_ve != null) {
497 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
498 } else {
499 return null;
500 }
501 }
502
503 /**
504 * <p>Set the value of the <code>onreset</code> property.</p>
505 */
506 public void setOnreset(java.lang.String onreset) {
507 this.onreset = onreset;
508 handleAttribute("onreset", onreset);
509 }
510
511
512 private java.lang.String onsubmit;
513 /**
514 * <p>Return the value of the <code>onsubmit</code> property.</p>
515 * <p>Contents: Javascript code executed when this form is submitted.
516 */
517 public java.lang.String getOnsubmit() {
518 if (null != this.onsubmit) {
519 return this.onsubmit;
520 }
521 ValueExpression _ve = getValueExpression("onsubmit");
522 if (_ve != null) {
523 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
524 } else {
525 return null;
526 }
527 }
528
529 /**
530 * <p>Set the value of the <code>onsubmit</code> property.</p>
531 */
532 public void setOnsubmit(java.lang.String onsubmit) {
533 this.onsubmit = onsubmit;
534 handleAttribute("onsubmit", onsubmit);
535 }
536
537
538 private java.lang.String style;
539 /**
540 * <p>Return the value of the <code>style</code> property.</p>
541 * <p>Contents: CSS style(s) to be applied when this component is rendered.
542 */
543 public java.lang.String getStyle() {
544 if (null != this.style) {
545 return this.style;
546 }
547 ValueExpression _ve = getValueExpression("style");
548 if (_ve != null) {
549 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
550 } else {
551 return null;
552 }
553 }
554
555 /**
556 * <p>Set the value of the <code>style</code> property.</p>
557 */
558 public void setStyle(java.lang.String style) {
559 this.style = style;
560 handleAttribute("style", style);
561 }
562
563
564 private java.lang.String styleClass;
565 /**
566 * <p>Return the value of the <code>styleClass</code> property.</p>
567 * <p>Contents: Space-separated list of CSS style class(es) to be applied when
568 * this element is rendered. This value must be passed through
569 * as the "class" attribute on generated markup.
570 */
571 public java.lang.String getStyleClass() {
572 if (null != this.styleClass) {
573 return this.styleClass;
574 }
575 ValueExpression _ve = getValueExpression("styleClass");
576 if (_ve != null) {
577 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
578 } else {
579 return null;
580 }
581 }
582
583 /**
584 * <p>Set the value of the <code>styleClass</code> property.</p>
585 */
586 public void setStyleClass(java.lang.String styleClass) {
587 this.styleClass = styleClass;
588 }
589
590
591 private java.lang.String target;
592 /**
593 * <p>Return the value of the <code>target</code> property.</p>
594 * <p>Contents: Name of a frame where the response
595 * retrieved after this form submit is to
596 * be displayed.
597 */
598 public java.lang.String getTarget() {
599 if (null != this.target) {
600 return this.target;
601 }
602 ValueExpression _ve = getValueExpression("target");
603 if (_ve != null) {
604 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
605 } else {
606 return null;
607 }
608 }
609
610 /**
611 * <p>Set the value of the <code>target</code> property.</p>
612 */
613 public void setTarget(java.lang.String target) {
614 this.target = target;
615 handleAttribute("target", target);
616 }
617
618
619 private java.lang.String title;
620 /**
621 * <p>Return the value of the <code>title</code> property.</p>
622 * <p>Contents: Advisory title information about markup elements generated
623 * for this component.
624 */
625 public java.lang.String getTitle() {
626 if (null != this.title) {
627 return this.title;
628 }
629 ValueExpression _ve = getValueExpression("title");
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>title</code> property.</p>
639 */
640 public void setTitle(java.lang.String title) {
641 this.title = title;
642 handleAttribute("title", title);
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] = accept;
654 _values[2] = acceptcharset;
655 _values[3] = dir;
656 _values[4] = enctype;
657 _values[5] = lang;
658 _values[6] = onclick;
659 _values[7] = ondblclick;
660 _values[8] = onkeydown;
661 _values[9] = onkeypress;
662 _values[10] = onkeyup;
663 _values[11] = onmousedown;
664 _values[12] = onmousemove;
665 _values[13] = onmouseout;
666 _values[14] = onmouseover;
667 _values[15] = onmouseup;
668 _values[16] = onreset;
669 _values[17] = onsubmit;
670 _values[18] = style;
671 _values[19] = styleClass;
672 _values[20] = target;
673 _values[21] = title;
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.accept = (java.lang.String) _values[1];
682 this.acceptcharset = (java.lang.String) _values[2];
683 this.dir = (java.lang.String) _values[3];
684 this.enctype = (java.lang.String) _values[4];
685 this.lang = (java.lang.String) _values[5];
686 this.onclick = (java.lang.String) _values[6];
687 this.ondblclick = (java.lang.String) _values[7];
688 this.onkeydown = (java.lang.String) _values[8];
689 this.onkeypress = (java.lang.String) _values[9];
690 this.onkeyup = (java.lang.String) _values[10];
691 this.onmousedown = (java.lang.String) _values[11];
692 this.onmousemove = (java.lang.String) _values[12];
693 this.onmouseout = (java.lang.String) _values[13];
694 this.onmouseover = (java.lang.String) _values[14];
695 this.onmouseup = (java.lang.String) _values[15];
696 this.onreset = (java.lang.String) _values[16];
697 this.onsubmit = (java.lang.String) _values[17];
698 this.style = (java.lang.String) _values[18];
699 this.styleClass = (java.lang.String) _values[19];
700 this.target = (java.lang.String) _values[20];
701 this.title = (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 }