1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.taglib.ui;
21  
22  import com.liferay.taglib.util.IncludeTag;
23  
24  import java.text.Format;
25  
26  import javax.servlet.http.HttpServletRequest;
27  
28  /**
29   * <a href="InputFieldTag.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Brian Wing Shun Chan
32   *
33   */
34  public class InputFieldTag extends IncludeTag {
35  
36      public int doStartTag() {
37          HttpServletRequest request =
38              (HttpServletRequest)pageContext.getRequest();
39  
40          request.setAttribute("liferay-ui:input-field:formName", _formName);
41          request.setAttribute("liferay-ui:input-field:model", _model.getName());
42          request.setAttribute("liferay-ui:input-field:bean", _bean);
43          request.setAttribute("liferay-ui:input-field:field", _field);
44          request.setAttribute("liferay-ui:input-field:fieldParam", _fieldParam);
45          request.setAttribute(
46              "liferay-ui:input-field:defaultValue", _defaultValue);
47          request.setAttribute(
48              "liferay-ui:input-field:disabled", String.valueOf(_disabled));
49          request.setAttribute("liferay-ui:input-field:format", _format);
50  
51          return EVAL_BODY_BUFFERED;
52      }
53  
54      public void setFormName(String formName) {
55          _formName = formName;
56      }
57  
58      public void setModel(Class<?> model) {
59          _model = model;
60      }
61  
62      public void setBean(Object bean) {
63          _bean = bean;
64      }
65  
66      public void setField(String field) {
67          _field = field;
68      }
69  
70      public void setFieldParam(String fieldParam) {
71          _fieldParam = fieldParam;
72      }
73  
74      public void setDefaultValue(Object defaultValue) {
75          _defaultValue = defaultValue;
76      }
77  
78      public void setDisabled(boolean disabled) {
79          _disabled = disabled;
80      }
81  
82      public void setFormat(Format format) {
83          _format = format;
84      }
85  
86      protected String getDefaultPage() {
87          return _PAGE;
88      }
89  
90      private static final String _PAGE = "/html/taglib/ui/input_field/page.jsp";
91  
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 }