001    package org.apache.myfaces.tobago.taglib.component;
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    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
021    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
022    import org.apache.myfaces.tobago.component.ComponentUtil;
023    import org.apache.myfaces.tobago.component.UISelectItem;
024    
025    import javax.faces.component.UIComponent;
026    
027    public class SelectItemTag extends TobagoTag implements SelectItemTagDeclaration {
028    
029      private String itemDescription;
030      private String itemDisabled;
031      private String itemLabel;
032      private String itemValue;
033      private String value;
034      private String itemImage;
035    
036    
037      public String getComponentType() {
038        return UISelectItem.COMPONENT_TYPE;
039      }
040    
041      public String getRendererType() {
042        return null;
043      }
044    
045      protected void setProperties(UIComponent component) {
046        super.setProperties(component);
047        ComponentUtil.setStringProperty(component, "itemDescription", itemDescription);
048        ComponentUtil.setBooleanProperty(component, "itemDisabled", itemDisabled);
049        ComponentUtil.setStringProperty(component, "itemLabel", itemLabel);
050        ComponentUtil.setStringProperty(component, "itemValue", itemValue);
051        ComponentUtil.setStringProperty(component, ATTR_VALUE, value);
052        ComponentUtil.setStringProperty(component, ATTR_IMAGE, itemImage);
053      }
054    
055      public void release() {
056        super.release();
057        itemDescription = null;
058        itemDisabled = null;
059        itemLabel = null;
060        itemValue = null;
061        value = null;
062        itemImage = null;
063      }
064    
065      public String getItemDescription() {
066        return itemDescription;
067      }
068    
069      public void setItemDescription(String itemDescription) {
070        this.itemDescription = itemDescription;
071      }
072    
073      public String getItemDisabled() {
074        return itemDisabled;
075      }
076    
077      public void setItemDisabled(String itemDisabled) {
078        this.itemDisabled = itemDisabled;
079      }
080    
081      public String getItemLabel() {
082        return itemLabel;
083      }
084    
085      public void setItemLabel(String itemLabel) {
086        this.itemLabel = itemLabel;
087      }
088    
089      public String getItemValue() {
090        return itemValue;
091      }
092    
093      public void setItemValue(String itemValue) {
094        this.itemValue = itemValue;
095      }
096    
097      public String getValue() {
098        return value;
099      }
100    
101      public void setValue(String value) {
102        this.value = value;
103      }
104    
105      public String getItemImage() {
106        return itemImage;
107      }
108    
109      public void setItemImage(String itemImage) {
110        this.itemImage = itemImage;
111      }
112    }