1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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 extends TagSupport {
31  
32      public int doStartTag() throws JspException {
33          SearchContainerRowTag parentRowTag =
34              (SearchContainerRowTag)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  }