001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import java.util.Date;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class InputTimeTag extends IncludeTag {
027    
028            public void setAmPmParam(String amPmParam) {
029                    _amPmParam = amPmParam;
030            }
031    
032            public void setAmPmValue(int amPmValue) {
033                    _amPmValue = amPmValue;
034            }
035    
036            public void setCssClass(String cssClass) {
037                    _cssClass = cssClass;
038            }
039    
040            public void setDateParam(String dateParam) {
041                    _dateParam = dateParam;
042            }
043    
044            public void setDateValue(Date dateValue) {
045                    _dateValue = dateValue;
046            }
047    
048            public void setDisabled(boolean disabled) {
049                    _disabled = disabled;
050            }
051    
052            public void setHourParam(String hourParam) {
053                    _hourParam = hourParam;
054            }
055    
056            public void setHourValue(int hourValue) {
057                    _hourValue = hourValue;
058            }
059    
060            public void setMinuteInterval(int minuteInterval) {
061                    _minuteInterval = minuteInterval;
062            }
063    
064            public void setMinuteParam(String minuteParam) {
065                    _minuteParam = minuteParam;
066            }
067    
068            public void setMinuteValue(int minuteValue) {
069                    _minuteValue = minuteValue;
070            }
071    
072            public void setName(String name) {
073                    _name = name;
074            }
075    
076            public void setTimeFormat(String timeFormat) {
077                    _timeFormat = timeFormat;
078            }
079    
080            @Override
081            protected void cleanUp() {
082                    _amPmParam = null;
083                    _amPmValue = 0;
084                    _cssClass = null;
085                    _dateParam = null;
086                    _dateValue = null;
087                    _disabled = false;
088                    _hourParam = null;
089                    _hourValue = 0;
090                    _minuteInterval = 0;
091                    _minuteParam = null;
092                    _minuteValue = 0;
093                    _name = null;
094                    _timeFormat = null;
095            }
096    
097            @Override
098            protected String getPage() {
099                    return _PAGE;
100            }
101    
102            @Override
103            protected void setAttributes(HttpServletRequest request) {
104                    request.setAttribute("liferay-ui:input-time:amPmParam", _amPmParam);
105                    request.setAttribute(
106                            "liferay-ui:input-time:amPmValue", String.valueOf(_amPmValue));
107                    request.setAttribute("liferay-ui:input-time:cssClass", _cssClass);
108                    request.setAttribute("liferay-ui:input-time:dateParam", _dateParam);
109                    request.setAttribute("liferay-ui:input-time:dateValue", _dateValue);
110                    request.setAttribute(
111                            "liferay-ui:input-time:disabled", String.valueOf(_disabled));
112                    request.setAttribute("liferay-ui:input-time:hourParam", _hourParam);
113                    request.setAttribute(
114                            "liferay-ui:input-time:hourValue", String.valueOf(_hourValue));
115                    request.setAttribute(
116                            "liferay-ui:input-time:minuteInterval",
117                            String.valueOf(_minuteInterval));
118                    request.setAttribute("liferay-ui:input-time:minuteParam", _minuteParam);
119                    request.setAttribute(
120                            "liferay-ui:input-time:minuteValue", String.valueOf(_minuteValue));
121                    request.setAttribute("liferay-ui:input-time:name", _name);
122                    request.setAttribute(
123                            "liferay-ui:input-time:timeFormat", String.valueOf(_timeFormat));
124            }
125    
126            private static final String _PAGE = "/html/taglib/ui/input_time/page.jsp";
127    
128            private String _amPmParam;
129            private int _amPmValue;
130            private String _cssClass;
131            private String _dateParam;
132            private Date _dateValue;
133            private boolean _disabled;
134            private String _hourParam;
135            private int _hourValue;
136            private int _minuteInterval;
137            private String _minuteParam;
138            private int _minuteValue;
139            private String _name;
140            private String _timeFormat;
141    
142    }