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.portal.model.LayoutTemplate;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import java.util.List;
021    
022    import javax.servlet.http.HttpServletRequest;
023    
024    /**
025     * @author Eudaldo Alonso
026     */
027    public class LayoutTemplatesListTag extends IncludeTag {
028    
029            public void setLayoutTemplateId(String layoutTemplateId) {
030                    _layoutTemplateId = layoutTemplateId;
031            }
032    
033            public void setLayoutTemplateIdPrefix(String layoutTemplateIdPrefix) {
034                    _layoutTemplateIdPrefix = layoutTemplateIdPrefix;
035            }
036    
037            public void setLayoutTemplates(List<LayoutTemplate> layoutTemplates) {
038                    _layoutTemplates = layoutTemplates;
039            }
040    
041            @Override
042            protected void cleanUp() {
043                    _layoutTemplateId = null;
044                    _layoutTemplateIdPrefix = null;
045                    _layoutTemplates = null;
046            }
047    
048            @Override
049            protected String getPage() {
050                    return _PAGE;
051            }
052    
053            @Override
054            protected void setAttributes(HttpServletRequest request) {
055                    request.setAttribute(
056                            "liferay-ui:layout-templates-list:layoutTemplateId",
057                            _layoutTemplateId);
058                    request.setAttribute(
059                            "liferay-ui:layout-templates-list:layoutTemplateIdPrefix",
060                            _layoutTemplateIdPrefix);
061                    request.setAttribute(
062                            "liferay-ui:layout-templates-list:layoutTemplates",
063                            _layoutTemplates);
064            }
065    
066            private static final String _PAGE =
067                    "/html/taglib/ui/layout_templates_list/page.jsp";
068    
069            private String _layoutTemplateId;
070            private String _layoutTemplateIdPrefix;
071            private List<LayoutTemplate> _layoutTemplates;
072    
073    }