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 ButtonTag extends UIComponentELTag {
028    private String identifier;
029
030    private String controlledBy;
031
032    private String switchTo;
033
034    private String link;
035
036    private String menu;
037
038    private String classNames;
039
040    private String icon;
041
042    @Override
043    public String getComponentType() {
044        return "nxthemes.button";
045    }
046
047    @Override
048    public String getRendererType() {
049        return null;
050    }
051
052    @Override
053    protected void setProperties(UIComponent component) {
054        super.setProperties(component);
055
056        // the panel's identifier
057        component.getAttributes().put("identifier", identifier);
058
059        // the perspective controller(s)
060        if (controlledBy != null) {
061            component.getAttributes().put("controlledBy", controlledBy);
062        }
063
064        // the perspective to switch to
065        if (switchTo != null) {
066            component.getAttributes().put("switchTo", switchTo);
067        }
068
069        // the link
070        if (link != null) {
071            component.getAttributes().put("link", link);
072        }
073
074        // the menu
075        if (menu != null) {
076            component.getAttributes().put("menu", menu);
077        }
078
079        // the icon
080        if (icon != null) {
081            component.getAttributes().put("icon", icon);
082        }
083
084        // CSS class names
085        if (classNames != null) {
086            component.getAttributes().put("classNames", classNames);
087        }
088    }
089
090    @Override
091    public void release() {
092        super.release();
093        identifier = null;
094        controlledBy = null;
095        switchTo = null;
096        link = null;
097        menu = null;
098        icon = null;
099        classNames = null;
100    }
101
102    public String getIdentifier() {
103        return identifier;
104    }
105
106    public void setIdentifier(String identifier) {
107        this.identifier = identifier;
108    }
109
110    public String getSwitchTo() {
111        return switchTo;
112    }
113
114    public void setSwitchTo(String switchTo) {
115        this.switchTo = switchTo;
116    }
117
118    public String getControlledBy() {
119        return controlledBy;
120    }
121
122    public void setControlledBy(String controlledBy) {
123        this.controlledBy = controlledBy;
124    }
125
126    public String getLink() {
127        return link;
128    }
129
130    public void setLink(String link) {
131        this.link = link;
132    }
133
134    public String getMenu() {
135        return menu;
136    }
137
138    public void setMenu(String menu) {
139        this.menu = menu;
140    }
141
142    public String getIcon() {
143        return icon;
144    }
145
146    public void setIcon(String icon) {
147        this.icon = icon;
148    }
149
150    public String getClassNames() {
151        return classNames;
152    }
153
154    public void setClassNames(String classNames) {
155        this.classNames = classNames;
156    }
157
158}