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.context.FacesContext;
023    import org.apache.myfaces.tobago.context.Markup;
024    import org.apache.myfaces.tobago.internal.component.AbstractUISelectItem;
025    import org.apache.commons.lang.ArrayUtils;
026    import org.apache.commons.lang.StringUtils;
027    import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
028    import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
029    import org.apache.myfaces.tobago.internal.util.Deprecation;
030    import org.apache.myfaces.tobago.renderkit.MarginValues;
031    import org.apache.myfaces.tobago.renderkit.SpacingValues;
032    import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
033    import javax.el.ELException;
034    import javax.faces.FacesException;
035    import java.util.ArrayList;
036    import java.util.List;
037    import javax.el.MethodExpression;
038    import javax.el.ValueExpression;
039    
040    /** 
041     Add a child UISelectItem component to the UIComponent
042      associated with the closed parent UIComponent custom
043      action.
044      * UIComponent class, generated from template {@code component1.2.stg} with class
045      * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectItemTagDeclaration}.
046     */
047    public class UISelectItem
048        extends AbstractUISelectItem implements SupportsMarkup {
049    
050      public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectItem";
051    
052      private org.apache.myfaces.tobago.context.Markup markup;
053      private org.apache.myfaces.tobago.context.Markup currentMarkup;
054      private java.lang.String itemImage;
055      private java.lang.Boolean itemDisabled;
056    
057    
058      public org.apache.myfaces.tobago.context.Markup getMarkup() {
059        if (markup != null) {
060          return markup;
061        }
062        ValueExpression ve = getValueExpression("markup");
063        if (ve != null) {
064          try {
065            Object object = ve.getValue(getFacesContext().getELContext());
066            return Markup.valueOf(object);
067          } catch (ELException e) {
068                      throw new FacesException(e);
069              }
070        }
071        return null;
072      }
073    
074      public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
075        this.markup = markup;
076      }
077    
078      public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
079        if (currentMarkup != null) {
080          return currentMarkup;
081        }
082        ValueExpression ve = getValueExpression("currentMarkup");
083        if (ve != null) {
084          try {
085            Object object = ve.getValue(getFacesContext().getELContext());
086            return Markup.valueOf(object);
087          } catch (ELException e) {
088                      throw new FacesException(e);
089              }
090        }
091        return null;
092      }
093    
094      public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
095        this.currentMarkup = currentMarkup;
096      }
097    
098      /**
099      Image to be displayed to the user for this option.
100    
101      */
102      public java.lang.String getItemImage() {
103        if (itemImage != null) {
104          return itemImage;
105        }
106        ValueExpression ve = getValueExpression("itemImage");
107        if (ve != null) {
108          try {
109            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
110          } catch (ELException e) {
111                      throw new FacesException(e);
112              }
113        }
114        return null;
115      }
116    
117      public void setItemImage(java.lang.String itemImage) {
118        this.itemImage = itemImage;
119      }
120    
121      /**
122      Flag indicating whether the option created
123       by this component is disabled.
124      <br />Default: <code>false</code>
125      */
126      public boolean isItemDisabled() {
127        if (itemDisabled != null) {
128          return itemDisabled;
129        }
130        ValueExpression ve = getValueExpression("itemDisabled");
131        if (ve != null) {
132          try {
133            Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext());
134            if (bool != null) {
135              return bool;
136            }
137          } catch (ELException e) {
138                      throw new FacesException(e);
139              }
140        }
141        return false;
142      }
143    
144      public void setItemDisabled(boolean itemDisabled) {
145        this.itemDisabled = itemDisabled;
146      }
147    
148      public void restoreState(FacesContext context, Object componentState) {
149        Object[] values = (Object[]) componentState;
150        super.restoreState(context, values[0]);
151        markup = (org.apache.myfaces.tobago.context.Markup) values[1];
152        currentMarkup = (org.apache.myfaces.tobago.context.Markup) values[2];
153        itemImage = (java.lang.String) values[3];
154        itemDisabled = (java.lang.Boolean) values[4];
155      }
156    
157      public Object saveState(FacesContext context) {
158        Object[] values = new Object[5];
159        values[0] = super.saveState(context);
160        values[1] = markup;
161        values[2] = currentMarkup;
162        values[3] = itemImage;
163        values[4] = itemDisabled;
164        return values;
165      }
166    
167    
168    }