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.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 void setCssClass(String cssClass) {
32          _cssClass = cssClass;
33      }
34  
35      public void setDaylight(boolean daylight) {
36          _daylight = daylight;
37      }
38  
39      public void setDisabled(boolean disabled) {
40          _disabled = disabled;
41      }
42  
43      public void setDisplayStyle(int displayStyle) {
44          _displayStyle = displayStyle;
45      }
46  
47      public void setName(String name) {
48          _name = name;
49      }
50  
51      public void setNullable(boolean nullable) {
52          _nullable = nullable;
53      }
54  
55      public void setValue(String value) {
56          _value = value;
57      }
58  
59      protected void cleanUp() {
60          _cssClass = null;
61          _daylight = false;
62          _disabled = false;
63          _displayStyle = TimeZone.LONG;
64          _name = null;
65          _nullable = false;
66          _value = TimeZoneUtil.getDefault().getID();
67      }
68  
69      protected String getPage() {
70          return _PAGE;
71      }
72  
73      protected void setAttributes(HttpServletRequest request) {
74          request.setAttribute("liferay-ui:input-time-zone:cssClass", _cssClass);
75          request.setAttribute(
76              "liferay-ui:input-time-zone:daylight", String.valueOf(_daylight));
77          request.setAttribute(
78              "liferay-ui:input-time-zone:disabled", String.valueOf(_disabled));
79          request.setAttribute(
80              "liferay-ui:input-time-zone:displayStyle",
81              String.valueOf(_displayStyle));
82          request.setAttribute("liferay-ui:input-time-zone:name", _name);
83          request.setAttribute(
84              "liferay-ui:input-time-zone:nullable", String.valueOf(_nullable));
85          request.setAttribute("liferay-ui:input-time-zone:value", _value);
86      }
87  
88      private static final String _PAGE =
89          "/html/taglib/ui/input_time_zone/page.jsp";
90  
91      private String _cssClass;
92      private boolean _daylight;
93      private boolean _disabled;
94      private int _displayStyle = TimeZone.LONG;
95      private String _name;
96      private boolean _nullable;
97      private String _value = TimeZoneUtil.getDefault().getID();
98  
99  }