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.ui;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import java.util.Map;
020    
021    import javax.portlet.PortletURL;
022    
023    import javax.servlet.http.HttpServletRequest;
024    
025    /**
026     * @author Sergio Gonz??lez
027     */
028    public class AppViewDisplayStyleTag extends IncludeTag {
029    
030            @Override
031            public int doStartTag() {
032                    return EVAL_BODY_INCLUDE;
033            }
034    
035            public void setDisplayStyle(String displayStyle) {
036                    _displayStyle = displayStyle;
037            }
038    
039            public void setDisplayStyles(String[] displayStyles) {
040                    _displayStyles = displayStyles;
041            }
042    
043            public void setDisplayStyleURL(PortletURL displayStyleURL) {
044                    _displayStyleURL = displayStyleURL;
045            }
046    
047            public void setEventName(String eventName) {
048                    _eventName = eventName;
049            }
050    
051            public void setRequestParams(Map<String, String> requestParams) {
052                    _requestParams = requestParams;
053            }
054    
055            @Override
056            protected void cleanUp() {
057                    _displayStyle = null;
058                    _displayStyles = null;
059                    _displayStyleURL = null;
060                    _eventName = null;
061                    _requestParams = null;
062            }
063    
064            @Override
065            protected String getPage() {
066                    return _PAGE;
067            }
068    
069            @Override
070            protected boolean isCleanUpSetAttributes() {
071                    return _CLEAN_UP_SET_ATTRIBUTES;
072            }
073    
074            @Override
075            protected void setAttributes(HttpServletRequest request) {
076                    request.setAttribute(
077                            "liferay-ui:app-view-display-style:displayStyle", _displayStyle);
078                    request.setAttribute(
079                            "liferay-ui:app-view-display-style:displayStyles", _displayStyles);
080                    request.setAttribute(
081                            "liferay-ui:app-view-display-style:displayStyleURL",
082                            _displayStyleURL);
083                    request.setAttribute(
084                            "liferay-ui:app-view-display-style:eventName", _eventName);
085                    request.setAttribute(
086                            "liferay-ui:app-view-display-style:requestParams", _requestParams);
087            }
088    
089            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
090    
091            private static final String _PAGE =
092                    "/html/taglib/ui/app_view_display_style/page.jsp";
093    
094            private String _displayStyle;
095            private String[] _displayStyles;
096            private PortletURL _displayStyleURL;
097            private String _eventName;
098            private Map<String, String> _requestParams;
099    
100    }