001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 static final String SITES_CHILDREN = "children";
027    
028            public static final String SITES_PARENT_LEVEL = "parent-level";
029    
030            public static final String SITES_SIBLINGS = "siblings";
031    
032            public static final String SITES_TOP_LEVEL = "top-level";
033    
034            public void setDisplayStyle(String displayStyle) {
035                    _displayStyle = displayStyle;
036            }
037    
038            public void setSites(String sites) {
039                    _sites = sites;
040            }
041    
042            @Override
043            protected void cleanUp() {
044                    _displayStyle = "descriptive";
045                    _sites = SITES_TOP_LEVEL;
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:sites-directory:displayStyle", _displayStyle);
057                    request.setAttribute(
058                            "liferay-ui:sites-directory:sites", String.valueOf(_sites));
059            }
060    
061            private static final String _PAGE =
062                    "/html/taglib/ui/sites_directory/page.jsp";
063    
064            private String _displayStyle = "descriptive";
065            private String _sites = SITES_TOP_LEVEL;
066    
067    }