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.taglib.util.IncludeTag;
18  
19  import java.text.Format;
20  
21  import javax.servlet.http.HttpServletRequest;
22  
23  /**
24   * <a href="InputFieldTag.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   */
28  public class InputFieldTag extends IncludeTag {
29  
30      public int doStartTag() {
31          HttpServletRequest request =
32              (HttpServletRequest)pageContext.getRequest();
33  
34          request.setAttribute("liferay-ui:input-field:cssClass", _cssClass);
35          request.setAttribute("liferay-ui:input-field:formName", _formName);
36          request.setAttribute("liferay-ui:input-field:model", _model.getName());
37          request.setAttribute("liferay-ui:input-field:bean", _bean);
38          request.setAttribute("liferay-ui:input-field:field", _field);
39          request.setAttribute("liferay-ui:input-field:fieldParam", _fieldParam);
40          request.setAttribute(
41              "liferay-ui:input-field:defaultValue", _defaultValue);
42          request.setAttribute(
43              "liferay-ui:input-field:disabled", String.valueOf(_disabled));
44          request.setAttribute("liferay-ui:input-field:format", _format);
45  
46          return EVAL_BODY_BUFFERED;
47      }
48  
49      public void setCssClass(String cssClass) {
50          _cssClass = cssClass;
51      }
52  
53      public void setFormName(String formName) {
54          _formName = formName;
55      }
56  
57      public void setModel(Class<?> model) {
58          _model = model;
59      }
60  
61      public void setBean(Object bean) {
62          _bean = bean;
63      }
64  
65      public void setField(String field) {
66          _field = field;
67      }
68  
69      public void setFieldParam(String fieldParam) {
70          _fieldParam = fieldParam;
71      }
72  
73      public void setDefaultValue(Object defaultValue) {
74          _defaultValue = defaultValue;
75      }
76  
77      public void setDisabled(boolean disabled) {
78          _disabled = disabled;
79      }
80  
81      public void setFormat(Format format) {
82          _format = format;
83      }
84  
85      protected String getDefaultPage() {
86          return _PAGE;
87      }
88  
89      private static final String _PAGE = "/html/taglib/ui/input_field/page.jsp";
90  
91      private String _cssClass;
92      private String _formName = "fm";
93      private Class<?> _model;
94      private Object _bean;
95      private String _field;
96      private String _fieldParam;
97      private Object _defaultValue;
98      private boolean _disabled;
99      private Format _format;
100 
101 }