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.portal.kernel.util.StringPool;
23  import com.liferay.taglib.util.IncludeTag;
24  
25  import java.util.Calendar;
26  
27  import javax.servlet.http.HttpServletRequest;
28  
29  /**
30   * <a href="InputDateTag.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   *
34   */
35  public class InputDateTag extends IncludeTag {
36  
37      public int doStartTag() {
38          HttpServletRequest request =
39              (HttpServletRequest)pageContext.getRequest();
40  
41          request.setAttribute(
42              "liferay-ui:input-date:disableNamespace",
43              String.valueOf(_disableNamespace));
44          request.setAttribute("liferay-ui:input-date:formName", _formName);
45          request.setAttribute("liferay-ui:input-date:monthParam", _monthParam);
46          request.setAttribute(
47              "liferay-ui:input-date:monthValue", String.valueOf(_monthValue));
48          request.setAttribute(
49              "liferay-ui:input-date:monthNullable",
50              String.valueOf(_monthNullable));
51          request.setAttribute("liferay-ui:input-date:dayParam", _dayParam);
52          request.setAttribute(
53              "liferay-ui:input-date:dayValue", String.valueOf(_dayValue));
54          request.setAttribute(
55              "liferay-ui:input-date:dayNullable", String.valueOf(_dayNullable));
56          request.setAttribute("liferay-ui:input-date:yearParam", _yearParam);
57          request.setAttribute(
58              "liferay-ui:input-date:yearValue", String.valueOf(_yearValue));
59          request.setAttribute(
60              "liferay-ui:input-date:yearNullable",
61              String.valueOf(_yearNullable));
62          request.setAttribute(
63              "liferay-ui:input-date:yearRangeStart",
64              String.valueOf(_yearRangeStart));
65          request.setAttribute(
66              "liferay-ui:input-date:yearRangeEnd",
67              String.valueOf(_yearRangeEnd));
68          request.setAttribute(
69              "liferay-ui:input-date:monthAndYearParam", _monthAndYearParam);
70          request.setAttribute(
71              "liferay-ui:input-date:monthAndYearNullable",
72              String.valueOf(_monthAndYearNullable));
73          request.setAttribute(
74              "liferay-ui:input-date:firstDayOfWeek",
75              String.valueOf(_firstDayOfWeek));
76          request.setAttribute(
77              "liferay-ui:input-date:imageInputId", _imageInputId);
78          request.setAttribute(
79              "liferay-ui:input-date:disabled", String.valueOf(_disabled));
80  
81          return EVAL_BODY_BUFFERED;
82      }
83  
84      public void setDisableNamespace(boolean disableNamespace) {
85          _disableNamespace = disableNamespace;
86      }
87  
88      public void setFormName(String formName) {
89          _formName = formName;
90      }
91  
92      public void setMonthParam(String monthParam) {
93          _monthParam = monthParam;
94      }
95  
96      public void setMonthValue(int monthValue) {
97          _monthValue = monthValue;
98      }
99  
100     public void setMonthNullable(boolean monthNullable) {
101         _monthNullable = monthNullable;
102     }
103 
104     public void setDayParam(String dayParam) {
105         _dayParam = dayParam;
106     }
107 
108     public void setDayValue(int dayValue) {
109         _dayValue = dayValue;
110     }
111 
112     public void setDayNullable(boolean dayNullable) {
113         _dayNullable = dayNullable;
114     }
115 
116     public void setYearParam(String yearParam) {
117         _yearParam = yearParam;
118     }
119 
120     public void setYearValue(int yearValue) {
121         _yearValue = yearValue;
122     }
123 
124     public void setYearNullable(boolean yearNullable) {
125         _yearNullable = yearNullable;
126     }
127 
128     public void setYearRangeStart(int yearRangeStart) {
129         _yearRangeStart = yearRangeStart;
130     }
131 
132     public void setYearRangeEnd(int yearRangeEnd) {
133         _yearRangeEnd = yearRangeEnd;
134     }
135 
136     public void setMonthAndYearParam(String monthAndYearParam) {
137         _monthAndYearParam = monthAndYearParam;
138     }
139 
140     public void setMonthAndYearNullable(boolean monthAndYearNullable) {
141         _monthAndYearNullable = monthAndYearNullable;
142     }
143 
144     public void setFirstDayOfWeek(int firstDayOfWeek) {
145         _firstDayOfWeek = firstDayOfWeek;
146     }
147 
148     public void setImageInputId(String imageInputId) {
149         _imageInputId = imageInputId;
150     }
151 
152     public void setDisabled(boolean disabled) {
153         _disabled = disabled;
154     }
155 
156     protected String getDefaultPage() {
157         return _PAGE;
158     }
159 
160     private static final String _PAGE = "/html/taglib/ui/input_date/page.jsp";
161 
162     private boolean _disableNamespace;
163     private String _formName = "fm";
164     private String _monthParam;
165     private int _monthValue = -1;
166     private boolean _monthNullable;
167     private String _dayParam;
168     private int _dayValue;
169     private boolean _dayNullable;
170     private String _yearParam;
171     private int _yearValue;
172     private boolean _yearNullable;
173     private int _yearRangeStart;
174     private int _yearRangeEnd;
175     private String _monthAndYearParam = StringPool.BLANK;
176     private boolean _monthAndYearNullable;
177     private int _firstDayOfWeek = Calendar.SUNDAY - 1;
178     private String _imageInputId;
179     private boolean _disabled;
180 
181 }