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