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.util.StringPool;
018    import com.liferay.portal.kernel.util.WebKeys;
019    import com.liferay.portal.theme.ThemeDisplay;
020    import com.liferay.taglib.aui.base.BaseButtonRowTag;
021    
022    import javax.servlet.http.HttpServletRequest;
023    import javax.servlet.jsp.JspWriter;
024    
025    /**
026     * @author Julio Camarero
027     * @author Jorge Ferrer
028     * @author Brian Wing Shun Chan
029     */
030    public class ButtonRowTag extends BaseButtonRowTag {
031    
032            @Override
033            protected boolean isCleanUpSetAttributes() {
034                    return _CLEAN_UP_SET_ATTRIBUTES;
035            }
036    
037            @Override
038            protected int processEndTag() throws Exception {
039                    JspWriter jspWriter = pageContext.getOut();
040    
041                    jspWriter.write("</div>");
042    
043                    return EVAL_PAGE;
044            }
045    
046            @Override
047            protected void setAttributes(HttpServletRequest request) {
048                    ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
049                            WebKeys.THEME_DISPLAY);
050    
051                    if (themeDisplay.isStatePopUp()) {
052                            String cssClass = "dialog-footer";
053    
054                            if (getCssClass() != null) {
055                                    cssClass = cssClass + StringPool.SPACE + getCssClass();
056                            }
057    
058                            setCssClass(cssClass);
059                    }
060    
061                    super.setAttributes(request);
062            }
063    
064            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
065    
066    }