001: /*
002: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
003: *
004: * "The contents of this file are subject to the Mozilla Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License at
007: * http://www.mozilla.org/MPL/
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
011: * License for the specific language governing rights and limitations under
012: * the License.
013: *
014: * The Original Code is ICEfaces 1.5 open source software code, released
015: * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
016: * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
017: * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
018: *
019: * Contributor(s): _____________________.
020: *
021: * Alternatively, the contents of this file may be used under the terms of
022: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
023: * License), in which case the provisions of the LGPL License are
024: * applicable instead of those above. If you wish to allow use of your
025: * version of this file only under the terms of the LGPL License and not to
026: * allow others to use your version of this file under the MPL, indicate
027: * your decision by deleting the provisions above and replace them with
028: * the notice and other provisions required by the LGPL License. If you do
029: * not delete the provisions above, a recipient may use your version of
030: * this file under either the MPL or the LGPL License."
031: *
032: */
033:
034: package com.icesoft.faces.component.style;
035:
036: import javax.faces.component.UIComponentBase;
037: import javax.faces.el.ValueBinding;
038:
039: /**
040: * The OutputStyle component will include an additional style sheet for Internet
041: * Explorer and Safari browsers. An additional style sheet will also be included
042: * when rendered in Sun Studio Creator design time. This allows style classes to
043: * be overridden for specific browsers.
044: */
045: public class OutputStyle extends UIComponentBase {
046:
047: public static final String COMPONENT_TYPE = "com.icesoft.faces.OutputStyleComp";
048: public static final String COMPONENT_FAMILY = "com.icesoft.faces.OutputStyle";
049: public static final String DEFAULT_RENDERER_TYPE = "com.icesoft.faces.style.OutputStyleRenderer";
050:
051: /**
052: * The href value of the link element that is rendered. An additional link
053: * ellement is rendered for internet explorer and Safari browsers. An
054: * additional style sheet is specifed when in design time in Studio Creator.
055: * The IE style sheet must end with '_ie.css', and the Safari style sheet
056: * must end with '_safari.css'. Design Time is '_dt.css' For example if the
057: * href value is 'style.css' then the IE style sheet needs to be named
058: * 'style_ie.css'
059: */
060: private String href;
061: private String userAgent;
062:
063: public OutputStyle() {
064: super ();
065: }
066:
067: public String getFamily() {
068: return COMPONENT_FAMILY;
069: }
070:
071: public String getRendererType() {
072: return DEFAULT_RENDERER_TYPE;
073: }
074:
075: /**
076: * Returns the href value of the link element that is rendered.
077: */
078: public String getHref() {
079: if (href != null) {
080: return href;
081: }
082: ValueBinding vb = getValueBinding("href");
083: if (vb != null) {
084: return (String) vb.getValue(getFacesContext());
085: }
086: return null;
087: }
088:
089: public String getUserAgent() {
090: return userAgent;
091: }
092:
093: public void setUserAgent(String userAgent) {
094: this .userAgent = userAgent;
095: }
096:
097: /**
098: * Sets the href value of the link element that is rendered.
099: * <p/>
100: * The href value of the link element that is rendered. An additional link
101: * element is rendered for internet explorer and Safari browsers. An
102: * additional style sheet is specifed when in design time in Studio Creator.
103: * The IE style sheet must end with '_ie.css', and the Safari style sheet
104: * must end with '_safari.css'. Design Time is '_dt.css' For example if the
105: * href value is 'style.css' then the IE style sheet needs to be named
106: * 'style_ie.css' </p>
107: */
108: public void setHref(String href) {
109: this.href = href;
110: }
111:
112: }
|