001    /**
002     * Copyright (c) 2000-2013 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 javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class InputTimeTag extends IncludeTag {
025    
026            public void setAmPmParam(String amPmParam) {
027                    _amPmParam = amPmParam;
028            }
029    
030            public void setAmPmValue(int amPmValue) {
031                    _amPmValue = amPmValue;
032            }
033    
034            public void setCssClass(String cssClass) {
035                    _cssClass = cssClass;
036            }
037    
038            public void setDisabled(boolean disabled) {
039                    _disabled = disabled;
040            }
041    
042            public void setHourParam(String hourParam) {
043                    _hourParam = hourParam;
044            }
045    
046            public void setHourValue(int hourValue) {
047                    _hourValue = hourValue;
048            }
049    
050            public void setMinuteInterval(int minuteInterval) {
051                    _minuteInterval = minuteInterval;
052            }
053    
054            public void setMinuteParam(String minuteParam) {
055                    _minuteParam = minuteParam;
056            }
057    
058            public void setMinuteValue(int minuteValue) {
059                    _minuteValue = minuteValue;
060            }
061    
062            public void setName(String name) {
063                    _name = name;
064            }
065    
066            @Override
067            protected void cleanUp() {
068                    _amPmParam = null;
069                    _amPmValue = 0;
070                    _cssClass = null;
071                    _disabled = false;
072                    _hourParam = null;
073                    _hourValue = 0;
074                    _minuteInterval = 0;
075                    _minuteParam = null;
076                    _minuteValue = 0;
077                    _name = null;
078            }
079    
080            @Override
081            protected String getPage() {
082                    return _PAGE;
083            }
084    
085            @Override
086            protected void setAttributes(HttpServletRequest request) {
087                    request.setAttribute("liferay-ui:input-time:amPmParam", _amPmParam);
088                    request.setAttribute(
089                            "liferay-ui:input-time:amPmValue", String.valueOf(_amPmValue));
090                    request.setAttribute("liferay-ui:input-time:cssClass", _cssClass);
091                    request.setAttribute(
092                            "liferay-ui:input-time:disabled", String.valueOf(_disabled));
093                    request.setAttribute("liferay-ui:input-time:hourParam", _hourParam);
094                    request.setAttribute(
095                            "liferay-ui:input-time:hourValue", String.valueOf(_hourValue));
096                    request.setAttribute(
097                            "liferay-ui:input-time:minuteInterval",
098                            String.valueOf(_minuteInterval));
099                    request.setAttribute("liferay-ui:input-time:minuteParam", _minuteParam);
100                    request.setAttribute(
101                            "liferay-ui:input-time:minuteValue", String.valueOf(_minuteValue));
102                    request.setAttribute("liferay-ui:input-time:name", _name);
103            }
104    
105            private static final String _PAGE = "/html/taglib/ui/input_time/page.jsp";
106    
107            private String _amPmParam;
108            private int _amPmValue;
109            private String _cssClass;
110            private boolean _disabled;
111            private String _hourParam;
112            private int _hourValue;
113            private int _minuteInterval;
114            private String _minuteParam;
115            private int _minuteValue;
116            private String _name;
117    
118    }