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