1
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.dao.search.ResultRow;
18 import com.liferay.portal.kernel.dao.search.SearchEntry;
19 import com.liferay.portal.kernel.util.ServerDetector;
20 import com.liferay.portal.kernel.util.StringPool;
21
22 import java.util.List;
23
24 import javax.servlet.jsp.JspException;
25 import javax.servlet.jsp.JspTagException;
26
27
32 public class SearchContainerColumnJSPTag<R> extends SearchContainerColumnTag {
33
34 public int doEndTag() {
35 try {
36 SearchContainerRowTag<R> parentTag =
37 (SearchContainerRowTag<R>)findAncestorWithClass(
38 this, SearchContainerRowTag.class);
39
40 ResultRow row = parentTag.getRow();
41
42 if (index <= -1) {
43 index = row.getEntries().size();
44 }
45
46 row.addJSP(
47 index, getAlign(), getValign(), getColspan(), getPath(),
48 pageContext.getServletContext(), getServletRequest(),
49 getServletResponse());
50
51 return EVAL_PAGE;
52 }
53 finally {
54 if (!ServerDetector.isResin()) {
55 align = SearchEntry.DEFAULT_ALIGN;
56 colspan = SearchEntry.DEFAULT_COLSPAN;
57 index = -1;
58 name = StringPool.BLANK;
59 _path = null;
60 valign = SearchEntry.DEFAULT_VALIGN;
61 }
62 }
63 }
64
65 public int doStartTag() throws JspException {
66 SearchContainerRowTag<R> parentRowTag =
67 (SearchContainerRowTag<R>)findAncestorWithClass(
68 this, SearchContainerRowTag.class);
69
70 if (parentRowTag == null) {
71 throw new JspTagException(
72 "Requires liferay-ui:search-container-row");
73 }
74
75 if (!parentRowTag.isHeaderNamesAssigned()) {
76 List<String> headerNames = parentRowTag.getHeaderNames();
77
78 headerNames.add(name);
79 }
80
81 return EVAL_BODY_INCLUDE;
82 }
83
84 public String getPath() {
85 return _path;
86 }
87
88 public void setPath(String path) {
89 _path = path;
90 }
91
92 private String _path;
93
94 }