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