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 javax.servlet.http.HttpServletRequest;
20  
21  /**
22   * <a href="CustomAttributeTag.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Brian Wing Shun Chan
25   */
26  public class CustomAttributeTag extends IncludeTag {
27  
28      public void setClassName(String className) {
29          _className = className;
30      }
31  
32      public void setClassPK(long classPK) {
33          _classPK = classPK;
34      }
35  
36      public void setEditable(boolean editable) {
37          _editable = editable;
38      }
39  
40      public void setLabel(boolean label) {
41          _label = label;
42      }
43  
44      public void setName(String name) {
45          _name = name;
46      }
47  
48      protected void cleanUp() {
49          _className = null;
50          _classPK = 0;
51          _editable = false;
52          _label = false;
53          _name = null;
54      }
55  
56      protected String getPage() {
57          return _PAGE;
58      }
59  
60      protected void setAttributes(HttpServletRequest request) {
61          request.setAttribute(
62              "liferay-ui:custom-attribute:className", _className);
63          request.setAttribute(
64              "liferay-ui:custom-attribute:classPK", String.valueOf(_classPK));
65          request.setAttribute(
66              "liferay-ui:custom-attribute:editable", String.valueOf(_editable));
67          request.setAttribute(
68              "liferay-ui:custom-attribute:label", String.valueOf(_label));
69          request.setAttribute("liferay-ui:custom-attribute:name", _name);
70      }
71  
72      private static final String _PAGE =
73          "/html/taglib/ui/custom_attribute/page.jsp";
74  
75      private String _className;
76      private long _classPK;
77      private boolean _editable;
78      private boolean _label;
79      private String _name;
80  
81  }