1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.taglib.ui;
16  
17  import com.liferay.portal.kernel.dao.search.ResultRow;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  
20  import javax.servlet.jsp.JspException;
21  import javax.servlet.jsp.JspTagException;
22  import javax.servlet.jsp.tagext.TagSupport;
23  
24  /**
25   * <a href="SearchContainerRowParameterTag.java.html"><b><i>View Source</i></b>
26   * </a>
27   *
28   * @author Brian Wing Shun Chan
29   */
30  public class SearchContainerRowParameterTag<R> extends TagSupport {
31  
32      public int doStartTag() throws JspException {
33          SearchContainerRowTag<R> parentRowTag =
34              (SearchContainerRowTag<R>)findAncestorWithClass(
35                  this, SearchContainerRowTag.class);
36  
37          if (parentRowTag == null) {
38              throw new JspTagException(
39                  "Requires liferay-ui:search-container-row");
40          }
41  
42          ResultRow row = parentRowTag.getRow();
43  
44          if (_name.equals("className")) {
45              row.setClassName(_name);
46          }
47          else if (_name.equals("classHoverName")) {
48              row.setClassHoverName((String)_value);
49          }
50          else if (_name.equals("restricted")) {
51              row.setRestricted(GetterUtil.getBoolean((String)_value, false));
52          }
53          else {
54              row.setParameter(_name, _value);
55          }
56  
57          return EVAL_BODY_INCLUDE;
58      }
59  
60      public void setName(String name) {
61          _name = name;
62      }
63  
64      public void setValue(Object value) {
65          _value = value;
66      }
67  
68      private String _name;
69      private Object _value;
70  
71  }