001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.taglib.ui;
022:
023: import com.liferay.portal.kernel.util.StringPool;
024: import com.liferay.taglib.util.IncludeTag;
025:
026: import java.util.Calendar;
027:
028: import javax.servlet.ServletRequest;
029: import javax.servlet.jsp.JspException;
030:
031: /**
032: * <a href="InputDateTag.java.html"><b><i>View Source</i></b></a>
033: *
034: * @author Brian Wing Shun Chan
035: *
036: */
037: public class InputDateTag extends IncludeTag {
038:
039: public int doStartTag() throws JspException {
040: ServletRequest req = pageContext.getRequest();
041:
042: req.setAttribute("liferay-ui:input-date:disableNamespace",
043: String.valueOf(_disableNamespace));
044: req.setAttribute("liferay-ui:input-date:formName", _formName);
045: req.setAttribute("liferay-ui:input-date:monthParam",
046: _monthParam);
047: req.setAttribute("liferay-ui:input-date:monthValue", String
048: .valueOf(_monthValue));
049: req.setAttribute("liferay-ui:input-date:monthNullable", String
050: .valueOf(_monthNullable));
051: req.setAttribute("liferay-ui:input-date:dayParam", _dayParam);
052: req.setAttribute("liferay-ui:input-date:dayValue", String
053: .valueOf(_dayValue));
054: req.setAttribute("liferay-ui:input-date:dayNullable", String
055: .valueOf(_dayNullable));
056: req.setAttribute("liferay-ui:input-date:yearParam", _yearParam);
057: req.setAttribute("liferay-ui:input-date:yearValue", String
058: .valueOf(_yearValue));
059: req.setAttribute("liferay-ui:input-date:yearNullable", String
060: .valueOf(_yearNullable));
061: req.setAttribute("liferay-ui:input-date:yearRangeStart", String
062: .valueOf(_yearRangeStart));
063: req.setAttribute("liferay-ui:input-date:yearRangeEnd", String
064: .valueOf(_yearRangeEnd));
065: req.setAttribute("liferay-ui:input-date:monthAndYearParam",
066: _monthAndYearParam);
067: req.setAttribute("liferay-ui:input-date:monthAndYearNullable",
068: String.valueOf(_monthAndYearNullable));
069: req.setAttribute("liferay-ui:input-date:firstDayOfWeek", String
070: .valueOf(_firstDayOfWeek));
071: req.setAttribute("liferay-ui:input-date:imageInputId",
072: _imageInputId);
073: req.setAttribute("liferay-ui:input-date:disabled", String
074: .valueOf(_disabled));
075:
076: return EVAL_BODY_BUFFERED;
077: }
078:
079: public void setDisableNamespace(boolean disableNamespace) {
080: _disableNamespace = disableNamespace;
081: }
082:
083: public void setFormName(String formName) {
084: _formName = formName;
085: }
086:
087: public void setMonthParam(String monthParam) {
088: _monthParam = monthParam;
089: }
090:
091: public void setMonthValue(int monthValue) {
092: _monthValue = monthValue;
093: }
094:
095: public void setMonthNullable(boolean monthNullable) {
096: _monthNullable = monthNullable;
097: }
098:
099: public void setDayParam(String dayParam) {
100: _dayParam = dayParam;
101: }
102:
103: public void setDayValue(int dayValue) {
104: _dayValue = dayValue;
105: }
106:
107: public void setDayNullable(boolean dayNullable) {
108: _dayNullable = dayNullable;
109: }
110:
111: public void setYearParam(String yearParam) {
112: _yearParam = yearParam;
113: }
114:
115: public void setYearValue(int yearValue) {
116: _yearValue = yearValue;
117: }
118:
119: public void setYearNullable(boolean yearNullable) {
120: _yearNullable = yearNullable;
121: }
122:
123: public void setYearRangeStart(int yearRangeStart) {
124: _yearRangeStart = yearRangeStart;
125: }
126:
127: public void setYearRangeEnd(int yearRangeEnd) {
128: _yearRangeEnd = yearRangeEnd;
129: }
130:
131: public void setMonthAndYearParam(String monthAndYearParam) {
132: _monthAndYearParam = monthAndYearParam;
133: }
134:
135: public void setMonthAndYearNullable(boolean monthAndYearNullable) {
136: _monthAndYearNullable = monthAndYearNullable;
137: }
138:
139: public void setFirstDayOfWeek(int firstDayOfWeek) {
140: _firstDayOfWeek = firstDayOfWeek;
141: }
142:
143: public void setImageInputId(String imageInputId) {
144: _imageInputId = imageInputId;
145: }
146:
147: public void setDisabled(boolean disabled) {
148: _disabled = disabled;
149: }
150:
151: protected String getDefaultPage() {
152: return _PAGE;
153: }
154:
155: private static final String _PAGE = "/html/taglib/ui/input_date/page.jsp";
156:
157: private boolean _disableNamespace;
158: private String _formName = "fm";
159: private String _monthParam;
160: private int _monthValue = -1;
161: private boolean _monthNullable;
162: private String _dayParam;
163: private int _dayValue;
164: private boolean _dayNullable;
165: private String _yearParam;
166: private int _yearValue;
167: private boolean _yearNullable;
168: private int _yearRangeStart;
169: private int _yearRangeEnd;
170: private String _monthAndYearParam = StringPool.BLANK;
171: private boolean _monthAndYearNullable;
172: private int _firstDayOfWeek = Calendar.SUNDAY - 1;
173: private String _imageInputId;
174: private boolean _disabled;
175:
176: }
|