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