1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.taglib.ui;
24  
25  import com.liferay.portal.kernel.util.StringPool;
26  import com.liferay.taglib.util.IncludeTag;
27  
28  import java.util.Calendar;
29  
30  import javax.servlet.http.HttpServletRequest;
31  
32  /**
33   * <a href="InputDateTag.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   */
37  public class InputDateTag extends IncludeTag {
38  
39      public int doStartTag() {
40          HttpServletRequest request =
41              (HttpServletRequest)pageContext.getRequest();
42  
43          request.setAttribute(
44              "liferay-ui:input-date:disableNamespace",
45              String.valueOf(_disableNamespace));
46          request.setAttribute("liferay-ui:input-date:formName", _formName);
47          request.setAttribute("liferay-ui:input-date:monthParam", _monthParam);
48          request.setAttribute(
49              "liferay-ui:input-date:monthValue", String.valueOf(_monthValue));
50          request.setAttribute(
51              "liferay-ui:input-date:monthNullable",
52              String.valueOf(_monthNullable));
53          request.setAttribute("liferay-ui:input-date:dayParam", _dayParam);
54          request.setAttribute(
55              "liferay-ui:input-date:dayValue", String.valueOf(_dayValue));
56          request.setAttribute(
57              "liferay-ui:input-date:dayNullable", String.valueOf(_dayNullable));
58          request.setAttribute("liferay-ui:input-date:yearParam", _yearParam);
59          request.setAttribute(
60              "liferay-ui:input-date:yearValue", String.valueOf(_yearValue));
61          request.setAttribute(
62              "liferay-ui:input-date:yearNullable",
63              String.valueOf(_yearNullable));
64          request.setAttribute(
65              "liferay-ui:input-date:yearRangeStart",
66              String.valueOf(_yearRangeStart));
67          request.setAttribute(
68              "liferay-ui:input-date:yearRangeEnd",
69              String.valueOf(_yearRangeEnd));
70          request.setAttribute(
71              "liferay-ui:input-date:monthAndYearParam", _monthAndYearParam);
72          request.setAttribute(
73              "liferay-ui:input-date:monthAndYearNullable",
74              String.valueOf(_monthAndYearNullable));
75          request.setAttribute(
76              "liferay-ui:input-date:firstDayOfWeek",
77              String.valueOf(_firstDayOfWeek));
78          request.setAttribute(
79              "liferay-ui:input-date:imageInputId", _imageInputId);
80          request.setAttribute(
81              "liferay-ui:input-date:disabled", String.valueOf(_disabled));
82  
83          return EVAL_BODY_BUFFERED;
84      }
85  
86      public void setDisableNamespace(boolean disableNamespace) {
87          _disableNamespace = disableNamespace;
88      }
89  
90      public void setFormName(String formName) {
91          _formName = formName;
92      }
93  
94      public void setMonthParam(String monthParam) {
95          _monthParam = monthParam;
96      }
97  
98      public void setMonthValue(int monthValue) {
99          _monthValue = monthValue;
100     }
101 
102     public void setMonthNullable(boolean monthNullable) {
103         _monthNullable = monthNullable;
104     }
105 
106     public void setDayParam(String dayParam) {
107         _dayParam = dayParam;
108     }
109 
110     public void setDayValue(int dayValue) {
111         _dayValue = dayValue;
112     }
113 
114     public void setDayNullable(boolean dayNullable) {
115         _dayNullable = dayNullable;
116     }
117 
118     public void setYearParam(String yearParam) {
119         _yearParam = yearParam;
120     }
121 
122     public void setYearValue(int yearValue) {
123         _yearValue = yearValue;
124     }
125 
126     public void setYearNullable(boolean yearNullable) {
127         _yearNullable = yearNullable;
128     }
129 
130     public void setYearRangeStart(int yearRangeStart) {
131         _yearRangeStart = yearRangeStart;
132     }
133 
134     public void setYearRangeEnd(int yearRangeEnd) {
135         _yearRangeEnd = yearRangeEnd;
136     }
137 
138     public void setMonthAndYearParam(String monthAndYearParam) {
139         _monthAndYearParam = monthAndYearParam;
140     }
141 
142     public void setMonthAndYearNullable(boolean monthAndYearNullable) {
143         _monthAndYearNullable = monthAndYearNullable;
144     }
145 
146     public void setFirstDayOfWeek(int firstDayOfWeek) {
147         _firstDayOfWeek = firstDayOfWeek;
148     }
149 
150     public void setImageInputId(String imageInputId) {
151         _imageInputId = imageInputId;
152     }
153 
154     public void setDisabled(boolean disabled) {
155         _disabled = disabled;
156     }
157 
158     protected String getDefaultPage() {
159         return _PAGE;
160     }
161 
162     private static final String _PAGE = "/html/taglib/ui/input_date/page.jsp";
163 
164     private boolean _disableNamespace;
165     private String _formName = "fm";
166     private String _monthParam;
167     private int _monthValue = -1;
168     private boolean _monthNullable;
169     private String _dayParam;
170     private int _dayValue;
171     private boolean _dayNullable;
172     private String _yearParam;
173     private int _yearValue;
174     private boolean _yearNullable;
175     private int _yearRangeStart;
176     private int _yearRangeEnd;
177     private String _monthAndYearParam = StringPool.BLANK;
178     private boolean _monthAndYearNullable;
179     private int _firstDayOfWeek = Calendar.SUNDAY - 1;
180     private String _imageInputId;
181     private boolean _disabled;
182 
183 }