001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Jean-Marc Orliaguet, Chalmers
011 *
012 * $Id$
013 */
014
015package org.nuxeo.theme.jsf.taglib;
016
017import javax.faces.component.UIComponent;
018import javax.faces.webapp.UIComponentELTag;
019
020public class ButtonTag extends UIComponentELTag {
021    private String identifier;
022
023    private String controlledBy;
024
025    private String switchTo;
026
027    private String link;
028
029    private String menu;
030
031    private String classNames;
032
033    private String icon;
034
035    @Override
036    public String getComponentType() {
037        return "nxthemes.button";
038    }
039
040    @Override
041    public String getRendererType() {
042        return null;
043    }
044
045    @Override
046    protected void setProperties(UIComponent component) {
047        super.setProperties(component);
048
049        // the panel's identifier
050        component.getAttributes().put("identifier", identifier);
051
052        // the perspective controller(s)
053        if (controlledBy != null) {
054            component.getAttributes().put("controlledBy", controlledBy);
055        }
056
057        // the perspective to switch to
058        if (switchTo != null) {
059            component.getAttributes().put("switchTo", switchTo);
060        }
061
062        // the link
063        if (link != null) {
064            component.getAttributes().put("link", link);
065        }
066
067        // the menu
068        if (menu != null) {
069            component.getAttributes().put("menu", menu);
070        }
071
072        // the icon
073        if (icon != null) {
074            component.getAttributes().put("icon", icon);
075        }
076
077        // CSS class names
078        if (classNames != null) {
079            component.getAttributes().put("classNames", classNames);
080        }
081    }
082
083    @Override
084    public void release() {
085        super.release();
086        identifier = null;
087        controlledBy = null;
088        switchTo = null;
089        link = null;
090        menu = null;
091        icon = null;
092        classNames = null;
093    }
094
095    public String getIdentifier() {
096        return identifier;
097    }
098
099    public void setIdentifier(String identifier) {
100        this.identifier = identifier;
101    }
102
103    public String getSwitchTo() {
104        return switchTo;
105    }
106
107    public void setSwitchTo(String switchTo) {
108        this.switchTo = switchTo;
109    }
110
111    public String getControlledBy() {
112        return controlledBy;
113    }
114
115    public void setControlledBy(String controlledBy) {
116        this.controlledBy = controlledBy;
117    }
118
119    public String getLink() {
120        return link;
121    }
122
123    public void setLink(String link) {
124        this.link = link;
125    }
126
127    public String getMenu() {
128        return menu;
129    }
130
131    public void setMenu(String menu) {
132        this.menu = menu;
133    }
134
135    public String getIcon() {
136        return icon;
137    }
138
139    public void setIcon(String icon) {
140        this.icon = icon;
141    }
142
143    public String getClassNames() {
144        return classNames;
145    }
146
147    public void setClassNames(String classNames) {
148        this.classNames = classNames;
149    }
150
151}