KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > calendar > HtmlInputCalendarTag


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.custom.calendar;
17
18 import org.apache.myfaces.component.UserRoleAware;
19 import org.apache.myfaces.taglib.html.HtmlInputTagBase;
20
21 import javax.faces.component.UIComponent;
22
23 /**
24  * @author Martin Marinschek (latest modification by $Author: matzew $)
25  * @version $Revision: 1.11 $ $Date: 2005/02/18 17:19:30 $
26  * $Log: HtmlInputCalendarTag.java,v $
27  * Revision 1.11 2005/02/18 17:19:30 matzew
28  * added release() to tag clazzes.
29  *
30  * Revision 1.10 2005/01/17 10:08:44 mmarinschek
31  * trying to fix problem with added resources to header; css and js was not changeable by the user anymore...
32  *
33  * Revision 1.9 2004/10/13 11:50:57 matze
34  * renamed packages to org.apache
35  *
36  * Revision 1.8 2004/07/28 18:00:47 tinytoony
37  * calendar; revisited again for complete i18
38  *
39  * Revision 1.7 2004/07/27 16:48:02 tinytoony
40  * new calendar popup, revisited
41  *
42  * Revision 1.6 2004/07/27 06:28:32 tinytoony
43  * new calendar component as a popup
44  *
45  * Revision 1.5 2004/07/01 21:53:11 mwessendorf
46  * ASF switch
47  *
48  * Revision 1.4 2004/05/18 14:31:36 manolito
49  * user role support completely moved to components source tree
50  *
51  * Revision 1.3 2004/04/05 11:04:51 manolito
52  * setter for renderer type removed, no more default renderer type needed
53  *
54  * Revision 1.2 2004/04/01 12:57:39 manolito
55  * additional extended component classes for user role support
56  *
57  * Revision 1.1 2004/03/31 12:15:25 manolito
58  * custom component refactoring
59  *
60  */

61 public class HtmlInputCalendarTag
62         extends HtmlInputTagBase
63 {
64     //private static final Log log = LogFactory.getLog(HtmlInputCalendarTag.class);
65

66     public String JavaDoc getComponentType()
67     {
68         return HtmlInputCalendar.COMPONENT_TYPE;
69     }
70
71     public String JavaDoc getRendererType()
72     {
73         return "org.apache.myfaces.Calendar";
74     }
75
76     // UIComponent attributes --> already implemented in UIComponentTagBase
77

78     // HTML universal attributes --> already implemented in HtmlComponentTagBase
79

80     // HTML event handler attributes --> already implemented in MyFacesTag
81

82     // UIOutput attributes
83
// value and converterId --> already implemented in UIComponentTagBase
84

85     // UIInput attributes
86
// --> already implemented in HtmlInputTagBase
87

88     // HtmlCalendar attributes
89
private String JavaDoc _monthYearRowClass;
90     private String JavaDoc _weekRowClass;
91     private String JavaDoc _dayCellClass;
92     private String JavaDoc _currentDayCellClass;
93     private String JavaDoc _renderAsPopup;
94     private String JavaDoc _addResources;
95     private String JavaDoc _popupDateFormat;
96     private String JavaDoc _popupButtonString;
97     private String JavaDoc _popupGotoString = null;
98     private String JavaDoc _popupTodayString = null;
99     private String JavaDoc _popupWeekString = null;
100     private String JavaDoc _popupScrollLeftMessage = null;
101     private String JavaDoc _popupScrollRightMessage = null;
102     private String JavaDoc _popupSelectMonthMessage = null;
103     private String JavaDoc _popupSelectYearMessage = null;
104     private String JavaDoc _popupSelectDateMessage = null;
105
106     // User Role support
107
private String JavaDoc _enabledOnUserRole;
108     private String JavaDoc _visibleOnUserRole;
109     
110     public void release() {
111         super.release();
112
113         _monthYearRowClass = null;
114         _weekRowClass = null;
115         _dayCellClass = null;
116         _currentDayCellClass = null;
117         _renderAsPopup = null;
118         _addResources = null;
119         _popupDateFormat = null;
120         _popupButtonString = null;
121         _popupGotoString = null;
122         _popupTodayString = null;
123         _popupWeekString = null;
124         _popupScrollLeftMessage = null;
125         _popupScrollRightMessage = null;
126         _popupSelectMonthMessage = null;
127         _popupSelectYearMessage = null;
128         _popupSelectDateMessage = null;
129         _enabledOnUserRole = null;
130         _visibleOnUserRole = null;
131
132     }
133
134
135     protected void setProperties(UIComponent component)
136     {
137         super.setProperties(component);
138
139         setStringProperty(component, "monthYearRowClass", _monthYearRowClass);
140         setStringProperty(component, "weekRowClass", _weekRowClass);
141         setStringProperty(component, "dayCellClass", _dayCellClass);
142         setStringProperty(component, "currentDayCellClass", _currentDayCellClass);
143         setBooleanProperty(component,"renderAsPopup",_renderAsPopup);
144         setBooleanProperty(component,"addResources",(_addResources==null?Boolean.TRUE.toString():_addResources));
145         setStringProperty(component,"popupDateFormat",_popupDateFormat);
146         setStringProperty(component,"popupButtonString",_popupButtonString);
147         setStringProperty(component,"popupGotoString",_popupGotoString);
148         setStringProperty(component,"popupTodayString",_popupTodayString);
149         setStringProperty(component,"popupWeekString",_popupWeekString);
150         setStringProperty(component,"popupScrollLeftMessage",_popupScrollLeftMessage);
151         setStringProperty(component,"popupScrollRightMessage",_popupScrollRightMessage);
152         setStringProperty(component,"popupSelectMonthMessage",_popupSelectMonthMessage);
153         setStringProperty(component,"popupSelectYearMessage",_popupSelectYearMessage);
154         setStringProperty(component,"popupSelectDateMessage",_popupSelectDateMessage);
155
156
157         setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
158         setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
159     }
160
161     public void setMonthYearRowClass(String JavaDoc monthYearRowClass)
162     {
163         _monthYearRowClass = monthYearRowClass;
164     }
165
166     public void setWeekRowClass(String JavaDoc weekRowClass)
167     {
168         _weekRowClass = weekRowClass;
169     }
170
171     public void setDayCellClass(String JavaDoc dayCellClass)
172     {
173         _dayCellClass = dayCellClass;
174     }
175
176     public void setCurrentDayCellClass(String JavaDoc currentDayCellClass)
177     {
178         _currentDayCellClass = currentDayCellClass;
179     }
180
181     public void setRenderAsPopup(String JavaDoc renderAsPopup)
182     {
183         _renderAsPopup = renderAsPopup;
184     }
185
186     public void setAddResources(String JavaDoc addResources)
187     {
188         _addResources = addResources;
189     }
190
191     public void setPopupDateFormat(String JavaDoc popupDateFormat)
192     {
193         _popupDateFormat = popupDateFormat;
194     }
195
196     public void setPopupButtonString(String JavaDoc popupButtonString)
197     {
198         _popupButtonString = popupButtonString;
199     }
200
201     public void setEnabledOnUserRole(String JavaDoc enabledOnUserRole)
202     {
203         _enabledOnUserRole = enabledOnUserRole;
204     }
205
206     public void setVisibleOnUserRole(String JavaDoc visibleOnUserRole)
207     {
208         _visibleOnUserRole = visibleOnUserRole;
209     }
210
211     public void setPopupGotoString(String JavaDoc popupGotoString)
212     {
213         _popupGotoString = popupGotoString;
214     }
215
216     public void setPopupScrollLeftMessage(String JavaDoc popupScrollLeftMessage)
217     {
218         _popupScrollLeftMessage = popupScrollLeftMessage;
219     }
220
221     public void setPopupScrollRightMessage(String JavaDoc popupScrollRightMessage)
222     {
223         _popupScrollRightMessage = popupScrollRightMessage;
224     }
225
226     public void setPopupSelectDateMessage(String JavaDoc popupSelectDateMessage)
227     {
228         _popupSelectDateMessage = popupSelectDateMessage;
229     }
230
231     public void setPopupSelectMonthMessage(String JavaDoc popupSelectMonthMessage)
232     {
233         _popupSelectMonthMessage = popupSelectMonthMessage;
234     }
235
236     public void setPopupSelectYearMessage(String JavaDoc popupSelectYearMessage)
237     {
238         _popupSelectYearMessage = popupSelectYearMessage;
239     }
240
241     public void setPopupTodayString(String JavaDoc popupTodayString)
242     {
243         _popupTodayString = popupTodayString;
244     }
245
246     public void setPopupWeekString(String JavaDoc popupWeekString)
247     {
248         _popupWeekString = popupWeekString;
249     }
250 }
251
Popular Tags