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 ui:frame tag inside a
051: * ui:frameSet tag to denote a new XHTML frame. </span><br
052: * style="color: rgb(0, 0, 0);">
053: * <h3 style="color: rgb(0, 0, 0);">HTML Elements and Layout</h3>
054: * <p style="color: rgb(0, 0, 0);">If you use a ui:frame and ui:frameSet
055: * tags you should set the ui:page tag's frame attribute to "true".<br>
056: * </p>
057: * This tag renders an xhtml compliant <frame> tag. <br>
058: * <h3 style="color: rgb(0, 0, 0);">Client Side Javascript Functions</h3>
059: * <span style="color: rgb(0, 0, 0);">None.
060: * </span><br style="color: rgb(0, 0, 0);">
061: * <h3 style="color: rgb(0, 0, 0);">Example</h3>
062: * <b style="color: rgb(0, 0, 0);">Example 1: Using the ui:frame tag
063: * appropriately in a JSP page:<br>
064: * <br>
065: * </b><code style="color: rgb(0, 0, 0);"><?xml version="1.0"
066: * encoding="UTF-8"?><br>
067: * <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
068: * xmlns:h="http://java.sun.com/jsf/html"
069: * xmlns:jsp="http://java.sun.com/JSP/Page"
070: * xmlns:ui="http://www.sun.com/web/ui"><br>
071: * <jsp:directive.page
072: * contentType="text/html;charset=ISO-8859-1"
073: * pageEncoding="UTF-8"/><f:view><br>
074: * <ui:page frame="true"><br>
075: *
076: * <ui:html><br>
077: *
078: * <ui:head title="blah" /><br>
079: *
080: * <ui:frameSet rows="10%,*" cols="10%,*" style="color:blue"
081: * styleClass="blue" toolTip="blah"><br>
082: *
083: * <ui:frame toolTip="blah" url="../faces/hyperlink/hyperlink.jsp"
084: * frameBorder="true" noResize="false"/><br>
085: *
086: * <ui:frame toolTip="blah1" url="../faces/hyperlink/nextpage.jsp"
087: * frameBorder="true" noResize="false"/><br>
088: *
089: * <br>
090: *
091: * <ui:frame toolTip="blah2" url="http://www.google.com"
092: * frameBorder="true" noResize="false"/><br>
093: *
094: * <ui:frame toolTip="blah3" url="http://www.yahoo.com"
095: * frameBorder="true" noResize="false"/><br>
096: *
097: * </ui:frameSet><br>
098: *
099: * </ui:html><br>
100: * </ui:page><br>
101: * </f:view><br>
102: * </jsp:root><br>
103: * </code><b style="color: rgb(0, 0, 0);"><span
104: * style="font-family: monospace;"></span></b>
105: * <p>Auto-generated component class.
106: * Do <strong>NOT</strong> modify; all changes
107: * <strong>will</strong> be lost!</p>
108: */
109:
110: public abstract class FrameBase extends
111: javax.faces.component.UIComponentBase {
112:
113: /**
114: * <p>Construct a new <code>FrameBase</code>.</p>
115: */
116: public FrameBase() {
117: super ();
118: setRendererType("com.sun.rave.web.ui.Frame");
119: }
120:
121: /**
122: * <p>Return the identifier of the component family to which this
123: * component belongs. This identifier, in conjunction with the value
124: * of the <code>rendererType</code> property, may be used to select
125: * the appropriate {@link Renderer} for this component instance.</p>
126: */
127: public String getFamily() {
128: return "com.sun.rave.web.ui.Frame";
129: }
130:
131: // frameBorder
132: private boolean frameBorder = false;
133: private boolean frameBorder_set = false;
134:
135: /**
136: * <p>Set the value of the frameBorder attribute to "true" when a border is
137: * needed around the frame.</p>
138: */
139: public boolean isFrameBorder() {
140: if (this .frameBorder_set) {
141: return this .frameBorder;
142: }
143: ValueBinding _vb = getValueBinding("frameBorder");
144: if (_vb != null) {
145: Object _result = _vb.getValue(getFacesContext());
146: if (_result == null) {
147: return false;
148: } else {
149: return ((Boolean) _result).booleanValue();
150: }
151: }
152: return false;
153: }
154:
155: /**
156: * <p>Set the value of the frameBorder attribute to "true" when a border is
157: * needed around the frame.</p>
158: * @see #isFrameBorder()
159: */
160: public void setFrameBorder(boolean frameBorder) {
161: this .frameBorder = frameBorder;
162: this .frameBorder_set = true;
163: }
164:
165: // longDesc
166: private String longDesc = null;
167:
168: /**
169: * <p>A URL to a long description of the frame contents. Use it for browsers that do not support frames</p>
170: */
171: public String getLongDesc() {
172: if (this .longDesc != null) {
173: return this .longDesc;
174: }
175: ValueBinding _vb = getValueBinding("longDesc");
176: if (_vb != null) {
177: return (String) _vb.getValue(getFacesContext());
178: }
179: return null;
180: }
181:
182: /**
183: * <p>A URL to a long description of the frame contents. Use it for browsers that do not support frames</p>
184: * @see #getLongDesc()
185: */
186: public void setLongDesc(String longDesc) {
187: this .longDesc = longDesc;
188: }
189:
190: // marginHeight
191: private int marginHeight = Integer.MIN_VALUE;
192: private boolean marginHeight_set = false;
193:
194: /**
195: * <p>Defines the top and bottom margins in the frame</p>
196: */
197: public int getMarginHeight() {
198: if (this .marginHeight_set) {
199: return this .marginHeight;
200: }
201: ValueBinding _vb = getValueBinding("marginHeight");
202: if (_vb != null) {
203: Object _result = _vb.getValue(getFacesContext());
204: if (_result == null) {
205: return Integer.MIN_VALUE;
206: } else {
207: return ((Integer) _result).intValue();
208: }
209: }
210: return Integer.MIN_VALUE;
211: }
212:
213: /**
214: * <p>Defines the top and bottom margins in the frame</p>
215: * @see #getMarginHeight()
216: */
217: public void setMarginHeight(int marginHeight) {
218: this .marginHeight = marginHeight;
219: this .marginHeight_set = true;
220: }
221:
222: // marginWidth
223: private int marginWidth = Integer.MIN_VALUE;
224: private boolean marginWidth_set = false;
225:
226: /**
227: * <p>Defines the left and right margins in the frame</p>
228: */
229: public int getMarginWidth() {
230: if (this .marginWidth_set) {
231: return this .marginWidth;
232: }
233: ValueBinding _vb = getValueBinding("marginWidth");
234: if (_vb != null) {
235: Object _result = _vb.getValue(getFacesContext());
236: if (_result == null) {
237: return Integer.MIN_VALUE;
238: } else {
239: return ((Integer) _result).intValue();
240: }
241: }
242: return Integer.MIN_VALUE;
243: }
244:
245: /**
246: * <p>Defines the left and right margins in the frame</p>
247: * @see #getMarginWidth()
248: */
249: public void setMarginWidth(int marginWidth) {
250: this .marginWidth = marginWidth;
251: this .marginWidth_set = true;
252: }
253:
254: // name
255: private String name = null;
256:
257: /**
258: * <p>Defines a unique name for the frame (to use in scripts)</p>
259: */
260: public String getName() {
261: if (this .name != null) {
262: return this .name;
263: }
264: ValueBinding _vb = getValueBinding("name");
265: if (_vb != null) {
266: return (String) _vb.getValue(getFacesContext());
267: }
268: return null;
269: }
270:
271: /**
272: * <p>Defines a unique name for the frame (to use in scripts)</p>
273: * @see #getName()
274: */
275: public void setName(String name) {
276: this .name = name;
277: }
278:
279: // noResize
280: private boolean noResize = false;
281: private boolean noResize_set = false;
282:
283: /**
284: * <p>Set the value of the noResize attribute to "true" when user
285: * is not allowed to resize the frame.</p>
286: */
287: public boolean isNoResize() {
288: if (this .noResize_set) {
289: return this .noResize;
290: }
291: ValueBinding _vb = getValueBinding("noResize");
292: if (_vb != null) {
293: Object _result = _vb.getValue(getFacesContext());
294: if (_result == null) {
295: return false;
296: } else {
297: return ((Boolean) _result).booleanValue();
298: }
299: }
300: return false;
301: }
302:
303: /**
304: * <p>Set the value of the noResize attribute to "true" when user
305: * is not allowed to resize the frame.</p>
306: * @see #isNoResize()
307: */
308: public void setNoResize(boolean noResize) {
309: this .noResize = noResize;
310: this .noResize_set = true;
311: }
312:
313: // scrolling
314: private String scrolling = null;
315:
316: /**
317: * <p>Determines scrollbar action (valid values are: yes, no, auto)</p>
318: */
319: public String getScrolling() {
320: if (this .scrolling != null) {
321: return this .scrolling;
322: }
323: ValueBinding _vb = getValueBinding("scrolling");
324: if (_vb != null) {
325: return (String) _vb.getValue(getFacesContext());
326: }
327: return null;
328: }
329:
330: /**
331: * <p>Determines scrollbar action (valid values are: yes, no, auto)</p>
332: * @see #getScrolling()
333: */
334: public void setScrolling(String scrolling) {
335: this .scrolling = scrolling;
336: }
337:
338: // style
339: private String style = null;
340:
341: /**
342: * <p>CSS style(s) to be applied when this component is rendered.</p>
343: */
344: public String getStyle() {
345: if (this .style != null) {
346: return this .style;
347: }
348: ValueBinding _vb = getValueBinding("style");
349: if (_vb != null) {
350: return (String) _vb.getValue(getFacesContext());
351: }
352: return null;
353: }
354:
355: /**
356: * <p>CSS style(s) to be applied when this component is rendered.</p>
357: * @see #getStyle()
358: */
359: public void setStyle(String style) {
360: this .style = style;
361: }
362:
363: // styleClass
364: private String styleClass = null;
365:
366: /**
367: * <p>CSS style class(es) to be applied when this component is rendered.</p>
368: */
369: public String getStyleClass() {
370: if (this .styleClass != null) {
371: return this .styleClass;
372: }
373: ValueBinding _vb = getValueBinding("styleClass");
374: if (_vb != null) {
375: return (String) _vb.getValue(getFacesContext());
376: }
377: return null;
378: }
379:
380: /**
381: * <p>CSS style class(es) to be applied when this component is rendered.</p>
382: * @see #getStyleClass()
383: */
384: public void setStyleClass(String styleClass) {
385: this .styleClass = styleClass;
386: }
387:
388: // toolTip
389: private String toolTip = null;
390:
391: /**
392: * <p>Display the text as a tooltip for this component</p>
393: */
394: public String getToolTip() {
395: if (this .toolTip != null) {
396: return this .toolTip;
397: }
398: ValueBinding _vb = getValueBinding("toolTip");
399: if (_vb != null) {
400: return (String) _vb.getValue(getFacesContext());
401: }
402: return null;
403: }
404:
405: /**
406: * <p>Display the text as a tooltip for this component</p>
407: * @see #getToolTip()
408: */
409: public void setToolTip(String toolTip) {
410: this .toolTip = toolTip;
411: }
412:
413: // url
414: private String url = null;
415:
416: /**
417: * <p>Defines the URL of the file to show in the frame.</p>
418: */
419: public String getUrl() {
420: if (this .url != null) {
421: return this .url;
422: }
423: ValueBinding _vb = getValueBinding("url");
424: if (_vb != null) {
425: return (String) _vb.getValue(getFacesContext());
426: }
427: return null;
428: }
429:
430: /**
431: * <p>Defines the URL of the file to show in the frame.</p>
432: * @see #getUrl()
433: */
434: public void setUrl(String url) {
435: this .url = url;
436: }
437:
438: /**
439: * <p>Restore the state of this component.</p>
440: */
441: public void restoreState(FacesContext _context, Object _state) {
442: Object _values[] = (Object[]) _state;
443: super .restoreState(_context, _values[0]);
444: this .frameBorder = ((Boolean) _values[1]).booleanValue();
445: this .frameBorder_set = ((Boolean) _values[2]).booleanValue();
446: this .longDesc = (String) _values[3];
447: this .marginHeight = ((Integer) _values[4]).intValue();
448: this .marginHeight_set = ((Boolean) _values[5]).booleanValue();
449: this .marginWidth = ((Integer) _values[6]).intValue();
450: this .marginWidth_set = ((Boolean) _values[7]).booleanValue();
451: this .name = (String) _values[8];
452: this .noResize = ((Boolean) _values[9]).booleanValue();
453: this .noResize_set = ((Boolean) _values[10]).booleanValue();
454: this .scrolling = (String) _values[11];
455: this .style = (String) _values[12];
456: this .styleClass = (String) _values[13];
457: this .toolTip = (String) _values[14];
458: this .url = (String) _values[15];
459: }
460:
461: /**
462: * <p>Save the state of this component.</p>
463: */
464: public Object saveState(FacesContext _context) {
465: Object _values[] = new Object[16];
466: _values[0] = super .saveState(_context);
467: _values[1] = this .frameBorder ? Boolean.TRUE : Boolean.FALSE;
468: _values[2] = this .frameBorder_set ? Boolean.TRUE
469: : Boolean.FALSE;
470: _values[3] = this .longDesc;
471: _values[4] = new Integer(this .marginHeight);
472: _values[5] = this .marginHeight_set ? Boolean.TRUE
473: : Boolean.FALSE;
474: _values[6] = new Integer(this .marginWidth);
475: _values[7] = this .marginWidth_set ? Boolean.TRUE
476: : Boolean.FALSE;
477: _values[8] = this .name;
478: _values[9] = this .noResize ? Boolean.TRUE : Boolean.FALSE;
479: _values[10] = this .noResize_set ? Boolean.TRUE : Boolean.FALSE;
480: _values[11] = this .scrolling;
481: _values[12] = this .style;
482: _values[13] = this .styleClass;
483: _values[14] = this .toolTip;
484: _values[15] = this.url;
485: return _values;
486: }
487:
488: }
|