/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.taglib.aui;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.taglib.aui.base.BaseButtonRowTag;
import com.liferay.taglib.util.InlineUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
/**
* @author Julio Camarero
* @author Jorge Ferrer
* @author Brian Wing Shun Chan
*/
public class ButtonRowTag extends BaseButtonRowTag {
@Override
protected boolean isCleanUpSetAttributes() {
return _CLEAN_UP_SET_ATTRIBUTES;
}
@Override
protected int processEndTag() throws Exception {
JspWriter jspWriter = pageContext.getOut();
jspWriter.write("</div>");
return EVAL_PAGE;
}
@Override
protected int processStartTag() throws Exception {
JspWriter jspWriter = pageContext.getOut();
jspWriter.write("<div class=\"button-holder ");
String cssClass = getCssClass();
if (cssClass != null) {
jspWriter.write(cssClass);
}
jspWriter.write("\" ");
String id = getId();
if (id != null) {
jspWriter.write("id=\"");
jspWriter.write(id);
jspWriter.write("\" ");
}
jspWriter.write(
InlineUtil.buildDynamicAttributes(getDynamicAttributes()));
jspWriter.write(">");
return EVAL_BODY_INCLUDE;
}
@Override
protected void setAttributes(HttpServletRequest request) {
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
WebKeys.THEME_DISPLAY);
if (themeDisplay.isStatePopUp()) {
String cssClass = "dialog-footer";
if (getCssClass() != null) {
cssClass = cssClass + StringPool.SPACE + getCssClass();
}
setCssClass(cssClass);
}
super.setAttributes(request);
}
private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
}