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 org.apache.commons.logging.Log;
021    import org.apache.commons.logging.LogFactory;
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
023    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
024    import org.apache.myfaces.tobago.component.ComponentUtil;
025    import org.apache.myfaces.tobago.component.UITab;
026    
027    import javax.faces.component.UIComponent;
028    import javax.servlet.jsp.tagext.BodyTag;
029    
030    public class TabTag extends TobagoBodyTag
031        implements BodyTag, TabTagDeclaration {
032      private static final Log LOG = LogFactory.getLog(TabTag.class);
033      private String label;
034      private String tip;
035      private String markup;
036    
037    
038      public String getComponentType() {
039        return UITab.COMPONENT_TYPE;
040      }
041    
042      protected void setProperties(UIComponent component) {
043        super.setProperties(component);
044        ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
045        ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
046        ComponentUtil.setMarkup(component, markup);
047      }
048    
049      public void release() {
050        super.release();
051        label = null;
052        tip = null;
053        markup = null;
054      }
055    
056      public void setMarkup(String markup) {
057        this.markup = markup;
058      }
059    
060      public String getLabel() {
061        return label;
062      }
063    
064      public void setLabel(String label) {
065        this.label = label;
066      }
067    
068      public String getAccessKey() {
069        return null;
070      }
071    
072      public void setAccessKey(String accessKey) {
073        LOG.warn("Attibute 'accessKey' is deprecated, "
074            + "and will removed soon!");
075      }
076    
077      public String getLabelWithAccessKey() {
078        return label;
079      }
080    
081      public void setLabelWithAccessKey(String labelWithAccessKey) {
082        LOG.warn("Attibute 'labelWithAccessKey' is deprecated, "
083            + "and will removed soon! Please use 'label' instead.");
084        setLabel(labelWithAccessKey);
085      }
086    
087      public String getTip() {
088        return tip;
089      }
090    
091      public void setTip(String tip) {
092        this.tip = tip;
093      }
094    }
095