001    /**
002     * Copyright (c) 2000-2012 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.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Sergio González
025     */
026    public class AppViewDisplayStyleTag extends IncludeTag {
027    
028            @Override
029            public int doStartTag() {
030                    return EVAL_BODY_INCLUDE;
031            }
032    
033            public void setDisplayStyle(String displayStyle) {
034                    _displayStyle = displayStyle;
035            }
036    
037            public void setDisplayStyles(String[] displayStyles) {
038                    _displayStyles = displayStyles;
039            }
040    
041            public void setRequestParams(Map<String, String> requestParams) {
042                    _requestParams = requestParams;
043            }
044    
045            @Override
046            protected void cleanUp() {
047                    super.cleanUp();
048    
049                    _displayStyle = null;
050                    _displayStyles = null;
051                    _requestParams = null;
052            }
053    
054            @Override
055            protected String getPage() {
056                    return _PAGE;
057            }
058    
059            @Override
060            protected boolean isCleanUpSetAttributes() {
061                    return _CLEAN_UP_SET_ATTRIBUTES;
062            }
063    
064            @Override
065            protected void setAttributes(HttpServletRequest request) {
066                    request.setAttribute(
067                            "liferay-ui:app-view-display-style:displayStyle", _displayStyle);
068                    request.setAttribute(
069                            "liferay-ui:app-view-display-style:displayStyles", _displayStyles);
070                    request.setAttribute(
071                            "liferay-ui:app-view-display-style:requestParams", _requestParams);
072            }
073    
074            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
075    
076            private static final String _PAGE =
077                    "/html/taglib/ui/app_view_display_style/page.jsp";
078    
079            private String _displayStyle;
080            private String[] _displayStyles;
081            private Map<String, String> _requestParams;
082    
083    }