001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.component;
042:
043: import java.io.IOException;
044: import javax.faces.component.UIComponent;
045: import javax.faces.context.FacesContext;
046: import javax.faces.el.MethodBinding;
047: import javax.faces.el.ValueBinding;
048:
049: /**
050: * <span style="color: rgb(0, 0, 0);">Use the </span><code
051: * style="color: rgb(0, 0, 0);">ui:body</code><span
052: * style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">
053: * tag to create an HTML </span><code style="color: rgb(0, 0, 0);"><body></code><span
054: * style="color: rgb(0, 0, 0);">
055: * tag and attributes in the rendered HTML page</span>. </span>The
056: * ui:body tag should be used in conjunction with the <a
057: * href="./head.html">ui:head</a> and the <a href="./page.html">ui:page</a>
058: * tag.<br>
059: * <h3>HTML Elements and Layout</h3>
060: * <span style="color: rgb(0, 0, 0);">The </span><code
061: * style="color: rgb(0, 0, 0);">ui:body</code><span
062: * style="color: rgb(0, 0, 0);"> tag encloses the body content of the
063: * JSP page, just as a </span><code style="color: rgb(0, 0, 0);"><body></code><span
064: * style="color: rgb(0, 0, 0);"> tag encloses the content of an HTML
065: * page. The </span><code style="color: rgb(0, 0, 0);">ui:body</code><span
066: * style="color: rgb(0, 0, 0);"> tag should be placed after the <code>ui:head</code>
067: * tag
068: * within the <code>ui:page</code>
069: * tag. Attributes that are
070: * specified with the <code>ui:body</code> tag are used to specify the
071: * corresponding attributes in the rendered <code><body></code>
072: * element.</span>
073: * <h3>Client Side Javascript Functions</h3>
074: * None.
075: * <br>
076: * <br>
077: * <b>Example 1: Create a body tag<br>
078: * <br>
079: * </b><code><ui:page><br>
080: * <ui:head title="body test" ><br>
081: * <ui:meta httpHead="refresh"
082: * content="5" /><br>
083: * </ui:head> <br>
084: * <ui:body id="bodytest">
085: * <br>
086: * ....your body content
087: * ...<br>
088: * </ui:body id="bodytest"><br>
089: * </ui:page></code>
090: * <p>Auto-generated component class.
091: * Do <strong>NOT</strong> modify; all changes
092: * <strong>will</strong> be lost!</p>
093: */
094:
095: public abstract class BodyBase extends
096: javax.faces.component.UIComponentBase {
097:
098: /**
099: * <p>Construct a new <code>BodyBase</code>.</p>
100: */
101: public BodyBase() {
102: super ();
103: setRendererType("com.sun.rave.web.ui.Body");
104: }
105:
106: /**
107: * <p>Return the identifier of the component family to which this
108: * component belongs. This identifier, in conjunction with the value
109: * of the <code>rendererType</code> property, may be used to select
110: * the appropriate {@link Renderer} for this component instance.</p>
111: */
112: public String getFamily() {
113: return "com.sun.rave.web.ui.Body";
114: }
115:
116: // focus
117: private String focus = null;
118:
119: /**
120: * <p>Specify the ID of the component that should receive focus when
121: * the page is loaded. If the attribute is not set, or if the value
122: * is null, the component which submitted the page (if any)
123: * receives focus.</p>
124: */
125: public String getFocus() {
126: if (this .focus != null) {
127: return this .focus;
128: }
129: ValueBinding _vb = getValueBinding("focus");
130: if (_vb != null) {
131: return (String) _vb.getValue(getFacesContext());
132: }
133: return null;
134: }
135:
136: /**
137: * <p>Specify the ID of the component that should receive focus when
138: * the page is loaded. If the attribute is not set, or if the value
139: * is null, the component which submitted the page (if any)
140: * receives focus.</p>
141: * @see #getFocus()
142: */
143: public void setFocus(String focus) {
144: this .focus = focus;
145: }
146:
147: // imageURL
148: private String imageURL = null;
149:
150: /**
151: * <p>Resource path of an image used to appear in the background</p>
152: */
153: public String getImageURL() {
154: if (this .imageURL != null) {
155: return this .imageURL;
156: }
157: ValueBinding _vb = getValueBinding("imageURL");
158: if (_vb != null) {
159: return (String) _vb.getValue(getFacesContext());
160: }
161: return null;
162: }
163:
164: /**
165: * <p>Resource path of an image used to appear in the background</p>
166: * @see #getImageURL()
167: */
168: public void setImageURL(String imageURL) {
169: this .imageURL = imageURL;
170: }
171:
172: // onBlur
173: private String onBlur = null;
174:
175: /**
176: * <p>Scripting code executed when this element loses focus.</p>
177: */
178: public String getOnBlur() {
179: if (this .onBlur != null) {
180: return this .onBlur;
181: }
182: ValueBinding _vb = getValueBinding("onBlur");
183: if (_vb != null) {
184: return (String) _vb.getValue(getFacesContext());
185: }
186: return null;
187: }
188:
189: /**
190: * <p>Scripting code executed when this element loses focus.</p>
191: * @see #getOnBlur()
192: */
193: public void setOnBlur(String onBlur) {
194: this .onBlur = onBlur;
195: }
196:
197: // onClick
198: private String onClick = null;
199:
200: /**
201: * <p>Scripting code executed when a mouse click
202: * occurs over this component.</p>
203: */
204: public String getOnClick() {
205: if (this .onClick != null) {
206: return this .onClick;
207: }
208: ValueBinding _vb = getValueBinding("onClick");
209: if (_vb != null) {
210: return (String) _vb.getValue(getFacesContext());
211: }
212: return null;
213: }
214:
215: /**
216: * <p>Scripting code executed when a mouse click
217: * occurs over this component.</p>
218: * @see #getOnClick()
219: */
220: public void setOnClick(String onClick) {
221: this .onClick = onClick;
222: }
223:
224: // onDblClick
225: private String onDblClick = null;
226:
227: /**
228: * <p>Scripting code executed when a mouse double click
229: * occurs over this component.</p>
230: */
231: public String getOnDblClick() {
232: if (this .onDblClick != null) {
233: return this .onDblClick;
234: }
235: ValueBinding _vb = getValueBinding("onDblClick");
236: if (_vb != null) {
237: return (String) _vb.getValue(getFacesContext());
238: }
239: return null;
240: }
241:
242: /**
243: * <p>Scripting code executed when a mouse double click
244: * occurs over this component.</p>
245: * @see #getOnDblClick()
246: */
247: public void setOnDblClick(String onDblClick) {
248: this .onDblClick = onDblClick;
249: }
250:
251: // onFocus
252: private String onFocus = null;
253:
254: /**
255: * <p>Scripting code executed when this component receives focus. An
256: * element receives focus when the user selects the element by pressing
257: * the tab key or clicking the mouse.</p>
258: */
259: public String getOnFocus() {
260: if (this .onFocus != null) {
261: return this .onFocus;
262: }
263: ValueBinding _vb = getValueBinding("onFocus");
264: if (_vb != null) {
265: return (String) _vb.getValue(getFacesContext());
266: }
267: return null;
268: }
269:
270: /**
271: * <p>Scripting code executed when this component receives focus. An
272: * element receives focus when the user selects the element by pressing
273: * the tab key or clicking the mouse.</p>
274: * @see #getOnFocus()
275: */
276: public void setOnFocus(String onFocus) {
277: this .onFocus = onFocus;
278: }
279:
280: // onKeyDown
281: private String onKeyDown = null;
282:
283: /**
284: * <p>Scripting code executed when the user presses down on a key while the
285: * component has focus.</p>
286: */
287: public String getOnKeyDown() {
288: if (this .onKeyDown != null) {
289: return this .onKeyDown;
290: }
291: ValueBinding _vb = getValueBinding("onKeyDown");
292: if (_vb != null) {
293: return (String) _vb.getValue(getFacesContext());
294: }
295: return null;
296: }
297:
298: /**
299: * <p>Scripting code executed when the user presses down on a key while the
300: * component has focus.</p>
301: * @see #getOnKeyDown()
302: */
303: public void setOnKeyDown(String onKeyDown) {
304: this .onKeyDown = onKeyDown;
305: }
306:
307: // onKeyPress
308: private String onKeyPress = null;
309:
310: /**
311: * <p>Scripting code executed when the user presses and releases a key while
312: * the component has focus.</p>
313: */
314: public String getOnKeyPress() {
315: if (this .onKeyPress != null) {
316: return this .onKeyPress;
317: }
318: ValueBinding _vb = getValueBinding("onKeyPress");
319: if (_vb != null) {
320: return (String) _vb.getValue(getFacesContext());
321: }
322: return null;
323: }
324:
325: /**
326: * <p>Scripting code executed when the user presses and releases a key while
327: * the component has focus.</p>
328: * @see #getOnKeyPress()
329: */
330: public void setOnKeyPress(String onKeyPress) {
331: this .onKeyPress = onKeyPress;
332: }
333:
334: // onKeyUp
335: private String onKeyUp = null;
336:
337: /**
338: * <p>Scripting code executed when the user releases a key while the
339: * component has focus.</p>
340: */
341: public String getOnKeyUp() {
342: if (this .onKeyUp != null) {
343: return this .onKeyUp;
344: }
345: ValueBinding _vb = getValueBinding("onKeyUp");
346: if (_vb != null) {
347: return (String) _vb.getValue(getFacesContext());
348: }
349: return null;
350: }
351:
352: /**
353: * <p>Scripting code executed when the user releases a key while the
354: * component has focus.</p>
355: * @see #getOnKeyUp()
356: */
357: public void setOnKeyUp(String onKeyUp) {
358: this .onKeyUp = onKeyUp;
359: }
360:
361: // onLoad
362: private String onLoad = null;
363:
364: /**
365: * <p>Scripting code executed when when this page is loaded in a browser.</p>
366: */
367: public String getOnLoad() {
368: if (this .onLoad != null) {
369: return this .onLoad;
370: }
371: ValueBinding _vb = getValueBinding("onLoad");
372: if (_vb != null) {
373: return (String) _vb.getValue(getFacesContext());
374: }
375: return null;
376: }
377:
378: /**
379: * <p>Scripting code executed when when this page is loaded in a browser.</p>
380: * @see #getOnLoad()
381: */
382: public void setOnLoad(String onLoad) {
383: this .onLoad = onLoad;
384: }
385:
386: // onMouseDown
387: private String onMouseDown = null;
388:
389: /**
390: * <p>Scripting code executed when the user presses a mouse button while the
391: * mouse pointer is on the component.</p>
392: */
393: public String getOnMouseDown() {
394: if (this .onMouseDown != null) {
395: return this .onMouseDown;
396: }
397: ValueBinding _vb = getValueBinding("onMouseDown");
398: if (_vb != null) {
399: return (String) _vb.getValue(getFacesContext());
400: }
401: return null;
402: }
403:
404: /**
405: * <p>Scripting code executed when the user presses a mouse button while the
406: * mouse pointer is on the component.</p>
407: * @see #getOnMouseDown()
408: */
409: public void setOnMouseDown(String onMouseDown) {
410: this .onMouseDown = onMouseDown;
411: }
412:
413: // onMouseMove
414: private String onMouseMove = null;
415:
416: /**
417: * <p>Scripting code executed when the user moves the mouse pointer while
418: * over the component.</p>
419: */
420: public String getOnMouseMove() {
421: if (this .onMouseMove != null) {
422: return this .onMouseMove;
423: }
424: ValueBinding _vb = getValueBinding("onMouseMove");
425: if (_vb != null) {
426: return (String) _vb.getValue(getFacesContext());
427: }
428: return null;
429: }
430:
431: /**
432: * <p>Scripting code executed when the user moves the mouse pointer while
433: * over the component.</p>
434: * @see #getOnMouseMove()
435: */
436: public void setOnMouseMove(String onMouseMove) {
437: this .onMouseMove = onMouseMove;
438: }
439:
440: // onMouseOut
441: private String onMouseOut = null;
442:
443: /**
444: * <p>Scripting code executed when a mouse out movement
445: * occurs over this component.</p>
446: */
447: public String getOnMouseOut() {
448: if (this .onMouseOut != null) {
449: return this .onMouseOut;
450: }
451: ValueBinding _vb = getValueBinding("onMouseOut");
452: if (_vb != null) {
453: return (String) _vb.getValue(getFacesContext());
454: }
455: return null;
456: }
457:
458: /**
459: * <p>Scripting code executed when a mouse out movement
460: * occurs over this component.</p>
461: * @see #getOnMouseOut()
462: */
463: public void setOnMouseOut(String onMouseOut) {
464: this .onMouseOut = onMouseOut;
465: }
466:
467: // onMouseOver
468: private String onMouseOver = null;
469:
470: /**
471: * <p>Scripting code executed when the user moves the mouse pointer into
472: * the boundary of this component.</p>
473: */
474: public String getOnMouseOver() {
475: if (this .onMouseOver != null) {
476: return this .onMouseOver;
477: }
478: ValueBinding _vb = getValueBinding("onMouseOver");
479: if (_vb != null) {
480: return (String) _vb.getValue(getFacesContext());
481: }
482: return null;
483: }
484:
485: /**
486: * <p>Scripting code executed when the user moves the mouse pointer into
487: * the boundary of this component.</p>
488: * @see #getOnMouseOver()
489: */
490: public void setOnMouseOver(String onMouseOver) {
491: this .onMouseOver = onMouseOver;
492: }
493:
494: // onMouseUp
495: private String onMouseUp = null;
496:
497: /**
498: * <p>Scripting code executed when the user releases a mouse button while
499: * the mouse pointer is on the component.</p>
500: */
501: public String getOnMouseUp() {
502: if (this .onMouseUp != null) {
503: return this .onMouseUp;
504: }
505: ValueBinding _vb = getValueBinding("onMouseUp");
506: if (_vb != null) {
507: return (String) _vb.getValue(getFacesContext());
508: }
509: return null;
510: }
511:
512: /**
513: * <p>Scripting code executed when the user releases a mouse button while
514: * the mouse pointer is on the component.</p>
515: * @see #getOnMouseUp()
516: */
517: public void setOnMouseUp(String onMouseUp) {
518: this .onMouseUp = onMouseUp;
519: }
520:
521: // onUnload
522: private String onUnload = null;
523:
524: /**
525: * <p>Scripting code executed when this page is unloaded from a browser as a user exits the page.</p>
526: */
527: public String getOnUnload() {
528: if (this .onUnload != null) {
529: return this .onUnload;
530: }
531: ValueBinding _vb = getValueBinding("onUnload");
532: if (_vb != null) {
533: return (String) _vb.getValue(getFacesContext());
534: }
535: return null;
536: }
537:
538: /**
539: * <p>Scripting code executed when this page is unloaded from a browser as a user exits the page.</p>
540: * @see #getOnUnload()
541: */
542: public void setOnUnload(String onUnload) {
543: this .onUnload = onUnload;
544: }
545:
546: // style
547: private String style = null;
548:
549: /**
550: * <p>CSS style(s) to be applied when this component is rendered.</p>
551: */
552: public String getStyle() {
553: if (this .style != null) {
554: return this .style;
555: }
556: ValueBinding _vb = getValueBinding("style");
557: if (_vb != null) {
558: return (String) _vb.getValue(getFacesContext());
559: }
560: return null;
561: }
562:
563: /**
564: * <p>CSS style(s) to be applied when this component is rendered.</p>
565: * @see #getStyle()
566: */
567: public void setStyle(String style) {
568: this .style = style;
569: }
570:
571: // styleClass
572: private String styleClass = null;
573:
574: /**
575: * <p>CSS style class(es) to be applied when this component is rendered.</p>
576: */
577: public String getStyleClass() {
578: if (this .styleClass != null) {
579: return this .styleClass;
580: }
581: ValueBinding _vb = getValueBinding("styleClass");
582: if (_vb != null) {
583: return (String) _vb.getValue(getFacesContext());
584: }
585: return null;
586: }
587:
588: /**
589: * <p>CSS style class(es) to be applied when this component is rendered.</p>
590: * @see #getStyleClass()
591: */
592: public void setStyleClass(String styleClass) {
593: this .styleClass = styleClass;
594: }
595:
596: // visible
597: private boolean visible = false;
598: private boolean visible_set = false;
599:
600: /**
601: * <p>Use the visible attribute to indicate whether the component should be
602: * viewable by the user in the rendered HTML page. If set to false, the
603: * HTML code for the component is present in the page, but the component
604: * is hidden with style attributes. By default, visible is set to true, so
605: * HTML for the component HTML is included and visible to the user. If the
606: * component is not visible, it can still be processed on subsequent form
607: * submissions because the HTML is present.</p>
608: */
609: public boolean isVisible() {
610: if (this .visible_set) {
611: return this .visible;
612: }
613: ValueBinding _vb = getValueBinding("visible");
614: if (_vb != null) {
615: Object _result = _vb.getValue(getFacesContext());
616: if (_result == null) {
617: return false;
618: } else {
619: return ((Boolean) _result).booleanValue();
620: }
621: }
622: return true;
623: }
624:
625: /**
626: * <p>Use the visible attribute to indicate whether the component should be
627: * viewable by the user in the rendered HTML page. If set to false, the
628: * HTML code for the component is present in the page, but the component
629: * is hidden with style attributes. By default, visible is set to true, so
630: * HTML for the component HTML is included and visible to the user. If the
631: * component is not visible, it can still be processed on subsequent form
632: * submissions because the HTML is present.</p>
633: * @see #isVisible()
634: */
635: public void setVisible(boolean visible) {
636: this .visible = visible;
637: this .visible_set = true;
638: }
639:
640: /**
641: * <p>Restore the state of this component.</p>
642: */
643: public void restoreState(FacesContext _context, Object _state) {
644: Object _values[] = (Object[]) _state;
645: super .restoreState(_context, _values[0]);
646: this .focus = (String) _values[1];
647: this .imageURL = (String) _values[2];
648: this .onBlur = (String) _values[3];
649: this .onClick = (String) _values[4];
650: this .onDblClick = (String) _values[5];
651: this .onFocus = (String) _values[6];
652: this .onKeyDown = (String) _values[7];
653: this .onKeyPress = (String) _values[8];
654: this .onKeyUp = (String) _values[9];
655: this .onLoad = (String) _values[10];
656: this .onMouseDown = (String) _values[11];
657: this .onMouseMove = (String) _values[12];
658: this .onMouseOut = (String) _values[13];
659: this .onMouseOver = (String) _values[14];
660: this .onMouseUp = (String) _values[15];
661: this .onUnload = (String) _values[16];
662: this .style = (String) _values[17];
663: this .styleClass = (String) _values[18];
664: this .visible = ((Boolean) _values[19]).booleanValue();
665: this .visible_set = ((Boolean) _values[20]).booleanValue();
666: }
667:
668: /**
669: * <p>Save the state of this component.</p>
670: */
671: public Object saveState(FacesContext _context) {
672: Object _values[] = new Object[21];
673: _values[0] = super .saveState(_context);
674: _values[1] = this .focus;
675: _values[2] = this .imageURL;
676: _values[3] = this .onBlur;
677: _values[4] = this .onClick;
678: _values[5] = this .onDblClick;
679: _values[6] = this .onFocus;
680: _values[7] = this .onKeyDown;
681: _values[8] = this .onKeyPress;
682: _values[9] = this .onKeyUp;
683: _values[10] = this .onLoad;
684: _values[11] = this .onMouseDown;
685: _values[12] = this .onMouseMove;
686: _values[13] = this .onMouseOut;
687: _values[14] = this .onMouseOver;
688: _values[15] = this .onMouseUp;
689: _values[16] = this .onUnload;
690: _values[17] = this .style;
691: _values[18] = this .styleClass;
692: _values[19] = this .visible ? Boolean.TRUE : Boolean.FALSE;
693: _values[20] = this.visible_set ? Boolean.TRUE : Boolean.FALSE;
694: return _values;
695: }
696:
697: }
|