KickJava   Java API By Example, From Geeks To Geeks.

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


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.UserRoleUtils;
19
20 import javax.faces.component.html.HtmlInputText;
21 import javax.faces.context.FacesContext;
22 import javax.faces.el.ValueBinding;
23
24 /**
25  * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
26  * @version $Revision: 1.7 $ $Date: 2005/01/17 10:08:44 $
27  */

28 public class HtmlInputCalendar
29         extends HtmlInputText
30 {
31     //private static final Log log = LogFactory.getLog(HtmlInputCalendar.class);
32

33     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
34

35     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlInputCalendar";
36     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Input";
37     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Calendar";
38
39     private String JavaDoc _monthYearRowClass = null;
40     private String JavaDoc _weekRowClass = null;
41     private String JavaDoc _dayCellClass = null;
42     private String JavaDoc _currentDayCellClass = null;
43     private Boolean JavaDoc _renderAsPopup = null;
44     private Boolean JavaDoc _addResources = null;
45     private String JavaDoc _popupButtonString = null;
46     private String JavaDoc _popupDateFormat = null;
47     private String JavaDoc _enabledOnUserRole = null;
48     private String JavaDoc _visibleOnUserRole = null;
49     private String JavaDoc _popupGotoString = null;
50     private String JavaDoc _popupTodayString = null;
51     private String JavaDoc _popupWeekString = null;
52     private String JavaDoc _popupScrollLeftMessage = null;
53     private String JavaDoc _popupScrollRightMessage = null;
54     private String JavaDoc _popupSelectMonthMessage = null;
55     private String JavaDoc _popupSelectYearMessage = null;
56     private String JavaDoc _popupSelectDateMessage = null;
57
58     public HtmlInputCalendar()
59     {
60         setRendererType(DEFAULT_RENDERER_TYPE);
61     }
62
63     public String JavaDoc getFamily()
64     {
65         return COMPONENT_FAMILY;
66     }
67
68     public void setMonthYearRowClass(String JavaDoc monthYearRowClass)
69     {
70         _monthYearRowClass = monthYearRowClass;
71     }
72
73     public String JavaDoc getMonthYearRowClass()
74     {
75         if (_monthYearRowClass != null) return _monthYearRowClass;
76         ValueBinding vb = getValueBinding("monthYearRowClass");
77         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
78     }
79
80     public void setWeekRowClass(String JavaDoc weekRowClass)
81     {
82         _weekRowClass = weekRowClass;
83     }
84
85     public String JavaDoc getWeekRowClass()
86     {
87         if (_weekRowClass != null) return _weekRowClass;
88         ValueBinding vb = getValueBinding("weekRowClass");
89         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
90     }
91
92     public void setDayCellClass(String JavaDoc dayCellClass)
93     {
94         _dayCellClass = dayCellClass;
95     }
96
97     public String JavaDoc getDayCellClass()
98     {
99         if (_dayCellClass != null) return _dayCellClass;
100         ValueBinding vb = getValueBinding("dayCellClass");
101         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
102     }
103
104     public void setCurrentDayCellClass(String JavaDoc currentDayCellClass)
105     {
106         _currentDayCellClass = currentDayCellClass;
107     }
108
109     public String JavaDoc getCurrentDayCellClass()
110     {
111         if (_currentDayCellClass != null) return _currentDayCellClass;
112         ValueBinding vb = getValueBinding("currentDayCellClass");
113         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
114     }
115
116     public void setRenderAsPopup(boolean renderAsPopup)
117     {
118         _renderAsPopup = Boolean.valueOf(renderAsPopup);
119     }
120
121     public boolean isRenderAsPopup()
122     {
123         if (_renderAsPopup != null) return _renderAsPopup.booleanValue();
124         ValueBinding vb = getValueBinding("renderAsPopup");
125         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
126         return v != null ? v.booleanValue() : false;
127     }
128
129     public void setAddResources(boolean addResources)
130     {
131         _addResources = Boolean.valueOf(addResources);
132     }
133
134     public boolean isAddResources()
135     {
136         if (_addResources != null) return _addResources.booleanValue();
137         ValueBinding vb = getValueBinding("addResources");
138         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
139         return v != null ? v.booleanValue() : false;
140     }
141
142     public void setPopupButtonString(String JavaDoc popupButtonString)
143     {
144         _popupButtonString = popupButtonString;
145     }
146
147     public String JavaDoc getPopupButtonString()
148     {
149         if (_popupButtonString != null) return _popupButtonString;
150         ValueBinding vb = getValueBinding("popupButtonString");
151         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
152     }
153
154     public void setPopupDateFormat(String JavaDoc popupDateFormat)
155     {
156         _popupDateFormat = popupDateFormat;
157     }
158
159     public String JavaDoc getPopupDateFormat()
160     {
161         if (_popupDateFormat != null) return _popupDateFormat;
162         ValueBinding vb = getValueBinding("popupDateFormat");
163         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
164     }
165
166     public void setEnabledOnUserRole(String JavaDoc enabledOnUserRole)
167     {
168         _enabledOnUserRole = enabledOnUserRole;
169     }
170
171     public String JavaDoc getEnabledOnUserRole()
172     {
173         if (_enabledOnUserRole != null) return _enabledOnUserRole;
174         ValueBinding vb = getValueBinding("enabledOnUserRole");
175         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
176     }
177
178     public void setVisibleOnUserRole(String JavaDoc visibleOnUserRole)
179     {
180         _visibleOnUserRole = visibleOnUserRole;
181     }
182
183     public String JavaDoc getVisibleOnUserRole()
184     {
185         if (_visibleOnUserRole != null) return _visibleOnUserRole;
186         ValueBinding vb = getValueBinding("visibleOnUserRole");
187         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
188     }
189
190     public void setPopupGotoString(String JavaDoc popupGotoString)
191     {
192         _popupGotoString = popupGotoString;
193     }
194
195     public String JavaDoc getPopupGotoString()
196     {
197         if (_popupGotoString != null) return _popupGotoString;
198         ValueBinding vb = getValueBinding("popupGotoString");
199         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
200     }
201
202     public void setPopupTodayString(String JavaDoc popupTodayString)
203     {
204         _popupTodayString = popupTodayString;
205     }
206
207     public String JavaDoc getPopupTodayString()
208     {
209         if (_popupTodayString != null) return _popupTodayString;
210         ValueBinding vb = getValueBinding("popupTodayString");
211         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
212     }
213
214     public void setPopupWeekString(String JavaDoc popupWeekString)
215     {
216         _popupWeekString = popupWeekString;
217     }
218
219     public String JavaDoc getPopupWeekString()
220     {
221         if (_popupWeekString != null) return _popupWeekString;
222         ValueBinding vb = getValueBinding("popupWeekString");
223         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
224     }
225
226     public void setPopupScrollLeftMessage(String JavaDoc popupScrollLeftMessage)
227     {
228         _popupScrollLeftMessage = popupScrollLeftMessage;
229     }
230
231     public String JavaDoc getPopupScrollLeftMessage()
232     {
233         if (_popupScrollLeftMessage != null) return _popupScrollLeftMessage;
234         ValueBinding vb = getValueBinding("popupScrollLeftMessage");
235         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
236     }
237
238     public void setPopupScrollRightMessage(String JavaDoc popupScrollRightMessage)
239     {
240         _popupScrollRightMessage = popupScrollRightMessage;
241     }
242
243     public String JavaDoc getPopupScrollRightMessage()
244     {
245         if (_popupScrollRightMessage != null) return _popupScrollRightMessage;
246         ValueBinding vb = getValueBinding("popupScrollRightMessage");
247         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
248     }
249
250     public void setPopupSelectMonthMessage(String JavaDoc popupSelectMonthMessage)
251     {
252         _popupSelectMonthMessage = popupSelectMonthMessage;
253     }
254
255     public String JavaDoc getPopupSelectMonthMessage()
256     {
257         if (_popupSelectMonthMessage != null) return _popupSelectMonthMessage;
258         ValueBinding vb = getValueBinding("popupSelectMonthMessage");
259         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
260     }
261
262     public void setPopupSelectYearMessage(String JavaDoc popupSelectYearMessage)
263     {
264         _popupSelectYearMessage = popupSelectYearMessage;
265     }
266
267     public String JavaDoc getPopupSelectYearMessage()
268     {
269         if (_popupSelectYearMessage != null) return _popupSelectYearMessage;
270         ValueBinding vb = getValueBinding("popupSelectYearMessage");
271         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
272     }
273
274     public void setPopupSelectDateMessage(String JavaDoc popupSelectDateMessage)
275     {
276         _popupSelectDateMessage = popupSelectDateMessage;
277     }
278
279     public String JavaDoc getPopupSelectDateMessage()
280     {
281         if (_popupSelectDateMessage != null) return _popupSelectDateMessage;
282         ValueBinding vb = getValueBinding("popupSelectDateMessage");
283         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
284     }
285
286
287     public boolean isRendered()
288     {
289         if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
290         return super.isRendered();
291     }
292
293     public Object JavaDoc saveState(FacesContext context)
294     {
295         Object JavaDoc values[] = new Object JavaDoc[19];
296         values[0] = super.saveState(context);
297         values[1] = _monthYearRowClass;
298         values[2] = _weekRowClass;
299         values[3] = _dayCellClass;
300         values[4] = _currentDayCellClass;
301         values[5] = _renderAsPopup;
302         values[6] = _addResources;
303         values[7] = _popupButtonString;
304         values[8] = _popupDateFormat;
305         values[9] = _enabledOnUserRole;
306         values[10] = _visibleOnUserRole;
307         values[11] = _popupGotoString;
308         values[12] = _popupTodayString;
309         values[13] = _popupWeekString;
310         values[14] = _popupScrollLeftMessage;
311         values[15] = _popupScrollRightMessage;
312         values[16] = _popupSelectMonthMessage;
313         values[17] = _popupSelectYearMessage;
314         values[18] = _popupSelectDateMessage;
315         return ((Object JavaDoc) (values));
316     }
317
318     public void restoreState(FacesContext context, Object JavaDoc state)
319     {
320         Object JavaDoc values[] = (Object JavaDoc[])state;
321         super.restoreState(context, values[0]);
322         _monthYearRowClass = (String JavaDoc)values[1];
323         _weekRowClass = (String JavaDoc)values[2];
324         _dayCellClass = (String JavaDoc)values[3];
325         _currentDayCellClass = (String JavaDoc)values[4];
326         _renderAsPopup = (Boolean JavaDoc)values[5];
327         _addResources = (Boolean JavaDoc)values[6];
328         _popupButtonString = (String JavaDoc)values[7];
329         _popupDateFormat = (String JavaDoc)values[8];
330         _enabledOnUserRole = (String JavaDoc)values[9];
331         _visibleOnUserRole = (String JavaDoc)values[10];
332         _popupGotoString = (String JavaDoc)values[11];
333         _popupTodayString = (String JavaDoc)values[12];
334         _popupWeekString = (String JavaDoc)values[13];
335         _popupScrollLeftMessage = (String JavaDoc)values[14];
336         _popupScrollRightMessage = (String JavaDoc)values[15];
337         _popupSelectMonthMessage = (String JavaDoc)values[16];
338         _popupSelectYearMessage = (String JavaDoc)values[17];
339         _popupSelectDateMessage = (String JavaDoc)values[18];
340     }
341     //------------------ GENERATED CODE END ---------------------------------------
342
}
343
Popular Tags