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.aui;
16  
17  import com.liferay.taglib.util.IncludeTag;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import javax.servlet.http.HttpServletRequest;
23  import javax.servlet.jsp.tagext.DynamicAttributes;
24  
25  /**
26   * <a href="LegendTag.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Julio Camarero
29   * @author Jorge Ferrer
30   * @author Brian Wing Shun Chan
31   */
32  public class LegendTag extends IncludeTag implements DynamicAttributes {
33  
34      public int doStartTag() {
35          HttpServletRequest request =
36              (HttpServletRequest)pageContext.getRequest();
37  
38          request.setAttribute("aui:legend:cssClass", _cssClass);
39          request.setAttribute(
40              "aui:legend:dynamicAttributes", _dynamicAttributes);
41          request.setAttribute("aui:legend:label", _label);
42  
43          return EVAL_BODY_BUFFERED;
44      }
45  
46      public void setCssClass(String cssClass) {
47          _cssClass = cssClass;
48      }
49  
50      public void setDynamicAttribute(
51          String uri, String localName, Object value) {
52  
53          _dynamicAttributes.put(localName, value);
54      }
55  
56      public void setLabel(String label) {
57          _label = label;
58      }
59  
60      protected String getDefaultPage() {
61          return _PAGE;
62      }
63  
64      private static final String _PAGE = "/html/taglib/aui/legend/page.jsp";
65  
66      private String _cssClass;
67      private Map<String, Object> _dynamicAttributes =
68          new HashMap<String, Object>();
69      private String _label;
70  
71  }