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 ButtonRowTag 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 _cssClass = null;
50 _dynamicAttributes.clear();
51 _endPage = null;
52 _startPage = null;
53 }
54 }
55 }
56
57 public int doStartTag() throws JspException {
58 try{
59 HttpServletRequest request =
60 (HttpServletRequest)pageContext.getRequest();
61
62 request.setAttribute("aui:button-row:cssClass", _cssClass);
63 request.setAttribute(
64 "aui:button-row:dynamicAttributes", _dynamicAttributes);
65
66 PortalIncludeUtil.include(pageContext, getStartPage());
67
68 return EVAL_BODY_INCLUDE;
69 }
70 catch (Exception e) {
71 throw new JspException(e);
72 }
73 }
74
75 public String getEndPage() {
76 if (Validator.isNull(_endPage)) {
77 return _END_PAGE;
78 }
79 else {
80 return _endPage;
81 }
82 }
83
84 public String getStartPage() {
85 if (Validator.isNull(_startPage)) {
86 return _START_PAGE;
87 }
88 else {
89 return _startPage;
90 }
91 }
92
93 public void setCssClass(String cssClass) {
94 _cssClass = cssClass;
95 }
96
97 public void setDynamicAttribute(
98 String uri, String localName, Object value) {
99
100 _dynamicAttributes.put(localName, value);
101 }
102
103 public void setEndPage(String endPage) {
104 _endPage = endPage;
105 }
106
107 public void setStartPage(String startPage) {
108 _startPage = startPage;
109 }
110
111 private static final String _END_PAGE =
112 "/html/taglib/aui/button_row/end.jsp";
113
114 private static final String _START_PAGE =
115 "/html/taglib/aui/button_row/start.jsp";
116
117 private String _cssClass;
118 private Map<String, Object> _dynamicAttributes =
119 new HashMap<String, Object>();
120 private String _endPage;
121 private String _startPage;
122
123 }