001
014
015 package com.liferay.taglib.aui;
016
017 import com.liferay.portal.kernel.util.StringUtil;
018 import com.liferay.portal.kernel.util.Validator;
019 import com.liferay.taglib.aui.base.BaseButtonTag;
020
021 import javax.servlet.http.HttpServletRequest;
022 import javax.servlet.jsp.JspException;
023 import javax.servlet.jsp.tagext.BodyTag;
024
025
030 public class ButtonTag extends BaseButtonTag implements BodyTag {
031
032 @Override
033 public int doStartTag() throws JspException {
034 super.doStartTag();
035
036 return BodyTag.EVAL_BODY_BUFFERED;
037 }
038
039 @Override
040 public void setIconAlign(String iconAlign) {
041 if (iconAlign != null) {
042 super.setIconAlign(StringUtil.toLowerCase(iconAlign));
043 }
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 super.setAttributes(request);
054
055 String value = getValue();
056
057 if (Validator.isNull(value)) {
058 String type = getType();
059
060 if (type.equals("submit")) {
061 value = "save";
062 }
063 else if (type.equals("cancel")) {
064 value = "cancel";
065 }
066 else if (type.equals("reset")) {
067 value = "reset";
068 }
069 }
070
071 setNamespacedAttribute(request, "value", value);
072 }
073
074 private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
075
076 }