001
014
015 package com.liferay.taglib.aui;
016
017 import com.liferay.portal.kernel.util.HtmlUtil;
018 import com.liferay.taglib.util.IncludeTag;
019
020 import javax.portlet.PortletURL;
021
022 import javax.servlet.http.HttpServletRequest;
023
024
029 public class FormTag extends IncludeTag {
030
031 public void setAction(PortletURL portletURL) {
032 if (portletURL != null) {
033 _action = portletURL.toString();
034 }
035 }
036
037 public void setAction(String action) {
038 _action = action;
039 }
040
041 public void setCssClass(String cssClass) {
042 _cssClass = cssClass;
043 }
044
045 public void setEscapeXml(boolean escapeXml) {
046 _escapeXml = escapeXml;
047 }
048
049 public void setInlineLabels(boolean inlineLabels) {
050 _inlineLabels = inlineLabels;
051 }
052
053 public void setName(String name) {
054 _name = name;
055 }
056
057 public void setOnSubmit(String onSubmit) {
058 _onSubmit = onSubmit;
059 }
060
061 public void setUseNamespace(boolean useNamespace) {
062 _useNamespace = useNamespace;
063 }
064
065 protected void cleanUp() {
066 _action = null;
067 _cssClass = null;
068 _escapeXml = true;
069 _inlineLabels = false;
070 _name = "fm";
071 _onSubmit = null;
072 _useNamespace = true;
073 }
074
075 protected String getEndPage() {
076 return _END_PAGE;
077 }
078
079 protected String getStartPage() {
080 return _START_PAGE;
081 }
082
083 protected boolean isCleanUpSetAttributes() {
084 return _CLEAN_UP_SET_ATTRIBUTES;
085 }
086
087 protected void setAttributes(HttpServletRequest request) {
088 String action = _action;
089
090 if (_escapeXml) {
091 action = HtmlUtil.escape(action);
092 }
093
094 request.setAttribute("aui:form:action", action);
095 request.setAttribute("aui:form:cssClass", _cssClass);
096 request.setAttribute(
097 "aui:form:dynamicAttributes", getDynamicAttributes());
098 request.setAttribute(
099 "aui:form:inlineLabels", String.valueOf(_inlineLabels));
100 request.setAttribute("aui:form:name", _name);
101 request.setAttribute("aui:form:onSubmit", _onSubmit);
102 request.setAttribute(
103 "aui:form:useNamespace", String.valueOf(_useNamespace));
104 }
105
106 private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
107
108 private static final String _END_PAGE = "/html/taglib/aui/form/end.jsp";
109
110 private static final String _START_PAGE = "/html/taglib/aui/form/start.jsp";
111
112 private String _action;
113 private String _cssClass;
114 private boolean _escapeXml = true;
115 private boolean _inlineLabels;
116 private String _name = "fm";
117 private String _onSubmit;
118 private boolean _useNamespace = true;
119
120 }