001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.servlet.PortalIncludeUtil;
018 import com.liferay.portal.kernel.util.Validator;
019
020 import javax.servlet.http.HttpServletRequest;
021 import javax.servlet.jsp.JspException;
022 import javax.servlet.jsp.tagext.TagSupport;
023
024
027 public class AppViewToolbarTag extends TagSupport {
028
029 @Override
030 public int doEndTag() throws JspException {
031 try {
032 HttpServletRequest request =
033 (HttpServletRequest)pageContext.getRequest();
034
035 request.setAttribute(
036 "liferay-ui:app_view_toolbar:includeDisplayStyle",
037 _includeDisplayStyle);
038
039 PortalIncludeUtil.include(pageContext, getEndPage());
040
041 return EVAL_PAGE;
042 }
043 catch (Exception e) {
044 throw new JspException(e);
045 }
046 }
047
048 @Override
049 public int doStartTag() throws JspException {
050 try {
051 HttpServletRequest request =
052 (HttpServletRequest)pageContext.getRequest();
053
054 request.setAttribute(
055 "liferay-ui:app_view_toolbar:includeSelectAll",
056 _includeSelectAll);
057 request.setAttribute(
058 "liferay-ui:app_view_toolbar:searchJsp", _searchJsp);
059
060 PortalIncludeUtil.include(pageContext, getStartPage());
061
062 return EVAL_BODY_INCLUDE;
063 }
064 catch (Exception e) {
065 throw new JspException(e);
066 }
067 }
068
069 public void setEndPage(String endPage) {
070 _endPage = endPage;
071 }
072
073 public void setIncludeDisplayStyle(boolean includeDisplayStyle) {
074 _includeDisplayStyle = includeDisplayStyle;
075 }
076
077 public void setIncludeSelectAll(boolean includeSelectAll) {
078 _includeSelectAll = includeSelectAll;
079 }
080
081 public void setSearchJsp(String searchJsp) {
082 _searchJsp = searchJsp;
083 }
084
085 public void setStartPage(String startPage) {
086 _startPage = startPage;
087 }
088
089 protected String getEndPage() {
090 if (Validator.isNull(_endPage)) {
091 return _END_PAGE;
092 }
093 else {
094 return _endPage;
095 }
096 }
097
098 protected String getStartPage() {
099 if (Validator.isNull(_startPage)) {
100 return _START_PAGE;
101 }
102 else {
103 return _startPage;
104 }
105 }
106
107 private static final String _END_PAGE =
108 "/html/taglib/ui/app_view_toolbar/end.jsp";
109
110 private static final String _START_PAGE =
111 "/html/taglib/ui/app_view_toolbar/start.jsp";
112
113 private String _endPage;
114 private boolean _includeDisplayStyle = false;
115 private boolean _includeSelectAll = false;
116 private String _searchJsp;
117 private String _startPage;
118
119 }