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="text-decoration: line-through;"></span><span
051: * style="color: rgb(0, 0, 0);">Use the </span><code
052: * style="color: rgb(0, 0, 0);">ui:link</code><span
053: * style="color: rgb(0, 0, 0);"> tag to insert header
054: * references to
055: * other documents related to this HTML page. The <code>ui:link</code>
056: * tag must be used inside the <code>ui:head</code>
057: * tag, and can be used
058: * multiple times for references to multiple documents. A common use for
059: * the <code>ui:link</code>
060: * tag is to link to an external stylesheet, but
061: * it can also be used to provide information about the document's
062: * relationship to other documents. There are a
063: * number of useful defaults making it simpler to specify an HTML link
064: * using this tag.
065: * </span><br
066: * style="color: rgb(0, 0, 0);">
067: * <br>
068: * <strong></strong><br>
069: * <h3>HTML Elements and Layout</h3>
070: * <span style="color: rgb(0, 0, 0);">The
071: * rendered HTML page contains </span><code
072: * style="color: rgb(0, 0, 0);"><link></code><span
073: * style="color: rgb(0, 0, 0);"> element, along with any
074: * attributes
075: * specified through the <code>ui:link</code>
076: * tag attributes. </span>
077: * <h3 style="color: rgb(0, 0, 0);">Theme
078: * Identifiers</h3>
079: * <span style="color: rgb(0, 0, 0);">None.</span>
080: * <h3 style="color: rgb(0, 0, 0);">Client
081: * Side Javascript Functions</h3>
082: * <span style="color: rgb(0, 0, 0);">None.</span>
083: * <h3 style="color: rgb(0, 0, 0);">Example</h3>
084: * <b style="color: rgb(0, 0, 0);">Example
085: * 1: Create a context relative link to a stylesheet</b><br
086: * style="color: rgb(0, 0, 0);">
087: * <br style="color: rgb(0, 0, 0);">
088: * <code style="color: rgb(0, 0, 0);"><ui:page><br>
089: * <ui:html><br>
090: *
091: * <ui:head id="blah"
092: * title="hyperlink test page"><br>
093: *
094: * <span
095: * style="font-weight: bold;"><ui:link
096: * url="/context-relative-path/tomyfile/stylesheet.css"></span><br>
097: *
098: * </ui:head><br>
099: *
100: * <ui:body><br>
101: *
102: * </ui:body><br>
103: * </ui:html><br>
104: * </ui:page></code>
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 LinkBase extends
111: javax.faces.component.UIComponentBase {
112:
113: /**
114: * <p>Construct a new <code>LinkBase</code>.</p>
115: */
116: public LinkBase() {
117: super ();
118: setRendererType("com.sun.rave.web.ui.Link");
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.Link";
129: }
130:
131: // charset
132: private String charset = null;
133:
134: /**
135: * <p>Defines the character encoding (charset) of the target URL. Default
136: * value is "ISO-8859-1".</p>
137: */
138: public String getCharset() {
139: if (this .charset != null) {
140: return this .charset;
141: }
142: ValueBinding _vb = getValueBinding("charset");
143: if (_vb != null) {
144: return (String) _vb.getValue(getFacesContext());
145: }
146: return null;
147: }
148:
149: /**
150: * <p>Defines the character encoding (charset) of the target URL. Default
151: * value is "ISO-8859-1".</p>
152: * @see #getCharset()
153: */
154: public void setCharset(String charset) {
155: this .charset = charset;
156: }
157:
158: // media
159: private String media = null;
160:
161: /**
162: * <p>Specifies the type of display device for which the referenced document
163: * is designed. The media attribute is useful for specifying different
164: * stylesheets for print and viewing on a screen. The default value is
165: * "screen".</p>
166: */
167: public String getMedia() {
168: if (this .media != null) {
169: return this .media;
170: }
171: ValueBinding _vb = getValueBinding("media");
172: if (_vb != null) {
173: return (String) _vb.getValue(getFacesContext());
174: }
175: return null;
176: }
177:
178: /**
179: * <p>Specifies the type of display device for which the referenced document
180: * is designed. The media attribute is useful for specifying different
181: * stylesheets for print and viewing on a screen. The default value is
182: * "screen".</p>
183: * @see #getMedia()
184: */
185: public void setMedia(String media) {
186: this .media = media;
187: }
188:
189: // rel
190: private String rel = null;
191:
192: /**
193: * <p>Defines the relationship between the current document and the
194: * targeted document. Default is "stylesheet". Other possible values
195: * are described at w3.org.</p>
196: */
197: public String getRel() {
198: if (this .rel != null) {
199: return this .rel;
200: }
201: ValueBinding _vb = getValueBinding("rel");
202: if (_vb != null) {
203: return (String) _vb.getValue(getFacesContext());
204: }
205: return "stylesheet";
206: }
207:
208: /**
209: * <p>Defines the relationship between the current document and the
210: * targeted document. Default is "stylesheet". Other possible values
211: * are described at w3.org.</p>
212: * @see #getRel()
213: */
214: public void setRel(String rel) {
215: this .rel = rel;
216: }
217:
218: // type
219: private String type = null;
220:
221: /**
222: * <p>Specifies the MIME type of the target resource. Default is: "text/css"</p>
223: */
224: public String getType() {
225: if (this .type != null) {
226: return this .type;
227: }
228: ValueBinding _vb = getValueBinding("type");
229: if (_vb != null) {
230: return (String) _vb.getValue(getFacesContext());
231: }
232: return "text/css";
233: }
234:
235: /**
236: * <p>Specifies the MIME type of the target resource. Default is: "text/css"</p>
237: * @see #getType()
238: */
239: public void setType(String type) {
240: this .type = type;
241: }
242:
243: // url
244: private String url = null;
245:
246: /**
247: * <p>The absolute or relative target URL of the resource.</p>
248: */
249: public String getUrl() {
250: if (this .url != null) {
251: return this .url;
252: }
253: ValueBinding _vb = getValueBinding("url");
254: if (_vb != null) {
255: return (String) _vb.getValue(getFacesContext());
256: }
257: return null;
258: }
259:
260: /**
261: * <p>The absolute or relative target URL of the resource.</p>
262: * @see #getUrl()
263: */
264: public void setUrl(String url) {
265: this .url = url;
266: }
267:
268: // urlLang
269: private String urlLang = null;
270:
271: /**
272: * <p>Defines the ISO language code of the human language used in the target
273: * URL file. For example, valid values might be en, fr, es.</p>
274: */
275: public String getUrlLang() {
276: if (this .urlLang != null) {
277: return this .urlLang;
278: }
279: ValueBinding _vb = getValueBinding("urlLang");
280: if (_vb != null) {
281: return (String) _vb.getValue(getFacesContext());
282: }
283: return null;
284: }
285:
286: /**
287: * <p>Defines the ISO language code of the human language used in the target
288: * URL file. For example, valid values might be en, fr, es.</p>
289: * @see #getUrlLang()
290: */
291: public void setUrlLang(String urlLang) {
292: this .urlLang = urlLang;
293: }
294:
295: /**
296: * <p>Restore the state of this component.</p>
297: */
298: public void restoreState(FacesContext _context, Object _state) {
299: Object _values[] = (Object[]) _state;
300: super .restoreState(_context, _values[0]);
301: this .charset = (String) _values[1];
302: this .media = (String) _values[2];
303: this .rel = (String) _values[3];
304: this .type = (String) _values[4];
305: this .url = (String) _values[5];
306: this .urlLang = (String) _values[6];
307: }
308:
309: /**
310: * <p>Save the state of this component.</p>
311: */
312: public Object saveState(FacesContext _context) {
313: Object _values[] = new Object[7];
314: _values[0] = super .saveState(_context);
315: _values[1] = this .charset;
316: _values[2] = this .media;
317: _values[3] = this .rel;
318: _values[4] = this .type;
319: _values[5] = this .url;
320: _values[6] = this.urlLang;
321: return _values;
322: }
323:
324: }
|