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.NamingContainer;
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     Renders a tab within a tabgroup.
041      * UIComponent class, generated from template {@code component1.2.stg} with class
042      * {@link org.apache.myfaces.tobago.internal.taglib.component.TabTagDeclaration}.
043     */
044    public class UITab
045        extends UIPanel implements NamingContainer {
046    
047      public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Tab";
048    
049      private java.lang.Character accessKey;
050      private java.lang.String labelWithAccessKey;
051      private java.lang.String label;
052      private java.lang.Boolean disabled;
053    
054    
055      /**
056      Deprecated! Has not longer any function.
057    
058      @deprecated*/
059      @Deprecated
060      public java.lang.Character getAccessKey() {
061        if (accessKey != null) {
062          return accessKey;
063        }
064        ValueExpression ve = getValueExpression("accessKey");
065        if (ve != null) {
066          try {
067            return (java.lang.Character) ve.getValue(getFacesContext().getELContext());
068          } catch (ELException e) {
069                      throw new FacesException(e);
070              }
071        }
072        return null;
073      }
074    
075      @Deprecated
076      public void setAccessKey(java.lang.Character accessKey) {
077        this.accessKey = accessKey;
078      }
079    
080      /**
081      Deprecated! Use 'label' instead.
082       Text value to display as label.
083       If text contains an underscore the next character overwrites 'accesskey'.
084    
085      @deprecated*/
086      @Deprecated
087      public java.lang.String getLabelWithAccessKey() {
088        if (labelWithAccessKey != null) {
089          return labelWithAccessKey;
090        }
091        ValueExpression ve = getValueExpression("labelWithAccessKey");
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      @Deprecated
103      public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
104        this.labelWithAccessKey = labelWithAccessKey;
105      }
106    
107      /**
108      Text value to display as label.
109       If text contains an underscore the next character is used as accesskey.
110    
111      */
112      public java.lang.String getLabel() {
113        if (label != null) {
114          return label;
115        }
116        ValueExpression ve = getValueExpression("label");
117        if (ve != null) {
118          try {
119            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
120          } catch (ELException e) {
121                      throw new FacesException(e);
122              }
123        }
124        return null;
125      }
126    
127      public void setLabel(java.lang.String label) {
128        this.label = label;
129      }
130    
131      /**
132      Flag indicating that this element is disabled.
133      <br />Default: <code>false</code>
134      */
135      public boolean isDisabled() {
136        if (disabled != null) {
137          return disabled;
138        }
139        ValueExpression ve = getValueExpression("disabled");
140        if (ve != null) {
141          try {
142            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
143            if (bool != null) {
144              return bool;
145            }
146          } catch (ELException e) {
147                      throw new FacesException(e);
148              }
149        }
150        return false;
151      }
152    
153      public void setDisabled(boolean disabled) {
154        this.disabled = disabled;
155      }
156    
157      public void restoreState(FacesContext context, Object componentState) {
158        Object[] values = (Object[]) componentState;
159        super.restoreState(context, values[0]);
160        accessKey = (java.lang.Character) values[1];
161        labelWithAccessKey = (java.lang.String) values[2];
162        label = (java.lang.String) values[3];
163        disabled = (java.lang.Boolean) values[4];
164      }
165    
166      public Object saveState(FacesContext context) {
167        Object[] values = new Object[5];
168        values[0] = super.saveState(context);
169        values[1] = accessKey;
170        values[2] = labelWithAccessKey;
171        values[3] = label;
172        values[4] = disabled;
173        return values;
174      }
175    
176    
177    }