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.aui;
016    
017    import com.liferay.portal.kernel.language.LanguageUtil;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.taglib.aui.base.BaseNavItemTag;
020    
021    import javax.servlet.http.HttpServletRequest;
022    import javax.servlet.jsp.JspException;
023    import javax.servlet.jsp.tagext.BodyTag;
024    
025    /**
026     * @author Eduardo Lundgren
027     * @author Bruno Basto
028     * @author Nathan Cavanaugh
029     * @author Julio Camarero
030     * @author Carlos Sierra Andr??s
031     */
032    public class NavItemTag extends BaseNavItemTag implements BodyTag {
033    
034            @Override
035            public int doStartTag() throws JspException {
036                    super.doStartTag();
037    
038                    return BodyTag.EVAL_BODY_BUFFERED;
039            }
040    
041            @Override
042            protected void setAttributes(HttpServletRequest request) {
043                    super.setAttributes(request);
044    
045                    if (!getUseDialog() && AUIUtil.isOpensNewWindow(getTarget())) {
046                            String title = getTitle();
047    
048                            if (title == null) {
049                                    title = StringPool.BLANK;
050                            }
051    
052                            title = title.concat(LanguageUtil.get(request, "opens-new-window"));
053    
054                            setNamespacedAttribute(request, "title", String.valueOf(title));
055                    }
056            }
057    
058    }