001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.dao.search.ResultRow;
018 import com.liferay.portal.kernel.dao.search.SearchEntry;
019 import com.liferay.portal.kernel.servlet.PipingServletResponse;
020 import com.liferay.portal.kernel.util.ServerDetector;
021 import com.liferay.portal.kernel.util.StringPool;
022
023 import java.util.List;
024
025 import javax.servlet.jsp.JspException;
026 import javax.servlet.jsp.JspTagException;
027
028
031 public class SearchContainerColumnJSPTag extends SearchContainerColumnTag {
032
033 public int doEndTag() {
034 try {
035 SearchContainerRowTag parentTag =
036 (SearchContainerRowTag)findAncestorWithClass(
037 this, SearchContainerRowTag.class);
038
039 ResultRow row = parentTag.getRow();
040
041 if (index <= -1) {
042 index = row.getEntries().size();
043 }
044
045 row.addJSP(
046 index, getAlign(), getValign(), getColspan(), getPath(),
047 pageContext.getServletContext(), getServletRequest(),
048 new PipingServletResponse(pageContext));
049
050 return EVAL_PAGE;
051 }
052 finally {
053 if (!ServerDetector.isResin()) {
054 align = SearchEntry.DEFAULT_ALIGN;
055 colspan = SearchEntry.DEFAULT_COLSPAN;
056 index = -1;
057 name = StringPool.BLANK;
058 _path = null;
059 valign = SearchEntry.DEFAULT_VALIGN;
060 }
061 }
062 }
063
064 public int doStartTag() throws JspException {
065 SearchContainerRowTag parentRowTag =
066 (SearchContainerRowTag)findAncestorWithClass(
067 this, SearchContainerRowTag.class);
068
069 if (parentRowTag == null) {
070 throw new JspTagException(
071 "Requires liferay-ui:search-container-row");
072 }
073
074 if (!parentRowTag.isHeaderNamesAssigned()) {
075 List<String> headerNames = parentRowTag.getHeaderNames();
076
077 headerNames.add(name);
078 }
079
080 return EVAL_BODY_INCLUDE;
081 }
082
083 public String getPath() {
084 return _path;
085 }
086
087 public void setPath(String path) {
088 _path = path;
089 }
090
091 private String _path;
092
093 }