001    // ---------- Attention: Generated code, please do not modify! -----------  
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more
005     * contributor license agreements.  See the NOTICE file distributed with
006     * this work for additional information regarding copyright ownership.
007     * The ASF licenses this file to You under the Apache License, Version 2.0
008     * (the "License"); you may not use this file except in compliance with
009     * the License.  You may obtain a copy of the License at
010     *
011     *      http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing, software
014     * distributed under the License is distributed on an "AS IS" BASIS,
015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016     * See the License for the specific language governing permissions and
017     * limitations under the License.
018     */
019    
020    package org.apache.myfaces.tobago.component;
021    
022    import javax.faces.component.UIComponentBase;
023    import javax.faces.context.FacesContext;
024    import org.apache.commons.lang.ArrayUtils;
025    import org.apache.commons.lang.StringUtils;
026    import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
027    import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
028    import org.apache.myfaces.tobago.internal.util.Deprecation;
029    import org.apache.myfaces.tobago.renderkit.MarginValues;
030    import org.apache.myfaces.tobago.renderkit.SpacingValues;
031    import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
032    import javax.el.ELException;
033    import javax.faces.FacesException;
034    import java.util.ArrayList;
035    import java.util.List;
036    import javax.el.MethodExpression;
037    import javax.el.ValueExpression;
038    
039    /** 
040     Add a style tag.
041      Collected bodyContent is rendered as content into a style tag.
042      * UIComponent class, generated from template {@code component1.2.stg} with class
043      * {@link org.apache.myfaces.tobago.internal.taglib.component.StyleTagDeclaration}.
044     */
045    public class UIStyle
046        extends UIComponentBase  {
047    
048      public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Style";
049    
050      public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.Style";
051    
052      private java.lang.String style;
053      private java.lang.String file;
054    
055      public String getFamily() {
056        return COMPONENT_FAMILY;
057      }
058    
059    
060      /**
061      stylesheet to add to page.
062    
063      */
064      public java.lang.String getStyle() {
065        if (style != null) {
066          return style;
067        }
068        ValueExpression ve = getValueExpression("style");
069        if (ve != null) {
070          try {
071            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
072          } catch (ELException e) {
073                      throw new FacesException(e);
074              }
075        }
076        return null;
077      }
078    
079      public void setStyle(java.lang.String style) {
080        this.style = style;
081      }
082    
083      /**
084      Name of the stylesheet file to add to page.
085    
086      */
087      public java.lang.String getFile() {
088        if (file != null) {
089          return file;
090        }
091        ValueExpression ve = getValueExpression("file");
092        if (ve != null) {
093          try {
094            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
095          } catch (ELException e) {
096                      throw new FacesException(e);
097              }
098        }
099        return null;
100      }
101    
102      public void setFile(java.lang.String file) {
103        this.file = file;
104      }
105    
106      public void restoreState(FacesContext context, Object componentState) {
107        Object[] values = (Object[]) componentState;
108        super.restoreState(context, values[0]);
109        style = (java.lang.String) values[1];
110        file = (java.lang.String) values[2];
111      }
112    
113      public Object saveState(FacesContext context) {
114        Object[] values = new Object[3];
115        values[0] = super.saveState(context);
116        values[1] = style;
117        values[2] = file;
118        return values;
119      }
120    
121    
122    }