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
051: * style="color: rgb(0, 0, 0);"><span
052: * style="text-decoration: line-through;"></span>Use
053: * the <code>ui:iframe</code>
054: * tag
055: * to create an inline frame in the rendered HTML page. The <code>ui:iframe</code>
056: * tag inserts a frame in which another web page can be displayed inside
057: * the web application page. <br>
058: * </span><br
059: * style="color: rgb(0, 0, 0);">
060: * <h3 style="color: rgb(0, 0, 0);">HTML
061: * Elements and Layout</h3>
062: * <span
063: * style="text-decoration: line-through; color: rgb(0, 0, 0);"></span>
064: * <span style="color: rgb(0, 0, 0);">The
065: * iframe component is
066: * rendered as an </span><code
067: * style="color: rgb(0, 0, 0);"><iframe></code><span
068: * style="color: rgb(0, 0, 0);"> XHTML
069: * element. The <code>ui:iframe</code>
070: * tag can be configured by using the tag's attributes, which map to the <code><iframe></code>
071: * properties and are similarly named. <br>
072: * </span>
073: * <h3 style="color: rgb(0, 0, 0);">Theme
074: * Identifiers</h3>
075: * <span style="color: rgb(0, 0, 0);">None.</span>
076: * <h3 style="color: rgb(0, 0, 0);">Client
077: * Side Javascript Functions</h3>
078: * <span style="color: rgb(0, 0, 0);">None.
079: * </span><br
080: * style="color: rgb(0, 0, 0);">
081: * <h3 style="color: rgb(0, 0, 0);">Example</h3>
082: * <b style="color: rgb(0, 0, 0);">Example
083: * 1: Using the ui:iframe
084: * tag
085: * appropriately in a JSP page:<br>
086: * </b><b
087: * style="color: rgb(0, 0, 0);"><br>
088: * </b><code
089: * style="color: rgb(0, 0, 0);"><?xml
090: * version="1.0"
091: * encoding="UTF-8"?><br>
092: * <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
093: * xmlns:h="http://java.sun.com/jsf/html"
094: * xmlns:jsp="http://java.sun.com/JSP/Page"
095: * xmlns:ui="http://www.sun.com/web/ui"><br>
096: * <jsp:directive.page
097: * contentType="text/html;charset=ISO-8859-1"
098: * pageEncoding="UTF-8"/><f:view><br>
099: *
100: * <ui:page frame="true"><br>
101: *
102: * <ui:html><br>
103: *
104: * <ui:head title="blah" /><br>
105: *
106: * <ui:body><br>
107: *
108: *
109: * <ui:staticText id="text1" text="Below is a
110: * frame within this page without a frameset" /><br>
111: *
112: *
113: * <ui:markup tag="br" singleton="true"
114: * /><br>
115: *
116: *
117: * <ui:iframe url="http://google.com" /><br>
118: *
119: *
120: * </ui:body><br>
121: *
122: * </ui:html><br>
123: *
124: * </ui:page><br>
125: * </f:view><br>
126: * </jsp:root></code>
127: * <p>Auto-generated component class.
128: * Do <strong>NOT</strong> modify; all changes
129: * <strong>will</strong> be lost!</p>
130: */
131:
132: public abstract class IFrameBase extends
133: com.sun.rave.web.ui.component.Frame {
134:
135: /**
136: * <p>Construct a new <code>IFrameBase</code>.</p>
137: */
138: public IFrameBase() {
139: super ();
140: setRendererType("com.sun.rave.web.ui.IFrame");
141: }
142:
143: /**
144: * <p>Return the identifier of the component family to which this
145: * component belongs. This identifier, in conjunction with the value
146: * of the <code>rendererType</code> property, may be used to select
147: * the appropriate {@link Renderer} for this component instance.</p>
148: */
149: public String getFamily() {
150: return "com.sun.rave.web.ui.IFrame";
151: }
152:
153: // align
154: private String align = null;
155:
156: /**
157: * <p>Specifies how to align the iframe according to the surrounding text. One
158: * of the following: left, right, top, middle, bottom</p>
159: */
160: public String getAlign() {
161: if (this .align != null) {
162: return this .align;
163: }
164: ValueBinding _vb = getValueBinding("align");
165: if (_vb != null) {
166: return (String) _vb.getValue(getFacesContext());
167: }
168: return null;
169: }
170:
171: /**
172: * <p>Specifies how to align the iframe according to the surrounding text. One
173: * of the following: left, right, top, middle, bottom</p>
174: * @see #getAlign()
175: */
176: public void setAlign(String align) {
177: this .align = align;
178: }
179:
180: // height
181: private String height = null;
182:
183: /**
184: * <p>Defines the height of the iframe in pixels or as a percentage of it's
185: * container</p>
186: */
187: public String getHeight() {
188: if (this .height != null) {
189: return this .height;
190: }
191: ValueBinding _vb = getValueBinding("height");
192: if (_vb != null) {
193: return (String) _vb.getValue(getFacesContext());
194: }
195: return null;
196: }
197:
198: /**
199: * <p>Defines the height of the iframe in pixels or as a percentage of it's
200: * container</p>
201: * @see #getHeight()
202: */
203: public void setHeight(String height) {
204: this .height = height;
205: }
206:
207: // noResize
208: private boolean noResize = false;
209: private boolean noResize_set = false;
210:
211: /**
212: * <p>Set the value of the noResize attribute to "true" when user
213: * is not allowed to resize the frame.</p>
214: */
215: public boolean isNoResize() {
216: if (this .noResize_set) {
217: return this .noResize;
218: }
219: ValueBinding _vb = getValueBinding("noResize");
220: if (_vb != null) {
221: Object _result = _vb.getValue(getFacesContext());
222: if (_result == null) {
223: return false;
224: } else {
225: return ((Boolean) _result).booleanValue();
226: }
227: }
228: return false;
229: }
230:
231: /**
232: * <p>Set the value of the noResize attribute to "true" when user
233: * is not allowed to resize the frame.</p>
234: * @see #isNoResize()
235: */
236: public void setNoResize(boolean noResize) {
237: this .noResize = noResize;
238: this .noResize_set = true;
239: }
240:
241: // width
242: private String width = null;
243:
244: /**
245: * <p>Defines the width of the iframe in pixels or as a percentage of it's
246: * container</p>
247: */
248: public String getWidth() {
249: if (this .width != null) {
250: return this .width;
251: }
252: ValueBinding _vb = getValueBinding("width");
253: if (_vb != null) {
254: return (String) _vb.getValue(getFacesContext());
255: }
256: return null;
257: }
258:
259: /**
260: * <p>Defines the width of the iframe in pixels or as a percentage of it's
261: * container</p>
262: * @see #getWidth()
263: */
264: public void setWidth(String width) {
265: this .width = width;
266: }
267:
268: /**
269: * <p>Restore the state of this component.</p>
270: */
271: public void restoreState(FacesContext _context, Object _state) {
272: Object _values[] = (Object[]) _state;
273: super .restoreState(_context, _values[0]);
274: this .align = (String) _values[1];
275: this .height = (String) _values[2];
276: this .noResize = ((Boolean) _values[3]).booleanValue();
277: this .noResize_set = ((Boolean) _values[4]).booleanValue();
278: this .width = (String) _values[5];
279: }
280:
281: /**
282: * <p>Save the state of this component.</p>
283: */
284: public Object saveState(FacesContext _context) {
285: Object _values[] = new Object[6];
286: _values[0] = super .saveState(_context);
287: _values[1] = this .align;
288: _values[2] = this .height;
289: _values[3] = this .noResize ? Boolean.TRUE : Boolean.FALSE;
290: _values[4] = this .noResize_set ? Boolean.TRUE : Boolean.FALSE;
291: _values[5] = this.width;
292: return _values;
293: }
294:
295: }
|