1
22
23 package com.liferay.taglib.ui;
24
25 import com.liferay.portal.kernel.util.Validator;
26 import com.liferay.taglib.util.ParamAndPropertyAncestorTagImpl;
27
28 import javax.servlet.http.HttpServletRequest;
29 import javax.servlet.jsp.JspException;
30
31
37 public class ToggleAreaTag extends ParamAndPropertyAncestorTagImpl {
38
39 public int doStartTag() throws JspException {
40 try {
41 HttpServletRequest request =
42 (HttpServletRequest)pageContext.getRequest();
43
44 request.setAttribute("liferay-ui:toggle-area:id", _id);
45 request.setAttribute(
46 "liferay-ui:toggle-area:showImage", _showImage);
47 request.setAttribute(
48 "liferay-ui:toggle-area:hideImage", _hideImage);
49 request.setAttribute(
50 "liferay-ui:toggle-area:showMessage", _showMessage);
51 request.setAttribute(
52 "liferay-ui:toggle-area:hideMessage", _hideMessage);
53 request.setAttribute(
54 "liferay-ui:toggle-area:defaultShowContent",
55 String.valueOf(_defaultShowContent));
56 request.setAttribute("liferay-ui:toggle-area:stateVar", _stateVar);
57 request.setAttribute("liferay-ui:toggle-area:align", _align);
58
59 include(getStartPage());
60
61 return EVAL_BODY_INCLUDE;
62 }
63 catch (Exception e) {
64 throw new JspException(e);
65 }
66 }
67
68 public int doEndTag() throws JspException {
69 try {
70 include(getEndPage());
71
72 return EVAL_PAGE;
73 }
74 catch (Exception e) {
75 throw new JspException(e);
76 }
77 finally {
78 _startPage = null;
79 _endPage = null;
80 _id = null;
81 _showMessage = null;
82 _hideMessage = null;
83 _defaultShowContent = true;
84 _stateVar = null;
85 _align = "left";
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 setStartPage(String startPage) {
99 _startPage = startPage;
100 }
101
102 public String getEndPage() {
103 if (Validator.isNull(_endPage)) {
104 return _END_PAGE;
105 }
106 else {
107 return _endPage;
108 }
109 }
110
111 public void setEndPage(String endPage) {
112 _endPage = endPage;
113 }
114
115 public void setId(String id) {
116 _id = id;
117 }
118
119 public void setShowImage(String showImage) {
120 _showImage = showImage;
121 }
122
123 public void setHideImage(String hideImage) {
124 _hideImage = hideImage;
125 }
126
127 public void setShowMessage(String showMessage) {
128 _showMessage = showMessage;
129 }
130
131 public void setHideMessage(String hideMessage) {
132 _hideMessage = hideMessage;
133 }
134
135 public void setDefaultShowContent(boolean defaultShowContent) {
136 _defaultShowContent = defaultShowContent;
137 }
138
139 public void setStateVar(String stateVar) {
140 _stateVar = stateVar;
141 }
142
143 public void setAlign(String align) {
144 _align = align;
145 }
146
147 private static final String _START_PAGE =
148 "/html/taglib/ui/toggle_area/start.jsp";
149
150 private static final String _END_PAGE =
151 "/html/taglib/ui/toggle_area/end.jsp";
152
153 private String _startPage;
154 private String _endPage;
155 private String _id;
156 private String _showImage;
157 private String _hideImage;
158 private String _showMessage;
159 private String _hideMessage;
160 private boolean _defaultShowContent = true;
161 private String _stateVar;
162 private String _align = "left";
163
164 }