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.portal.kernel.util.DateRange;
018    import com.liferay.portal.model.Portlet;
019    import com.liferay.taglib.util.IncludeTag;
020    
021    import java.util.List;
022    import java.util.Map;
023    
024    import javax.servlet.http.HttpServletRequest;
025    
026    /**
027     * @author Levente Hud??k
028     */
029    public class PortletListTag extends IncludeTag {
030    
031            public void setDateRange(DateRange dateRange) {
032                    _dateRange = dateRange;
033            }
034    
035            public void setDisableInputs(boolean disableInputs) {
036                    _disableInputs = disableInputs;
037            }
038    
039            public void setParameterMap(Map<String, String[]> parameterMap) {
040                    _parameterMap = parameterMap;
041            }
042    
043            public void setPortlets(List<Portlet> portlets) {
044                    _portlets = portlets;
045            }
046    
047            public void setType(String type) {
048                    _type = type;
049            }
050    
051            @Override
052            protected void cleanUp() {
053                    _dateRange = null;
054                    _disableInputs = false;
055                    _parameterMap = null;
056                    _portlets = null;
057                    _type = null;
058            }
059    
060            @Override
061            protected String getPage() {
062                    return _PAGE;
063            }
064    
065            @Override
066            protected void setAttributes(HttpServletRequest request) {
067                    request.setAttribute(
068                            "liferay-staging:portlet-list:dateRange", _dateRange);
069                    request.setAttribute(
070                            "liferay-staging:portlet-list:disableInputs", _disableInputs);
071                    request.setAttribute(
072                            "liferay-staging:portlet-list:parameterMap", _parameterMap);
073                    request.setAttribute(
074                            "liferay-staging:portlet-list:portlets", _portlets);
075                    request.setAttribute("liferay-staging:portlet-list:type", _type);
076            }
077    
078            private static final String _PAGE =
079                    "/html/taglib/staging/portlet_list/page.jsp";
080    
081            private DateRange _dateRange;
082            private boolean _disableInputs;
083            private Map<String, String[]> _parameterMap;
084            private List<Portlet> _portlets;
085            private String _type;
086    
087    }