001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.staging;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class MenuTag extends IncludeTag {
025    
026            public void setCssClass(String cssClass) {
027                    _cssClass = cssClass;
028            }
029    
030            public void setExtended(boolean extended) {
031                    _extended = extended;
032            }
033    
034            public void setIcon(String icon) {
035                    _icon = icon;
036            }
037    
038            public void setLayoutSetBranchId(long layoutSetBranchId) {
039                    _layoutSetBranchId = layoutSetBranchId;
040            }
041    
042            public void setMessage(String message) {
043                    _message = message;
044            }
045    
046            public void setOnlyActions(boolean onlyActions) {
047                    _onlyActions = onlyActions;
048            }
049    
050            public void setSelPlid(long selPlid) {
051                    _selPlid = selPlid;
052            }
053    
054            public void setShowManageBranches(boolean showManageBranches) {
055                    _showManageBranches = showManageBranches;
056            }
057    
058            @Override
059            protected void cleanUp() {
060                    _cssClass = null;
061                    _extended = true;
062                    _icon = "/dockbar/staging.png";
063                    _layoutSetBranchId = 0;
064                    _message = "staging";
065                    _onlyActions = false;
066                    _selPlid = 0;
067                    _showManageBranches = false;
068            }
069    
070            @Override
071            protected String getPage() {
072                    return _PAGE;
073            }
074    
075            @Override
076            protected void setAttributes(HttpServletRequest request) {
077                    request.setAttribute("liferay-staging:menu:cssClass", _cssClass);
078                    request.setAttribute(
079                            "liferay-staging:menu:extended", String.valueOf(_extended));
080                    request.setAttribute("liferay-staging:menu:icon", _icon);
081                    request.setAttribute(
082                            "liferay-staging:menu:layoutSetBranchId",
083                            String.valueOf(_layoutSetBranchId));
084                    request.setAttribute("liferay-staging:menu:message", _message);
085                    request.setAttribute(
086                            "liferay-staging:menu:onlyActions", String.valueOf(_onlyActions));
087                    request.setAttribute(
088                            "liferay-staging:menu:selPlid", String.valueOf(_selPlid));
089                    request.setAttribute(
090                            "liferay-staging:menu:showManageBranches",
091                            String.valueOf(_showManageBranches));
092            }
093    
094            private static final String _PAGE = "/html/taglib/staging/menu/page.jsp";
095    
096            private String _cssClass;
097            private boolean _extended = true;
098            private String _icon = "/dockbar/staging.png";
099            private long _layoutSetBranchId;
100            private String _message = "staging";
101            private boolean _onlyActions;
102            private long _selPlid;
103            private boolean _showManageBranches;
104    
105    }