1
14
15 package com.liferay.taglib.aui;
16
17 import com.liferay.portal.kernel.servlet.PortalIncludeUtil;
18 import com.liferay.portal.kernel.util.ServerDetector;
19 import com.liferay.portal.kernel.util.Validator;
20 import com.liferay.taglib.util.IncludeTag;
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25 import javax.servlet.http.HttpServletRequest;
26 import javax.servlet.jsp.JspException;
27 import javax.servlet.jsp.tagext.DynamicAttributes;
28
29
36 public class FieldsetTag extends IncludeTag implements DynamicAttributes {
37
38 public int doEndTag() throws JspException {
39 try{
40 PortalIncludeUtil.include(pageContext, getEndPage());
41
42 return EVAL_PAGE;
43 }
44 catch (Exception e) {
45 throw new JspException(e);
46 }
47 finally {
48 if (!ServerDetector.isResin()) {
49 _column = false;
50 _cssClass = null;
51 _dynamicAttributes.clear();
52 _endPage = null;
53 _label = null;
54 _startPage = null;
55 }
56 }
57 }
58
59 public int doStartTag() throws JspException {
60 try{
61 HttpServletRequest request =
62 (HttpServletRequest)pageContext.getRequest();
63
64 request.setAttribute(
65 "aui:fieldset:column", String.valueOf(_column));
66 request.setAttribute("aui:fieldset:cssClass", _cssClass);
67 request.setAttribute(
68 "aui:fieldset:dynamicAttributes", _dynamicAttributes);
69 request.setAttribute("aui:fieldset:label", _label);
70
71 PortalIncludeUtil.include(pageContext, getStartPage());
72
73 return EVAL_BODY_INCLUDE;
74 }
75 catch (Exception e) {
76 throw new JspException(e);
77 }
78 }
79
80 public String getEndPage() {
81 if (Validator.isNull(_endPage)) {
82 return _END_PAGE;
83 }
84 else {
85 return _endPage;
86 }
87 }
88
89 public String getStartPage() {
90 if (Validator.isNull(_startPage)) {
91 return _START_PAGE;
92 }
93 else {
94 return _startPage;
95 }
96 }
97
98 public void setColumn(boolean column) {
99 _column = column;
100 }
101
102 public void setCssClass(String cssClass) {
103 _cssClass = cssClass;
104 }
105
106 public void setDynamicAttribute(
107 String uri, String localName, Object value) {
108
109 _dynamicAttributes.put(localName, value);
110 }
111
112 public void setEndPage(String endPage) {
113 _endPage = endPage;
114 }
115
116 public void setLabel(String label) {
117 _label = label;
118 }
119
120 public void setStartPage(String startPage) {
121 _startPage = startPage;
122 }
123
124 private static final String _END_PAGE =
125 "/html/taglib/aui/fieldset/end.jsp";
126
127 private static final String _START_PAGE =
128 "/html/taglib/aui/fieldset/start.jsp";
129
130 private boolean _column;
131 private String _cssClass;
132 private Map<String, Object> _dynamicAttributes =
133 new HashMap<String, Object>();
134 private String _endPage;
135 private String _label;
136 private String _startPage;
137
138 }