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.portal.kernel.util.TimeZoneUtil;
18  import com.liferay.taglib.util.IncludeTag;
19  
20  import java.util.TimeZone;
21  
22  import javax.servlet.http.HttpServletRequest;
23  
24  /**
25   * <a href="InputTimeZoneTag.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class InputTimeZoneTag extends IncludeTag {
30  
31      public int doStartTag() {
32          HttpServletRequest request =
33              (HttpServletRequest)pageContext.getRequest();
34  
35          request.setAttribute("liferay-ui:input-time-zone:cssClass", _cssClass);
36          request.setAttribute("liferay-ui:input-time-zone:name", _name);
37          request.setAttribute("liferay-ui:input-time-zone:value", _value);
38          request.setAttribute(
39              "liferay-ui:input-time-zone:nullable", String.valueOf(_nullable));
40          request.setAttribute(
41              "liferay-ui:input-time-zone:daylight", String.valueOf(_daylight));
42          request.setAttribute(
43              "liferay-ui:input-time-zone:displayStyle",
44              String.valueOf(_displayStyle));
45          request.setAttribute(
46              "liferay-ui:input-time-zone:disabled", String.valueOf(_disabled));
47  
48          return EVAL_BODY_BUFFERED;
49      }
50  
51      public void setCssClass(String cssClass) {
52          _cssClass = cssClass;
53      }
54  
55      public void setName(String name) {
56          _name = name;
57      }
58  
59      public void setValue(String value) {
60          _value = value;
61      }
62  
63      public void setNullable(boolean nullable) {
64          _nullable = nullable;
65      }
66  
67      public void setDaylight(boolean daylight) {
68          _daylight = daylight;
69      }
70  
71      public void setDisplayStyle(int displayStyle) {
72          _displayStyle = displayStyle;
73      }
74  
75      public void setDisabled(boolean disabled) {
76          _disabled = disabled;
77      }
78  
79      protected String getDefaultPage() {
80          return _PAGE;
81      }
82  
83      private static final String _PAGE =
84          "/html/taglib/ui/input_time_zone/page.jsp";
85  
86      private String _cssClass;
87      private String _name;
88      private String _value = TimeZoneUtil.getDefault().getID();
89      private boolean _nullable;
90      private boolean _daylight;
91      private int _displayStyle = TimeZone.LONG;
92      private boolean _disabled;
93  
94  }