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 Sergio González
023     */
024    public class SitesDirectoryTag extends IncludeTag {
025    
026            public void setBulletStyle(String bulletStyle) {
027                    _bulletStyle = bulletStyle;
028            }
029    
030            public void setDisplayStyle(String displayStyle) {
031                    _displayStyle = displayStyle;
032            }
033    
034            public void setHeaderType(String headerType) {
035                    _headerType = headerType;
036            }
037    
038            public void setIncludedGroups(String includedGroups) {
039                    _includedGroups = includedGroups;
040            }
041    
042            public void setNestedChildren(boolean nestedChildren) {
043                    _nestedChildren = nestedChildren;
044            }
045    
046            public void setRootGroupLevel(int rootGroupLevel) {
047                    _rootGroupLevel = rootGroupLevel;
048            }
049    
050            public void setRootGroupType(String rootGroupType) {
051                    _rootGroupType = rootGroupType;
052            }
053    
054            @Override
055            protected void cleanUp() {
056                    _bulletStyle = "1";
057                    _displayStyle = "descriptive";
058                    _headerType = "none";
059                    _includedGroups = "auto";
060                    _nestedChildren = true;
061                    _rootGroupLevel = 1;
062                    _rootGroupType = "absolute";
063            }
064    
065            @Override
066            protected String getPage() {
067                    return _PAGE;
068            }
069    
070            @Override
071            protected void setAttributes(HttpServletRequest request) {
072                    request.setAttribute(
073                            "liferay-ui:sites-directory:bulletStyle", _bulletStyle);
074                    request.setAttribute(
075                            "liferay-ui:sites-directory:displayStyle", _displayStyle);
076                    request.setAttribute(
077                            "liferay-ui:sites-directory:headerType", _headerType);
078                    request.setAttribute(
079                            "liferay-ui:sites-directory:includedGroups", _includedGroups);
080                    request.setAttribute(
081                            "liferay-ui:sites-directory:nestedChildren",
082                            String.valueOf(_nestedChildren));
083                    request.setAttribute(
084                            "liferay-ui:sites-directory:rootGroupLevel",
085                            String.valueOf(_rootGroupLevel));
086                    request.setAttribute(
087                            "liferay-ui:sites-directory:rootGroupType", _rootGroupType);
088            }
089    
090            private static final String _PAGE =
091                    "/html/taglib/ui/sites_directory/page.jsp";
092    
093            private String _bulletStyle = "1";
094            private String _displayStyle = "descriptive";
095            private String _headerType = "none";
096            private String _includedGroups = "auto";
097            private boolean _nestedChildren = true;
098            private int _rootGroupLevel = 1;
099            private String _rootGroupType = "absolute";
100    
101    }