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.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="InputLocalizedTag.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Julio Camarero
29   */
30  public class InputLocalizedTag extends IncludeTag implements DynamicAttributes {
31  
32      public int doStartTag() {
33          HttpServletRequest request =
34              (HttpServletRequest)pageContext.getRequest();
35  
36          request.setAttribute("liferay-ui:input-localized:cssClass", _cssClass);
37          request.setAttribute(
38              "liferay-ui:input-localized:disabled", String.valueOf(_disabled));
39          request.setAttribute(
40              "liferay-ui:input-localized:dynamicAttributes", _dynamicAttributes);
41          request.setAttribute("liferay-ui:input-localized:name", _name);
42          request.setAttribute("liferay-ui:input-localized:type", _type);
43          request.setAttribute("liferay-ui:input-localized:xml", _xml);
44  
45          return EVAL_BODY_BUFFERED;
46      }
47  
48      public void setCssClass(String cssClass) {
49          _cssClass = cssClass;
50      }
51  
52      public void setDisabled(boolean disabled) {
53          _disabled = disabled;
54      }
55  
56      public void setDynamicAttribute(
57          String uri, String localName, Object value) {
58  
59          _dynamicAttributes.put(localName, value);
60      }
61  
62      public void setName(String name) {
63          _name = name;
64      }
65  
66      public void setType(String type) {
67          _type = type;
68      }
69  
70      public void setXml(String xml) {
71          _xml = xml;
72      }
73  
74      protected String getDefaultPage() {
75          return _PAGE;
76      }
77  
78      private static final String _PAGE =
79          "/html/taglib/ui/input_localized/page.jsp";
80  
81      private String _cssClass;
82      private boolean _disabled;
83      private Map<String, Object> _dynamicAttributes =
84          new HashMap<String, Object>();
85      private String _name;
86      private String _type = "input";
87      private String _xml;
88  
89  }