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.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     * @author Jorge Ferrer
024     */
025    public class NavigationTag extends IncludeTag {
026    
027            public void setBulletStyle(String bulletStyle) {
028                    _bulletStyle = bulletStyle;
029            }
030    
031            public void setDisplayStyle(String displayStyle) {
032                    _displayStyle = displayStyle;
033            }
034    
035            public void setHeaderType(String headerType) {
036                    _headerType = headerType;
037            }
038    
039            public void setIncludedLayouts(String includedLayouts) {
040                    _includedLayouts = includedLayouts;
041            }
042    
043            public void setNestedChildren(boolean nestedChildren) {
044                    _nestedChildren = nestedChildren;
045            }
046    
047            public void setRootLayoutLevel(int rootLayoutLevel) {
048                    _rootLayoutLevel = rootLayoutLevel;
049            }
050    
051            public void setRootLayoutType(String rootLayoutType) {
052                    _rootLayoutType = rootLayoutType;
053            }
054    
055            @Override
056            protected void cleanUp() {
057                    _bulletStyle = "1";
058                    _displayStyle = "1";
059                    _headerType = "none";
060                    _includedLayouts = "auto";
061                    _nestedChildren = true;
062                    _rootLayoutLevel = 1;
063                    _rootLayoutType = "absolute";
064            }
065    
066            @Override
067            protected String getPage() {
068                    return _PAGE;
069            }
070    
071            @Override
072            protected void setAttributes(HttpServletRequest request) {
073                    request.setAttribute("liferay-ui:navigation:bulletStyle", _bulletStyle);
074                    request.setAttribute(
075                            "liferay-ui:navigation:displayStyle", _displayStyle);
076                    request.setAttribute("liferay-ui:navigation:headerType", _headerType);
077                    request.setAttribute(
078                            "liferay-ui:navigation:includedLayouts", _includedLayouts);
079                    request.setAttribute(
080                            "liferay-ui:navigation:nestedChildren",
081                            String.valueOf(_nestedChildren));
082                    request.setAttribute(
083                            "liferay-ui:navigation:rootLayoutLevel",
084                            String.valueOf(_rootLayoutLevel));
085                    request.setAttribute(
086                            "liferay-ui:navigation:rootLayoutType", _rootLayoutType);
087            }
088    
089            private static final String _PAGE = "/html/taglib/ui/navigation/page.jsp";
090    
091            private String _bulletStyle = "1";
092            private String _displayStyle = "1";
093            private String _headerType = "none";
094            private String _includedLayouts = "auto";
095            private boolean _nestedChildren = true;
096            private int _rootLayoutLevel = 1;
097            private String _rootLayoutType = "absolute";
098    
099    }