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.portal.kernel.dao.search.SearchContainer;
018    import com.liferay.taglib.util.IncludeTag;
019    import com.liferay.util.RSSUtil;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Eduardo Garcia
025     */
026    public class RSSSettingsTag extends IncludeTag {
027    
028            public void setDelta(int delta) {
029                    _delta = delta;
030            }
031    
032            public void setDisplayStyle(String displayStyle) {
033                    _displayStyle = displayStyle;
034            }
035    
036            public void setEnabled(boolean enabled) {
037                    _enabled = enabled;
038            }
039    
040            public void setFeedType(String feedType) {
041                    _feedType = feedType;
042            }
043    
044            public void setName(String name) {
045                    _name = name;
046            }
047    
048            public void setNameEnabled(boolean nameEnabled) {
049                    _nameEnabled = nameEnabled;
050            }
051    
052            @Override
053            protected void cleanUp() {
054                    _delta = SearchContainer.DEFAULT_DELTA;
055                    _displayStyle = RSSUtil.DISPLAY_STYLE_ABSTRACT;
056                    _enabled = false;
057                    _feedType = RSSUtil.FEED_TYPE_DEFAULT;
058                    _name = null;
059                    _nameEnabled = false;
060            }
061    
062            @Override
063            protected String getPage() {
064                    return _PAGE;
065            }
066    
067            @Override
068            protected boolean isCleanUpSetAttributes() {
069                    return _CLEAN_UP_SET_ATTRIBUTES;
070            }
071    
072            @Override
073            protected void setAttributes(HttpServletRequest request) {
074                    request.setAttribute(
075                            "liferay-ui:rss-settings:delta", String.valueOf(_delta));
076                    request.setAttribute(
077                            "liferay-ui:rss-settings:displayStyle", _displayStyle);
078                    request.setAttribute(
079                            "liferay-ui:rss-settings:enabled", String.valueOf(_enabled));
080                    request.setAttribute("liferay-ui:rss-settings:feedType", _feedType);
081                    request.setAttribute("liferay-ui:rss-settings:name", _name);
082                    request.setAttribute(
083                            "liferay-ui:rss-settings:nameEnabled",
084                            String.valueOf(_nameEnabled));
085            }
086    
087            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
088    
089            private static final String _PAGE = "/html/taglib/ui/rss_settings/page.jsp";
090    
091            private int _delta = SearchContainer.DEFAULT_DELTA;
092            private String _displayStyle = RSSUtil.DISPLAY_STYLE_ABSTRACT;
093            private boolean _enabled;
094            private String _feedType = RSSUtil.FEED_TYPE_DEFAULT;
095            private String _name;
096            private boolean _nameEnabled;
097    
098    }