001    /**
002     * Copyright (c) 2000-2013 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 setDisplayStyles(String[] displayStyles) {
037                    _displayStyles = displayStyles;
038            }
039    
040            public void setEnabled(boolean enabled) {
041                    _enabled = enabled;
042            }
043    
044            public void setFeedType(String feedType) {
045                    _feedType = feedType;
046            }
047    
048            public void setName(String name) {
049                    _name = name;
050            }
051    
052            public void setNameEnabled(boolean nameEnabled) {
053                    _nameEnabled = nameEnabled;
054            }
055    
056            @Override
057            protected void cleanUp() {
058                    _delta = SearchContainer.DEFAULT_DELTA;
059                    _displayStyle = RSSUtil.DISPLAY_STYLE_DEFAULT;
060                    _displayStyles = RSSUtil.DISPLAY_STYLES;
061                    _enabled = false;
062                    _feedType = RSSUtil.FEED_TYPE_DEFAULT;
063                    _name = null;
064                    _nameEnabled = false;
065            }
066    
067            @Override
068            protected String getPage() {
069                    return _PAGE;
070            }
071    
072            @Override
073            protected boolean isCleanUpSetAttributes() {
074                    return _CLEAN_UP_SET_ATTRIBUTES;
075            }
076    
077            @Override
078            protected void setAttributes(HttpServletRequest request) {
079                    request.setAttribute(
080                            "liferay-ui:rss-settings:delta", String.valueOf(_delta));
081                    request.setAttribute(
082                            "liferay-ui:rss-settings:displayStyle", _displayStyle);
083                    request.setAttribute(
084                            "liferay-ui:rss-settings:displayStyles", _displayStyles);
085                    request.setAttribute(
086                            "liferay-ui:rss-settings:enabled", String.valueOf(_enabled));
087                    request.setAttribute("liferay-ui:rss-settings:feedType", _feedType);
088                    request.setAttribute("liferay-ui:rss-settings:name", _name);
089                    request.setAttribute(
090                            "liferay-ui:rss-settings:nameEnabled",
091                            String.valueOf(_nameEnabled));
092            }
093    
094            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
095    
096            private static final String _PAGE = "/html/taglib/ui/rss_settings/page.jsp";
097    
098            private int _delta = SearchContainer.DEFAULT_DELTA;
099            private String _displayStyle = RSSUtil.DISPLAY_STYLE_DEFAULT;
100            private String[] _displayStyles = RSSUtil.DISPLAY_STYLES;
101            private boolean _enabled;
102            private String _feedType = RSSUtil.FEED_TYPE_DEFAULT;
103            private String _name;
104            private boolean _nameEnabled;
105    
106    }