1
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.dao.search.DisplayTerms;
18 import com.liferay.portal.kernel.servlet.PortalIncludeUtil;
19 import com.liferay.portal.kernel.util.Validator;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.jsp.JspException;
23 import javax.servlet.jsp.tagext.TagSupport;
24
25
30 public class SearchToggleTag extends TagSupport {
31
32 public int doStartTag() throws JspException {
33 try {
34 HttpServletRequest request =
35 (HttpServletRequest)pageContext.getRequest();
36
37 request.setAttribute("liferay-ui:search-toggle:id", _id);
38 request.setAttribute(
39 "liferay-ui:search-toggle:displayTerms", _displayTerms);
40 request.setAttribute(
41 "liferay-ui:search-toggle:buttonLabel", _buttonLabel);
42
43 PortalIncludeUtil.include(pageContext, getStartPage());
44
45 return EVAL_BODY_INCLUDE;
46 }
47 catch (Exception e) {
48 throw new JspException(e);
49 }
50 }
51
52 public int doEndTag() throws JspException {
53 try {
54 PortalIncludeUtil.include(pageContext, getEndPage());
55
56 return EVAL_PAGE;
57 }
58 catch (Exception e) {
59 throw new JspException(e);
60 }
61 }
62
63 public String getStartPage() {
64 if (Validator.isNull(_startPage)) {
65 return _START_PAGE;
66 }
67 else {
68 return _startPage;
69 }
70 }
71
72 public void setStartPage(String startPage) {
73 _startPage = startPage;
74 }
75
76 public String getEndPage() {
77 if (Validator.isNull(_endPage)) {
78 return _END_PAGE;
79 }
80 else {
81 return _endPage;
82 }
83 }
84
85 public void setEndPage(String endPage) {
86 _endPage = endPage;
87 }
88
89 public void setId(String id) {
90 _id = id;
91 }
92
93 public void setDisplayTerms(DisplayTerms displayTerms) {
94 _displayTerms = displayTerms;
95 }
96
97 public void setButtonLabel(String buttonLabel) {
98 _buttonLabel = buttonLabel;
99 }
100
101 private static final String _START_PAGE =
102 "/html/taglib/ui/search_toggle/start.jsp";
103
104 private static final String _END_PAGE =
105 "/html/taglib/ui/search_toggle/end.jsp";
106
107 private String _startPage;
108 private String _endPage;
109 private String _id;
110 private DisplayTerms _displayTerms;
111 private String _buttonLabel;
112
113 }