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