001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Jean-Marc Orliaguet, Chalmers
018 *
019 * $Id$
020 */
021
022package org.nuxeo.theme.jsf.taglib;
023
024import javax.faces.component.UIComponent;
025import javax.faces.webapp.UIComponentELTag;
026
027public class TabTag extends UIComponentELTag {
028    private String label;
029
030    private String switchTo;
031
032    private String link;
033
034    @Override
035    public String getComponentType() {
036        return "nxthemes.tab";
037    }
038
039    @Override
040    public String getRendererType() {
041        return null;
042    }
043
044    @Override
045    protected void setProperties(UIComponent component) {
046        super.setProperties(component);
047
048        // the panel's identifier
049        component.getAttributes().put("label", label);
050
051        // the perspective to switch to
052        if (switchTo != null) {
053            component.getAttributes().put("switchTo", switchTo);
054        }
055
056        // the link
057        if (link != null) {
058            component.getAttributes().put("link", link);
059        }
060    }
061
062    @Override
063    public void release() {
064        super.release();
065        label = null;
066        switchTo = null;
067        link = null;
068    }
069
070    public String getLabel() {
071        return label;
072    }
073
074    public void setLabel(String label) {
075        this.label = label;
076    }
077
078    public String getLink() {
079        return link;
080    }
081
082    public void setLink(String link) {
083        this.link = link;
084    }
085
086    public String getSwitchTo() {
087        return switchTo;
088    }
089
090    public void setSwitchTo(String switchTo) {
091        this.switchTo = switchTo;
092    }
093
094}