1
19
20 package com.liferay.taglib.ui;
21
22 import com.liferay.portal.kernel.dao.search.DisplayTerms;
23 import com.liferay.portal.kernel.servlet.PortalIncludeUtil;
24 import com.liferay.portal.kernel.util.Validator;
25
26 import javax.servlet.http.HttpServletRequest;
27 import javax.servlet.jsp.JspException;
28 import javax.servlet.jsp.tagext.TagSupport;
29
30
36 public class SearchToggleTag extends TagSupport {
37
38 public int doStartTag() throws JspException {
39 try {
40 HttpServletRequest request =
41 (HttpServletRequest)pageContext.getRequest();
42
43 request.setAttribute("liferay-ui:search-toggle:id", _id);
44 request.setAttribute(
45 "liferay-ui:search-toggle:displayTerms", _displayTerms);
46
47 PortalIncludeUtil.include(pageContext, getStartPage());
48
49 return EVAL_BODY_INCLUDE;
50 }
51 catch (Exception e) {
52 throw new JspException(e);
53 }
54 }
55
56 public int doEndTag() throws JspException {
57 try {
58 PortalIncludeUtil.include(pageContext, getEndPage());
59
60 return EVAL_PAGE;
61 }
62 catch (Exception e) {
63 throw new JspException(e);
64 }
65 }
66
67 public String getStartPage() {
68 if (Validator.isNull(_startPage)) {
69 return _START_PAGE;
70 }
71 else {
72 return _startPage;
73 }
74 }
75
76 public void setStartPage(String startPage) {
77 _startPage = startPage;
78 }
79
80 public String getEndPage() {
81 if (Validator.isNull(_endPage)) {
82 return _END_PAGE;
83 }
84 else {
85 return _endPage;
86 }
87 }
88
89 public void setEndPage(String endPage) {
90 _endPage = endPage;
91 }
92
93 public void setId(String id) {
94 _id = id;
95 }
96
97 public void setDisplayTerms(DisplayTerms displayTerms) {
98 _displayTerms = displayTerms;
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
112 }