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: * <body onload="asd();" bgcolor="white">
051: * <span style="color: rgb(0, 0, 0);">Use the </span><code
052: * style="color: rgb(0, 0, 0);">ui:head</code><span
053: * style="color: rgb(0, 0, 0);"> tag to provide information about the
054: * document, to be used in the <code><head></code> element of the
055: * rendered HTML page. The </span><code style="color: rgb(0, 0, 0);">ui:head</code><span
056: * style="color: rgb(0, 0, 0);"> tag must be placed immediately after
057: * the <code>ui:html</code> tag, within the <code>ui:page</code> tag.
058: * The following tags can be
059: * used as children of the <code>ui:head</code> tag:</span><br
060: * style="color: rgb(0, 0, 0);">
061: * <ul style="color: rgb(0, 0, 0);">
062: * <li><a href="link.html"><code>ui:link</code></a></li>
063: * <li><a href="meta.html"><code>ui:meta</code></a></li>
064: * <li><code><a href="script.html">ui:script</a></code></li>
065: * </ul>
066: * <h3 style="color: rgb(0, 0, 0);">HTML Elements and Layout</h3>
067: * <span style="text-decoration: line-through; color: rgb(0, 0, 0);"></span>
068: * <p style="color: rgb(0, 0, 0);">The <code><head></code>
069: * element is rendered in the HTML page, and can include information that
070: * is valid for inclusion in the HTML <code><head></code> element.
071: * For example, if you use the <code>ui:link</code> tag in the <code>ui:head</code>
072: * tag, you can provide the URL to a style sheet. The style sheet
073: * link will be rendered as a <code><link></code> element in
074: * the <code><head></code> element of the HTML page. In
075: * addition this tag will output the appropriate stylesheets for the
076: * included components on the page.<br>
077: * </p>
078: * <span style="color: rgb(0, 0, 0);">The
079: * browser does not display the information in the <code><head></code>
080: * element to the user, with the exception of the title that is used in
081: * the browser's title bar. </span>
082: * <h3 style="color: rgb(0, 0, 0);">Client Side Javascript Functions</h3>
083: * <span style="color: rgb(0, 0, 0);">None. </span>
084: * <h3 style="color: rgb(0, 0, 0);">Example</h3>
085: * <b style="color: rgb(0, 0, 0);">Example 1: Create a head tag </b><br
086: * style="color: rgb(0, 0, 0);">
087: * <code style="color: rgb(0, 0, 0);"><br>
088: * <ui:page><br>
089: * <ui:html><br>
090: * </code><code
091: * style="color: rgb(0, 0, 0);"><ui:head
092: * title="Name of the
093: * page..title is required"><br>
094: * </code><code style="color: rgb(0, 0, 0);">
095: *
096: * <ui:link url="/relativepath/x.css" /></code><code
097: * style="color: rgb(0, 0, 0);"><br>
098: *
099: * <ui:script url="/relativepath/x.js" /><br>
100: * </code><code
101: * style="color: rgb(0, 0, 0);"></ui:head><br>
102: * </code><code
103: * style="color: rgb(0, 0, 0);"><ui:body><br>
104: * </code><code
105: * style="color: rgb(0, 0, 0);">....your
106: * page content....<br>
107: * </code><code
108: * style="color: rgb(0, 0, 0);"></ui:body><br>
109: * </code><code style="color: rgb(0, 0, 0);"></ui:html></code>
110: * <code style="color: rgb(0, 0, 0);"></ui:page></code><span
111: * style="color: rgb(0, 0, 0);"> </span><small><i><br>
112: * <br>
113: * </i></small>
114: * <p>Auto-generated component class.
115: * Do <strong>NOT</strong> modify; all changes
116: * <strong>will</strong> be lost!</p>
117: */
118:
119: public abstract class HeadBase extends
120: javax.faces.component.UIComponentBase {
121:
122: /**
123: * <p>Construct a new <code>HeadBase</code>.</p>
124: */
125: public HeadBase() {
126: super ();
127: setRendererType("com.sun.rave.web.ui.Head");
128: }
129:
130: /**
131: * <p>Return the identifier of the component family to which this
132: * component belongs. This identifier, in conjunction with the value
133: * of the <code>rendererType</code> property, may be used to select
134: * the appropriate {@link Renderer} for this component instance.</p>
135: */
136: public String getFamily() {
137: return "com.sun.rave.web.ui.Head";
138: }
139:
140: // defaultBase
141: private boolean defaultBase = false;
142: private boolean defaultBase_set = false;
143:
144: /**
145: * <p>Flag (true or false) indicating that a default html base tag should be
146: * shown or not. Changing this attribute could cause ui:anchor to not work
147: * properly. The default value is false.</p>
148: */
149: public boolean isDefaultBase() {
150: if (this .defaultBase_set) {
151: return this .defaultBase;
152: }
153: ValueBinding _vb = getValueBinding("defaultBase");
154: if (_vb != null) {
155: Object _result = _vb.getValue(getFacesContext());
156: if (_result == null) {
157: return false;
158: } else {
159: return ((Boolean) _result).booleanValue();
160: }
161: }
162: return false;
163: }
164:
165: /**
166: * <p>Flag (true or false) indicating that a default html base tag should be
167: * shown or not. Changing this attribute could cause ui:anchor to not work
168: * properly. The default value is false.</p>
169: * @see #isDefaultBase()
170: */
171: public void setDefaultBase(boolean defaultBase) {
172: this .defaultBase = defaultBase;
173: this .defaultBase_set = true;
174: }
175:
176: // profile
177: private String profile = null;
178:
179: /**
180: * <p>A space separated list of URL's that contains meta data information
181: * about the page</p>
182: */
183: public String getProfile() {
184: if (this .profile != null) {
185: return this .profile;
186: }
187: ValueBinding _vb = getValueBinding("profile");
188: if (_vb != null) {
189: return (String) _vb.getValue(getFacesContext());
190: }
191: return null;
192: }
193:
194: /**
195: * <p>A space separated list of URL's that contains meta data information
196: * about the page</p>
197: * @see #getProfile()
198: */
199: public void setProfile(String profile) {
200: this .profile = profile;
201: }
202:
203: // title
204: private String title = null;
205:
206: /**
207: * <p>Title of the document to be displayed in the browser title bar.</p>
208: */
209: public String getTitle() {
210: if (this .title != null) {
211: return this .title;
212: }
213: ValueBinding _vb = getValueBinding("title");
214: if (_vb != null) {
215: return (String) _vb.getValue(getFacesContext());
216: }
217: return null;
218: }
219:
220: /**
221: * <p>Title of the document to be displayed in the browser title bar.</p>
222: * @see #getTitle()
223: */
224: public void setTitle(String title) {
225: this .title = title;
226: }
227:
228: /**
229: * <p>Restore the state of this component.</p>
230: */
231: public void restoreState(FacesContext _context, Object _state) {
232: Object _values[] = (Object[]) _state;
233: super .restoreState(_context, _values[0]);
234: this .defaultBase = ((Boolean) _values[1]).booleanValue();
235: this .defaultBase_set = ((Boolean) _values[2]).booleanValue();
236: this .profile = (String) _values[3];
237: this .title = (String) _values[4];
238: }
239:
240: /**
241: * <p>Save the state of this component.</p>
242: */
243: public Object saveState(FacesContext _context) {
244: Object _values[] = new Object[5];
245: _values[0] = super .saveState(_context);
246: _values[1] = this .defaultBase ? Boolean.TRUE : Boolean.FALSE;
247: _values[2] = this .defaultBase_set ? Boolean.TRUE
248: : Boolean.FALSE;
249: _values[3] = this .profile;
250: _values[4] = this.title;
251: return _values;
252: }
253:
254: }
|