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 javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Juan Fernández
023     */
024    public class DDMTemplateSelectorTag extends IncludeTag {
025    
026            public void setClassNameId(long classNameId) {
027                    _classNameId = classNameId;
028            }
029    
030            public void setIcon(String icon) {
031                    _icon = icon;
032            }
033    
034            public void setMessage(String message) {
035                    _message = message;
036            }
037    
038            public void setRefreshURL(String refreshURL) {
039                    _refreshURL = refreshURL;
040            }
041    
042            @Override
043            protected void cleanUp() {
044                    _classNameId = 0;
045                    _icon = null;
046                    _message = null;
047                    _refreshURL = null;
048            }
049    
050            @Override
051            protected String getPage() {
052                    return _PAGE;
053            }
054    
055            @Override
056            protected void setAttributes(HttpServletRequest request) {
057                    request.setAttribute(
058                            "liferay-ui:ddm-template-selector:classNameId",
059                            String.valueOf(_classNameId));
060                    request.setAttribute("liferay-ui:ddm-template-selector:icon", _icon);
061                    request.setAttribute(
062                            "liferay-ui:ddm-template-selector:message", _message);
063                    request.setAttribute(
064                            "liferay-ui:ddm-template-selector:refreshURL", _refreshURL);
065            }
066    
067            private static final String _PAGE =
068                    "/html/taglib/ui/ddm-template-selector/page.jsp";
069    
070            private long _classNameId;
071            private String _icon;
072            private String _message;
073            private String _refreshURL;
074    
075    }