001    /**
002     * Copyright (c) 2000-present 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.servlet.taglib.ui.Menu;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Sergio Gonz??lez
024     */
025    public class MenuTag extends IncludeTag {
026    
027            @Override
028            public int doStartTag() {
029                    return EVAL_BODY_INCLUDE;
030            }
031    
032            public void setMenu(Menu menu) {
033                    _menu = menu;
034            }
035    
036            @Override
037            protected void cleanUp() {
038                    _menu = null;
039            }
040    
041            @Override
042            protected String getPage() {
043                    return _PAGE;
044            }
045    
046            @Override
047            protected boolean isCleanUpSetAttributes() {
048                    return _CLEAN_UP_SET_ATTRIBUTES;
049            }
050    
051            @Override
052            protected void setAttributes(HttpServletRequest request) {
053                    request.setAttribute("liferay-ui:menu:menu", _menu);
054            }
055    
056            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
057    
058            private static final String _PAGE = "/html/taglib/ui/menu/page.jsp";
059    
060            private Menu _menu;
061    
062    }