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