KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > ui > common > tag > InputDatePickerTag


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.web.ui.common.tag;
18
19 import javax.faces.component.UIComponent;
20
21 /**
22  * @author kevinr
23  *
24  * Tag handler for an Input UI Component specific for Date input.
25  *
26  * This tag collects the user params needed to specify an Input component to allow
27  * the user to enter a date. It specifies the renderer as below to be our Date
28  * specific renderer. This renderer is configured in the faces-config.xml.
29  */

30 public class InputDatePickerTag extends HtmlComponentTag
31 {
32    /**
33     * @see javax.faces.webapp.UIComponentTag#getComponentType()
34     */

35    public String JavaDoc getComponentType()
36    {
37       // we are require an Input component to manage our state
38
// this is just a convention name Id - not an actual class
39
return "javax.faces.Input";
40    }
41    
42    /**
43     * @see javax.faces.webapp.UIComponentTag#getRendererType()
44     */

45    public String JavaDoc getRendererType()
46    {
47       // the renderer type is a convention name Id - not an actual class
48
// see the <render-kit> in faces-config.xml
49
return "org.alfresco.faces.DatePickerRenderer";
50    }
51    
52    /**
53     * @see javax.servlet.jsp.tagext.Tag#release()
54     */

55    public void release()
56    {
57       super.release();
58       this.startYear = null;
59       this.yearCount = null;
60       this.value = null;
61       this.showTime = null;
62       this.disabled = null;
63    }
64    
65    /**
66     * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
67     */

68    protected void setProperties(UIComponent component)
69    {
70       super.setProperties(component);
71       
72       // set the properties of tag into the component
73
setIntProperty(component, "startYear", this.startYear);
74       setIntProperty(component, "yearCount", this.yearCount);
75       setStringProperty(component, "value", this.value);
76       setBooleanProperty(component, "showTime", this.showTime);
77       setBooleanProperty(component, "disabled", this.disabled);
78    }
79    
80    /**
81     * Set the value
82     *
83     * @param value the value
84     */

85    public void setValue(String JavaDoc value)
86    {
87       this.value = value;
88    }
89
90    /**
91     * Set the startYear
92     *
93     * @param startYear the startYear
94     */

95    public void setStartYear(String JavaDoc startYear)
96    {
97       this.startYear = startYear;
98    }
99
100    /**
101     * Set the yearCount
102     *
103     * @param yearCount the yearCount
104     */

105    public void setYearCount(String JavaDoc yearCount)
106    {
107       this.yearCount = yearCount;
108    }
109    
110    /**
111     * Determines whether the time is rendered
112     *
113     * @param showTime true to allow the time to be edited
114     */

115    public void setShowTime(String JavaDoc showTime)
116    {
117       this.showTime = showTime;
118    }
119    
120    /**
121     * Sets whether the component should be rendered in a disabled state
122     *
123     * @param disabled true to render the component in a disabled state
124     */

125    public void setDisabled(String JavaDoc disabled)
126    {
127       this.disabled = disabled;
128    }
129    
130    private String JavaDoc startYear = null;
131    private String JavaDoc yearCount = null;
132    private String JavaDoc value = null;
133    private String JavaDoc showTime = null;
134    private String JavaDoc disabled = null;
135 }
136
Popular Tags