Commit 9d55c675564cb2c11af32386873e3a630dc0684d
1 parent
e7d2f6ec
Rearranged class members using IntelliJ Idea plugin called Rearanger.
Showing
27 changed files
with
804 additions
and
675 deletions
... | ... | @@ -28,20 +28,21 @@ package org.richfaces.component; |
28 | 28 | * @author Bernard Labno |
29 | 29 | */ |
30 | 30 | public interface ScheduleCommonViewAttributes { |
31 | - | |
32 | - public String getTimeFormat(); | |
33 | - | |
34 | - public void setTimeFormat(String format); | |
31 | +// -------------------------- OTHER METHODS -------------------------- | |
35 | 32 | |
36 | 33 | public String getColumnFormat(); |
37 | 34 | |
38 | - public void setColumnFormat(String format); | |
35 | + public Double getDragOpacity(); | |
39 | 36 | |
40 | - public String getTitleFormat(); | |
37 | + public String getTimeFormat(); | |
41 | 38 | |
42 | - public void setTitleFormat(String format); | |
39 | + public String getTitleFormat(); | |
43 | 40 | |
44 | - public Double getDragOpacity(); | |
41 | + public void setColumnFormat(String format); | |
45 | 42 | |
46 | 43 | public void setDragOpacity(Double dragOpacity); |
44 | + | |
45 | + public void setTimeFormat(String format); | |
46 | + | |
47 | + public void setTitleFormat(String format); | |
47 | 48 | } | ... | ... |
... | ... | @@ -39,331 +39,313 @@ import java.util.Locale; |
39 | 39 | import java.util.Map; |
40 | 40 | |
41 | 41 | public abstract class UISchedule extends UIComponentBase implements ScheduleCommonViewAttributes, ScheduleListenerEventsProducer, AjaxComponent { |
42 | - | |
43 | - public static final String COMPONENT_TYPE = "org.richfaces.Schedule"; | |
42 | +// ------------------------------ FIELDS ------------------------------ | |
44 | 43 | |
45 | 44 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
46 | 45 | |
47 | - /** | |
48 | - * Values of view attribute. | |
49 | - */ | |
50 | - public static final String VIEW_MONTH = "month"; | |
46 | + public static final String COMPONENT_TYPE = "org.richfaces.Schedule"; | |
51 | 47 | |
52 | - public static final String VIEW_BASIC_WEEK = "basicWeek"; | |
48 | + public static final boolean DEFAULT_ALL_DAY_DEFAULT = true; | |
53 | 49 | |
54 | - public static final String VIEW_AGENDA_WEEK = "agendaWeek"; | |
50 | + public static final boolean DEFAULT_ALL_DAY_SLOT = true; | |
55 | 51 | |
56 | - public static final String VIEW_BASIC_DAY = "basicDay"; | |
52 | + public static final double DEFAULT_ASPECT_RATIO = 1.35; | |
57 | 53 | |
58 | - public static final String VIEW_AGENDA_DAY = "agendaDay"; | |
54 | + public static final String DEFAULT_AXIS_FORMAT = "h(:mm)tt"; | |
59 | 55 | |
60 | - public static final String DEFAULT_VIEW = VIEW_MONTH; | |
56 | + public static final boolean DEFAULT_DISABLE_DRAGGING = false; | |
61 | 57 | |
62 | - /** | |
63 | - * Values of switchType attribute | |
64 | - */ | |
65 | - public static final String SWITCH_TYPE_AJAX = "ajax"; | |
58 | + public static final boolean DEFAULT_DISABLE_RESIZING = false; | |
66 | 59 | |
67 | - public static final String SWITCH_TYPE_SERVER = "server"; | |
60 | + public static final double DEFAULT_DRAG_OPACITY = .3; | |
68 | 61 | |
69 | - public static final String SWITCH_TYPE_CLIENT = "client"; | |
62 | + public static final int DEFAULT_DRAG_REVERT_DURATION = 500; | |
70 | 63 | |
71 | - public static final String DEFAULT_SWITCH_TYPE = SWITCH_TYPE_AJAX; | |
64 | + public static final boolean DEFAULT_EDITABLE = false; | |
72 | 65 | |
73 | - /** | |
74 | - * Values of weekMode attribute. | |
75 | - */ | |
76 | - public static final String WEEK_MODE_FIXED = "fixed"; | |
66 | + public static final int DEFAULT_EVENT_MINUTES = 120; | |
77 | 67 | |
78 | - public static final String WEEK_MODE_LIQUID = "liquid"; | |
68 | + public static final int DEFAULT_FIRST_DAY = Calendar.SUNDAY; | |
79 | 69 | |
80 | - public static final String WEEK_MODE_VARIABLE = "variable"; | |
70 | + public static final int DEFAULT_FIRST_HOUR = 6; | |
81 | 71 | |
82 | - public static final String DEFAULT_WEEK_MODE = WEEK_MODE_FIXED; | |
72 | + public static final String DEFAULT_MAX_TIME = "24"; | |
83 | 73 | |
84 | - public static final boolean DEFAULT_SHOW_WEEKENDS = true; | |
74 | + public static final String DEFAULT_MIN_TIME = "0"; | |
85 | 75 | |
86 | 76 | public static final boolean DEFAULT_RTL = false; |
87 | 77 | |
88 | - public static final int DEFAULT_FIRST_DAY = Calendar.SUNDAY; | |
89 | - | |
90 | - public static final double DEFAULT_ASPECT_RATIO = 1.35; | |
78 | + public static final boolean DEFAULT_SELECTABLE = false; | |
91 | 79 | |
92 | - public static final boolean DEFAULT_ALL_DAY_SLOT = true; | |
80 | + public static final boolean DEFAULT_SELECT_HELPER = false; | |
93 | 81 | |
94 | - public static final String DEFAULT_AXIS_FORMAT = "h(:mm)tt"; | |
82 | + public static final boolean DEFAULT_SHOW_WEEKENDS = true; | |
95 | 83 | |
96 | 84 | public static final int DEFAULT_SLOT_MINUTES = 30; |
97 | 85 | |
98 | - public static final int DEFAULT_EVENT_MINUTES = 120; | |
99 | - | |
100 | - public static final int DEFAULT_FIRST_HOUR = 6; | |
101 | - | |
102 | - public static final String DEFAULT_MIN_TIME = "0"; | |
103 | - | |
104 | - public static final String DEFAULT_MAX_TIME = "24"; | |
105 | - | |
106 | - public static final boolean DEFAULT_EDITABLE = false; | |
107 | - | |
108 | - public static final boolean DEFAULT_SELECTABLE = false; | |
109 | - | |
110 | - public static final boolean DEFAULT_SELECT_HELPER = false; | |
86 | + public static final String DEFAULT_SWITCH_TYPE = SWITCH_TYPE_AJAX; | |
111 | 87 | |
112 | 88 | public static final boolean DEFAULT_UNSELECT_AUTO = true; |
113 | 89 | |
114 | 90 | public static final String DEFAULT_UNSELECT_CANCEL = ""; |
115 | 91 | |
116 | - public static final boolean DEFAULT_DISABLE_DRAGGING = false; | |
92 | + public static final String DEFAULT_VIEW = VIEW_MONTH; | |
117 | 93 | |
118 | - public static final boolean DEFAULT_DISABLE_RESIZING = false; | |
94 | + public static final String DEFAULT_WEEK_MODE = WEEK_MODE_FIXED; | |
119 | 95 | |
120 | - public static final int DEFAULT_DRAG_REVERT_DURATION = 500; | |
96 | + /** | |
97 | + * Values of switchType attribute | |
98 | + */ | |
99 | + public static final String SWITCH_TYPE_AJAX = "ajax"; | |
121 | 100 | |
122 | - public static final double DEFAULT_DRAG_OPACITY = .3; | |
101 | + public static final String SWITCH_TYPE_CLIENT = "client"; | |
123 | 102 | |
124 | - public static final boolean DEFAULT_ALL_DAY_DEFAULT = true; | |
103 | + public static final String SWITCH_TYPE_SERVER = "server"; | |
125 | 104 | |
126 | - private DataModel model; | |
105 | + public static final String VIEW_AGENDA_DAY = "agendaDay"; | |
127 | 106 | |
128 | - public abstract Object getValue(); | |
107 | + public static final String VIEW_AGENDA_WEEK = "agendaWeek"; | |
129 | 108 | |
130 | - public abstract void setValue(Object value); | |
109 | + public static final String VIEW_BASIC_DAY = "basicDay"; | |
131 | 110 | |
132 | - public abstract String getVar(); | |
111 | + public static final String VIEW_BASIC_WEEK = "basicWeek"; | |
133 | 112 | |
134 | - public abstract void setVar(String value); | |
113 | + /** | |
114 | + * Values of view attribute. | |
115 | + */ | |
116 | + public static final String VIEW_MONTH = "month"; | |
135 | 117 | |
136 | - public abstract Date getDate(); | |
118 | + /** | |
119 | + * Values of weekMode attribute. | |
120 | + */ | |
121 | + public static final String WEEK_MODE_FIXED = "fixed"; | |
137 | 122 | |
138 | - public abstract void setDate(Date date); | |
123 | + public static final String WEEK_MODE_LIQUID = "liquid"; | |
139 | 124 | |
140 | - public abstract String getSwitchType(); | |
125 | + public static final String WEEK_MODE_VARIABLE = "variable"; | |
141 | 126 | |
142 | - public abstract void setSwitchType(String switchType); | |
127 | + private DataModel model; | |
143 | 128 | |
144 | - public abstract String getView(); | |
129 | +// -------------------------- STATIC METHODS -------------------------- | |
145 | 130 | |
146 | - public abstract void setView(String defaultView); | |
131 | + public static int getFirstDay(UISchedule schedule) { | |
132 | + Integer firstDay = schedule.getFirstDay(); | |
133 | + return firstDay == null ? UISchedule.DEFAULT_FIRST_DAY : firstDay; | |
134 | + } | |
147 | 135 | |
148 | - public abstract String getHeaderLeft(); | |
136 | + public static Date getFirstDisplayedDay(UISchedule schedule) { | |
137 | + Calendar calendar = Calendar.getInstance(); | |
138 | + Date date = schedule.getDate(); | |
139 | + if (date != null) { | |
140 | + calendar.setTime(date); | |
141 | + } | |
142 | + int firstDayOfWeek = getFirstDay(schedule); | |
143 | + calendar.setFirstDayOfWeek(firstDayOfWeek); | |
144 | + String view = getView(schedule); | |
145 | + boolean showWeekends = isShowWeekends(schedule); | |
146 | + if (VIEW_MONTH.equals(view)) { | |
147 | + calendar.set(Calendar.DATE, 1); | |
148 | + if (!showWeekends) { | |
149 | + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
150 | + if (dayOfWeek == Calendar.SUNDAY) { | |
151 | + calendar.add(Calendar.DATE, 1); | |
152 | + } else if (dayOfWeek == Calendar.SATURDAY) { | |
153 | + calendar.add(Calendar.DATE, 2); | |
154 | + } | |
155 | + } | |
156 | + if (!showWeekends && firstDayOfWeek == Calendar.SUNDAY) { | |
157 | + firstDayOfWeek++; | |
158 | + } | |
159 | + /** | |
160 | + * Following 1 line is a fix to what i believe is a bug of java.util.Calendar | |
161 | + */ | |
162 | + calendar.get(Calendar.DAY_OF_WEEK); | |
163 | + calendar.set(Calendar.DAY_OF_WEEK, firstDayOfWeek); | |
164 | + return calendar.getTime(); | |
165 | + } else if (VIEW_AGENDA_WEEK.equals(view) || VIEW_BASIC_WEEK.equals(view)) { | |
166 | + calendar.set(Calendar.DAY_OF_WEEK, firstDayOfWeek); | |
167 | + if (!showWeekends) { | |
168 | + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
169 | + if (dayOfWeek == Calendar.SUNDAY) { | |
170 | + calendar.add(Calendar.DATE, 1); | |
171 | + } else if (dayOfWeek == Calendar.SATURDAY) { | |
172 | + calendar.add(Calendar.DATE, 2); | |
173 | + } | |
174 | + } | |
175 | + return calendar.getTime(); | |
176 | + } else if (VIEW_AGENDA_DAY.equals(view) || VIEW_BASIC_DAY.equals(view)) { | |
177 | + return calendar.getTime(); | |
178 | + } else { | |
179 | + throw new IllegalStateException("Invalid view attribute: " + view); | |
180 | + } | |
181 | + } | |
149 | 182 | |
150 | - public abstract void setHeaderLeft(String headerLeft); | |
183 | + public static Date getLastDisplayedDate(UISchedule schedule) { | |
184 | + Calendar calendar = Calendar.getInstance(); | |
185 | + int firstDayOfWeek = getFirstDay(schedule); | |
186 | + String view = getView(schedule); | |
187 | + boolean showWeekends = isShowWeekends(schedule); | |
188 | + if (VIEW_MONTH.equals(view)) { | |
189 | + if (WEEK_MODE_FIXED.equals(getWeekMode(schedule))) { | |
190 | + calendar.setTime(getFirstDisplayedDay(schedule)); | |
191 | + calendar.add(Calendar.DAY_OF_YEAR, 42); | |
192 | + } else { | |
193 | + Date date = schedule.getDate(); | |
194 | + if (date != null) { | |
195 | + calendar.setTime(date); | |
196 | + } | |
151 | 197 | |
152 | - public abstract String getHeaderCenter(); | |
198 | + if (!showWeekends && firstDayOfWeek == Calendar.SUNDAY) { | |
199 | + firstDayOfWeek++; | |
200 | + } | |
201 | + calendar.setFirstDayOfWeek(firstDayOfWeek); | |
202 | + calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE)); | |
203 | + int dayOfWeek = firstDayOfWeek + 6; | |
204 | + if (dayOfWeek > Calendar.SATURDAY) { | |
205 | + dayOfWeek -= 7; | |
206 | + } | |
207 | + /** | |
208 | + * Following 1 line is a fix to what i believe is a bug of java.util.Calendar | |
209 | + */ | |
210 | + calendar.get(Calendar.DAY_OF_WEEK); | |
211 | + calendar.set(Calendar.DAY_OF_WEEK, dayOfWeek); | |
212 | + calendar.add(Calendar.DATE, 1); | |
213 | + } | |
214 | + return calendar.getTime(); | |
215 | + } else if (VIEW_AGENDA_WEEK.equals(view) || VIEW_BASIC_WEEK.equals(view)) { | |
216 | + calendar.setFirstDayOfWeek(firstDayOfWeek); | |
217 | + calendar.setTime(getFirstDisplayedDay(schedule)); | |
218 | + calendar.add(Calendar.DATE, 7); | |
219 | + if (!showWeekends) { | |
220 | + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
221 | + if (dayOfWeek - 1 == Calendar.SUNDAY) { | |
222 | + calendar.add(Calendar.DATE, -2); | |
223 | + } else if (dayOfWeek - 1 == Calendar.SATURDAY) { | |
224 | + calendar.add(Calendar.DATE, -1); | |
225 | + } | |
226 | + } | |
227 | + return calendar.getTime(); | |
228 | + } else if (VIEW_AGENDA_DAY.equals(view) || VIEW_BASIC_DAY.equals(view)) { | |
229 | + calendar.setTime(getFirstDisplayedDay(schedule)); | |
230 | + calendar.add(Calendar.DATE, 1); | |
231 | + return calendar.getTime(); | |
232 | + } else { | |
233 | + throw new IllegalStateException("Invalid view attribute: " + view); | |
234 | + } | |
235 | + } | |
153 | 236 | |
154 | - public abstract void setHeaderCenter(String headerCenter); | |
237 | + public static String getView(UISchedule schedule) { | |
238 | + String view = schedule.getView(); | |
239 | + return view == null ? UISchedule.DEFAULT_VIEW : view; | |
240 | + } | |
155 | 241 | |
156 | - public abstract String getHeaderRight(); | |
242 | + public static String getWeekMode(UISchedule schedule) { | |
243 | + String weekMode = schedule.getWeekMode(); | |
244 | + return weekMode == null ? UISchedule.DEFAULT_WEEK_MODE : weekMode; | |
245 | + } | |
157 | 246 | |
158 | - public abstract void setHeaderRight(String headerRight); | |
247 | + /** | |
248 | + * Here go static methods for getting value or default value of attributes. | |
249 | + */ | |
250 | + /** | |
251 | + * @param schedule | |
252 | + * @return | |
253 | + */ | |
254 | + public static boolean isShowWeekends(UISchedule schedule) { | |
255 | + Boolean showWeekends = schedule.getShowWeekends(); | |
256 | + return showWeekends == null ? UISchedule.DEFAULT_SHOW_WEEKENDS : schedule.getShowWeekends(); | |
257 | + } | |
159 | 258 | |
160 | - public abstract Integer getFirstDay(); | |
259 | +// ------------------------ INTERFACE METHODS ------------------------ | |
161 | 260 | |
162 | - public abstract void setFirstDay(Integer firstDay); | |
163 | 261 | |
164 | - public abstract Boolean getIsRTL(); | |
262 | +// --------------------- Interface ScheduleListenerEventsProducer --------------------- | |
165 | 263 | |
166 | - public abstract void setIsRTL(Boolean isrtl); | |
264 | + public void addItemSelectListener(ScheduleItemSelectListener listener) { | |
265 | + addFacesListener(listener); | |
266 | + } | |
167 | 267 | |
168 | - public abstract Boolean getShowWeekends(); | |
268 | + public void removeItemSelectListener(ScheduleItemSelectListener listener) { | |
269 | + removeFacesListener(listener); | |
270 | + } | |
169 | 271 | |
170 | - public abstract void setShowWeekends(Boolean showWeekends); | |
272 | + public ScheduleItemSelectListener[] getItemSelectListeners() { | |
273 | + return (ScheduleItemSelectListener[]) getFacesListeners(ScheduleItemSelectListener.class); | |
274 | + } | |
171 | 275 | |
172 | - public abstract String getWeekMode(); | |
276 | + public void addItemMoveListener(ScheduleItemMoveListener listener) { | |
277 | + addFacesListener(listener); | |
278 | + } | |
173 | 279 | |
174 | - public abstract void setWeekMode(String weekMode); | |
280 | + public void removeItemMoveListener(ScheduleItemMoveListener listener) { | |
281 | + removeFacesListener(listener); | |
282 | + } | |
175 | 283 | |
176 | - public abstract Integer getHeight(); | |
284 | + public ScheduleItemMoveListener[] getItemMoveListeners() { | |
285 | + return (ScheduleItemMoveListener[]) getFacesListeners(ScheduleItemMoveListener.class); | |
286 | + } | |
177 | 287 | |
178 | - public abstract void setHeight(Integer height); | |
179 | - | |
180 | - public abstract Integer getContentHeight(); | |
181 | - | |
182 | - public abstract void setContentHeight(Integer contentHeight); | |
183 | - | |
184 | - public abstract Double getAspectRatio(); | |
185 | - | |
186 | - public abstract void setAspectRatio(Double aspectRatio); | |
187 | - | |
188 | - public abstract Boolean getAllDayByDefault(); | |
189 | - | |
190 | - public abstract void setAllDayByDefault(Boolean allDayByDefault); | |
191 | - | |
192 | - public abstract Boolean getAllDaySlot(); | |
193 | - | |
194 | - public abstract void setAllDaySlot(Boolean allDaySlot); | |
195 | - | |
196 | - public abstract String getAllDayText(); | |
197 | - | |
198 | - public abstract void setAllDayText(String allDayText); | |
199 | - | |
200 | - public abstract String getAxisFormat(); | |
201 | - | |
202 | - public abstract void setAxisFormat(String axisFormat); | |
203 | - | |
204 | - public abstract Integer getSlotMinutes(); | |
205 | - | |
206 | - public abstract void setSlotMinutes(Integer slotMinutes); | |
207 | - | |
208 | - public abstract Integer getDefaultEventMinutes(); | |
209 | - | |
210 | - public abstract void setDefaultEventMinutes(Integer defaultEventMinutes); | |
211 | - | |
212 | - public abstract Integer getFirstHour(); | |
213 | - | |
214 | - public abstract void setFirstHour(Integer firstHour); | |
215 | - | |
216 | - public abstract String getMinTime(); | |
217 | - | |
218 | - public abstract void setMinTime(String minTime); | |
219 | - | |
220 | - public abstract String getMaxTime(); | |
221 | - | |
222 | - public abstract void setMaxTime(String maxTime); | |
223 | - | |
224 | - public abstract Boolean getEditable(); | |
225 | - | |
226 | - public abstract void setEditable(Boolean editable); | |
227 | - | |
228 | - public abstract Boolean getSelectable(); | |
229 | - | |
230 | - public abstract void setSelectable(Boolean selectable); | |
231 | - | |
232 | - public abstract Boolean getSelectHelper(); | |
233 | - | |
234 | - public abstract void setSelectHelper(Boolean selectHelper); | |
235 | - | |
236 | - public abstract Boolean getUnselectAuto(); | |
237 | - | |
238 | - public abstract void setUnselectAuto(Boolean unselectAuto); | |
239 | - | |
240 | - public abstract String getUnselectCancel(); | |
241 | - | |
242 | - public abstract void setUnselectCancel(String unselectCancel); | |
243 | - | |
244 | - public abstract Boolean getDisableDragging(); | |
245 | - | |
246 | - public abstract void setDisableDragging(Boolean disableDragging); | |
247 | - | |
248 | - public abstract Boolean getDisableResizing(); | |
249 | - | |
250 | - public abstract void setDisableResizing(Boolean disableResizing); | |
251 | - | |
252 | - public abstract Integer getDragRevertDuration(); | |
253 | - | |
254 | - public abstract void setDragRevertDuration(Integer dragRevertDuration); | |
255 | - | |
256 | - public abstract String getStyleClass(); | |
257 | - | |
258 | - public abstract void setStyleClass(String styleClass); | |
259 | - | |
260 | - public abstract String getOnbeforeitemselect(); | |
261 | - | |
262 | - public abstract void setOnbeforeitemselect(String onbeforeitemselect); | |
263 | - | |
264 | - public abstract String getOnitemselect(); | |
265 | - | |
266 | - public abstract void setOnitemselect(String onitemselect); | |
267 | - | |
268 | - public abstract String getOnitemdragstart(); | |
269 | - | |
270 | - public abstract void setOnitemdragstart(String onitemdragstop); | |
271 | - | |
272 | - public abstract String getOnitemdragstop(); | |
273 | - | |
274 | - public abstract void setOnitemdragstop(String onitemdragstop); | |
275 | - | |
276 | - public abstract String getOnbeforeitemdrop(); | |
277 | - | |
278 | - public abstract void setOnbeforeitemdrop(String onbeforeitemdrop); | |
279 | - | |
280 | - public abstract String getOnitemdrop(); | |
281 | - | |
282 | - public abstract void setOnitemdrop(String onitemdrop); | |
283 | - | |
284 | - public abstract String getOnitemresizestart(); | |
285 | - | |
286 | - public abstract void setOnitemresizestart(String onitemresizestart); | |
287 | - | |
288 | - public abstract String getOnitemresizestop(); | |
289 | - | |
290 | - public abstract void setOnitemresizestop(String onitemresizestop); | |
291 | - | |
292 | - public abstract String getOnbeforeitemresize(); | |
293 | - | |
294 | - public abstract void setOnbeforeitemresize(String onbeforeitemresize); | |
295 | - | |
296 | - public abstract String getOnitemresize(); | |
297 | - | |
298 | - public abstract void setOnitemresize(String onitemresize); | |
299 | - | |
300 | - public abstract String getOnitemmouseover(); | |
301 | - | |
302 | - public abstract void setOnitemmouseover(String onitemmouseover); | |
303 | - | |
304 | - public abstract String getOnitemmouseout(); | |
305 | - | |
306 | - public abstract void setOnitemmouseout(String onitemmouseout); | |
307 | - | |
308 | - public abstract String getOnviewchange(); | |
309 | - | |
310 | - public abstract void setOnviewchange(String onviewchange); | |
311 | - | |
312 | - public abstract String getOnbeforedateselect(); | |
313 | - | |
314 | - public abstract void setOnbeforedateselect(String onbeforedateselect); | |
315 | - | |
316 | - public abstract String getOndateselect(); | |
317 | - | |
318 | - public abstract void setOndateselect(String ondateselect); | |
319 | - | |
320 | - public abstract String getOnbeforedaterangeselect(); | |
321 | - | |
322 | - public abstract void setOnbeforedaterangeselect(String onbeforedaterangeselect); | |
323 | - | |
324 | - public abstract String getOndaterangeselect(); | |
325 | - | |
326 | - public abstract void setOndaterangeselect(String ondaterangeselect); | |
327 | - | |
328 | - public abstract String getOndaterangechange(); | |
329 | - | |
330 | - public abstract void setOndaterangechange(String ondaterangechange); | |
331 | - | |
332 | - public abstract String getOnviewdisplay(); | |
333 | - | |
334 | - public abstract void setOnviewdisplay(String onviewdisplay); | |
335 | - | |
336 | - public abstract MethodBinding getItemMoveListener(); | |
288 | + public void addItemResizeListener(ScheduleItemResizeListener listener) { | |
289 | + addFacesListener(listener); | |
290 | + } | |
337 | 291 | |
338 | - public abstract void setItemMoveListener(MethodBinding listener); | |
292 | + public void removeItemResizeListener(ScheduleItemResizeListener listener) { | |
293 | + removeFacesListener(listener); | |
294 | + } | |
339 | 295 | |
340 | - public abstract MethodBinding getItemSelectListener(); | |
296 | + public ScheduleItemResizeListener[] getItemResizeListeners() { | |
297 | + return (ScheduleItemResizeListener[]) getFacesListeners(ScheduleItemResizeListener.class); | |
298 | + } | |
341 | 299 | |
342 | - public abstract void setItemSelectListener(MethodBinding listener); | |
300 | + public void addViewChangeListener(ScheduleViewChangeListener listener) { | |
301 | + addFacesListener(listener); | |
302 | + } | |
343 | 303 | |
344 | - public abstract MethodBinding getItemResizeListener(); | |
304 | + public void removeViewChangeListener(ScheduleViewChangeListener listener) { | |
305 | + removeFacesListener(listener); | |
306 | + } | |
345 | 307 | |
346 | - public abstract void setItemResizeListener(MethodBinding listener); | |
308 | + public ScheduleViewChangeListener[] getViewChangeListeners() { | |
309 | + return (ScheduleViewChangeListener[]) getFacesListeners(ScheduleViewChangeListener.class); | |
310 | + } | |
347 | 311 | |
348 | - public abstract MethodBinding getViewChangeListener(); | |
312 | + public void addDateRangeChangeListener(ScheduleDateRangeChangeListener listener) { | |
313 | + addFacesListener(listener); | |
314 | + } | |
349 | 315 | |
350 | - public abstract void setViewChangeListener(MethodBinding listener); | |
316 | + public void removeDateRangeChangeListener(ScheduleDateRangeChangeListener listener) { | |
317 | + removeFacesListener(listener); | |
318 | + } | |
351 | 319 | |
352 | - public abstract MethodBinding getDateRangeChangeListener(); | |
320 | + public ScheduleDateRangeChangeListener[] getDateRangeChangeListeners() { | |
321 | + return (ScheduleDateRangeChangeListener[]) getFacesListeners(ScheduleDateRangeChangeListener.class); | |
322 | + } | |
353 | 323 | |
354 | - public abstract void setDateRangeChangeListener(MethodBinding listener); | |
324 | + public void addDateRangeSelectListener(ScheduleDateRangeSelectListener listener) { | |
325 | + addFacesListener(listener); | |
326 | + } | |
355 | 327 | |
356 | - public abstract MethodBinding getDateRangeSelectListener(); | |
328 | + public void removeDateRangeSelectListener(ScheduleDateRangeSelectListener listener) { | |
329 | + removeFacesListener(listener); | |
330 | + } | |
357 | 331 | |
358 | - public abstract void setDateRangeSelectListener(MethodBinding listener); | |
332 | + public ScheduleDateRangeSelectListener[] getDateRangeSelectListeners() { | |
333 | + return (ScheduleDateRangeSelectListener[]) getFacesListeners(ScheduleDateRangeSelectListener.class); | |
334 | + } | |
359 | 335 | |
360 | - public abstract MethodBinding getDateSelectListener(); | |
336 | + public void addDateSelectListener(ScheduleDateSelectListener listener) { | |
337 | + addFacesListener(listener); | |
338 | + } | |
361 | 339 | |
362 | - public abstract void setDateSelectListener(MethodBinding listener); | |
340 | + public void removeDateSelectListener(ScheduleDateSelectListener listener) { | |
341 | + removeFacesListener(listener); | |
342 | + } | |
363 | 343 | |
364 | - public abstract String getWidgetVar(); | |
344 | + public ScheduleDateSelectListener[] getDateSelectListeners() { | |
345 | + return (ScheduleDateSelectListener[]) getFacesListeners(ScheduleDateSelectListener.class); | |
346 | + } | |
365 | 347 | |
366 | - public abstract void setWidgetVar(String widgetVar); | |
348 | +// -------------------------- OTHER METHODS -------------------------- | |
367 | 349 | |
368 | 350 | /** |
369 | 351 | * React on various events. |
... | ... | @@ -487,43 +469,135 @@ public abstract class UISchedule extends UIComponentBase implements ScheduleComm |
487 | 469 | } |
488 | 470 | } |
489 | 471 | |
490 | - /** | |
491 | - * Range is [startDate;endDate), which means that start date is inclusive | |
492 | - * and end date is exclusive. | |
493 | - * | |
494 | - * @param startDate | |
495 | - * @param endDate | |
496 | - * @return | |
497 | - * @throws IOException | |
498 | - */ | |
499 | - public List<Map<String, Object>> getScheduleData(Date startDate, Date endDate) throws IOException { | |
500 | - /** | |
501 | - * Locale must be US because this is the format the javascript widget supports | |
502 | - */ | |
503 | - DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); | |
504 | - format.setLenient(false); | |
505 | - DataModel dataModel = getDataModel(); | |
506 | - if (dataModel instanceof ExtendedDataModel) { | |
507 | - DataVisitor visitor = new DataVisitor() { | |
508 | - //TODO Is this fine? or should we stack rowKeys and not use dataModel later on. I'don't know business rules of extendedDataModel, just used it once to do pagination with underlying EntityQuery from Seam | |
472 | + public abstract Boolean getAllDayByDefault(); | |
509 | 473 | |
510 | - public void process(FacesContext context, Object rowKey, Object argument) throws IOException { | |
511 | - } | |
512 | - }; | |
513 | - ((ExtendedDataModel) dataModel).walk(getFacesContext(), visitor, new DateRange(startDate, endDate), null); | |
514 | - } | |
515 | - ELContext elContext = getFacesContext().getELContext(); | |
516 | - ValueExpression valueExpression = getFacesContext().getApplication().getExpressionFactory().createValueExpression(getFacesContext().getELContext(), "#{" + getVar() + "}", Object.class); | |
517 | - List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); | |
518 | - for (int i = 0; i < dataModel.getRowCount(); i++) { | |
519 | - dataModel.setRowIndex(i); | |
520 | - valueExpression.setValue(elContext, dataModel.getRowData()); | |
521 | - Map<String, Object> firstDataElement = new HashMap<String, Object>(); | |
522 | -// TODO shouldn't we check earlier if there is at most one renderable UIScheduleItem child? | |
523 | - for (UIComponent child : getChildren()) { | |
524 | - if (child instanceof UIScheduleItem) { | |
525 | - UIScheduleItem item = (UIScheduleItem) child; | |
526 | - if (!item.isRendered()) { | |
474 | + public abstract Boolean getAllDaySlot(); | |
475 | + | |
476 | + public abstract String getAllDayText(); | |
477 | + | |
478 | + public abstract Double getAspectRatio(); | |
479 | + | |
480 | + public abstract String getAxisFormat(); | |
481 | + | |
482 | + public abstract Integer getContentHeight(); | |
483 | + | |
484 | + public abstract Date getDate(); | |
485 | + | |
486 | + public abstract MethodBinding getDateRangeChangeListener(); | |
487 | + | |
488 | + public abstract MethodBinding getDateRangeSelectListener(); | |
489 | + | |
490 | + public abstract MethodBinding getDateSelectListener(); | |
491 | + | |
492 | + public abstract Integer getDefaultEventMinutes(); | |
493 | + | |
494 | + public abstract Boolean getDisableDragging(); | |
495 | + | |
496 | + public abstract Boolean getDisableResizing(); | |
497 | + | |
498 | + public abstract Integer getDragRevertDuration(); | |
499 | + | |
500 | + public abstract Boolean getEditable(); | |
501 | + | |
502 | + public abstract Integer getFirstDay(); | |
503 | + | |
504 | + public abstract Integer getFirstHour(); | |
505 | + | |
506 | + public abstract String getHeaderCenter(); | |
507 | + | |
508 | + public abstract String getHeaderLeft(); | |
509 | + | |
510 | + public abstract String getHeaderRight(); | |
511 | + | |
512 | + public abstract Integer getHeight(); | |
513 | + | |
514 | + public abstract Boolean getIsRTL(); | |
515 | + | |
516 | + public abstract MethodBinding getItemMoveListener(); | |
517 | + | |
518 | + public abstract MethodBinding getItemResizeListener(); | |
519 | + | |
520 | + public abstract MethodBinding getItemSelectListener(); | |
521 | + | |
522 | + public abstract String getMaxTime(); | |
523 | + | |
524 | + public abstract String getMinTime(); | |
525 | + | |
526 | + public abstract String getOnbeforedaterangeselect(); | |
527 | + | |
528 | + public abstract String getOnbeforedateselect(); | |
529 | + | |
530 | + public abstract String getOnbeforeitemdrop(); | |
531 | + | |
532 | + public abstract String getOnbeforeitemresize(); | |
533 | + | |
534 | + public abstract String getOnbeforeitemselect(); | |
535 | + | |
536 | + public abstract String getOndaterangechange(); | |
537 | + | |
538 | + public abstract String getOndaterangeselect(); | |
539 | + | |
540 | + public abstract String getOndateselect(); | |
541 | + | |
542 | + public abstract String getOnitemdragstart(); | |
543 | + | |
544 | + public abstract String getOnitemdragstop(); | |
545 | + | |
546 | + public abstract String getOnitemdrop(); | |
547 | + | |
548 | + public abstract String getOnitemmouseout(); | |
549 | + | |
550 | + public abstract String getOnitemmouseover(); | |
551 | + | |
552 | + public abstract String getOnitemresize(); | |
553 | + | |
554 | + public abstract String getOnitemresizestart(); | |
555 | + | |
556 | + public abstract String getOnitemresizestop(); | |
557 | + | |
558 | + public abstract String getOnitemselect(); | |
559 | + | |
560 | + public abstract String getOnviewchange(); | |
561 | + | |
562 | + public abstract String getOnviewdisplay(); | |
563 | + | |
564 | + /** | |
565 | + * Range is [startDate;endDate), which means that start date is inclusive | |
566 | + * and end date is exclusive. | |
567 | + * | |
568 | + * @param startDate | |
569 | + * @param endDate | |
570 | + * @return | |
571 | + * @throws IOException | |
572 | + */ | |
573 | + public List<Map<String, Object>> getScheduleData(Date startDate, Date endDate) throws IOException { | |
574 | + /** | |
575 | + * Locale must be US because this is the format the javascript widget supports | |
576 | + */ | |
577 | + DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); | |
578 | + format.setLenient(false); | |
579 | + DataModel dataModel = getDataModel(); | |
580 | + if (dataModel instanceof ExtendedDataModel) { | |
581 | + DataVisitor visitor = new DataVisitor() { | |
582 | + //TODO Is this fine? or should we stack rowKeys and not use dataModel later on. I'don't know business rules of extendedDataModel, just used it once to do pagination with underlying EntityQuery from Seam | |
583 | + | |
584 | + public void process(FacesContext context, Object rowKey, Object argument) throws IOException { | |
585 | + } | |
586 | + }; | |
587 | + ((ExtendedDataModel) dataModel).walk(getFacesContext(), visitor, new DateRange(startDate, endDate), null); | |
588 | + } | |
589 | + ELContext elContext = getFacesContext().getELContext(); | |
590 | + ValueExpression valueExpression = getFacesContext().getApplication().getExpressionFactory().createValueExpression(getFacesContext().getELContext(), "#{" + getVar() + "}", Object.class); | |
591 | + List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); | |
592 | + for (int i = 0; i < dataModel.getRowCount(); i++) { | |
593 | + dataModel.setRowIndex(i); | |
594 | + valueExpression.setValue(elContext, dataModel.getRowData()); | |
595 | + Map<String, Object> firstDataElement = new HashMap<String, Object>(); | |
596 | +// TODO shouldn't we check earlier if there is at most one renderable UIScheduleItem child? | |
597 | + for (UIComponent child : getChildren()) { | |
598 | + if (child instanceof UIScheduleItem) { | |
599 | + UIScheduleItem item = (UIScheduleItem) child; | |
600 | + if (!item.isRendered()) { | |
527 | 601 | continue; |
528 | 602 | } |
529 | 603 | firstDataElement.put("id", item.getEventId()); |
... | ... | @@ -555,247 +629,181 @@ public abstract class UISchedule extends UIComponentBase implements ScheduleComm |
555 | 629 | return data; |
556 | 630 | } |
557 | 631 | |
558 | - public static Date getFirstDisplayedDay(UISchedule schedule) { | |
559 | - Calendar calendar = Calendar.getInstance(); | |
560 | - Date date = schedule.getDate(); | |
561 | - if (date != null) { | |
562 | - calendar.setTime(date); | |
563 | - } | |
564 | - int firstDayOfWeek = getFirstDay(schedule); | |
565 | - calendar.setFirstDayOfWeek(firstDayOfWeek); | |
566 | - String view = getView(schedule); | |
567 | - boolean showWeekends = isShowWeekends(schedule); | |
568 | - if (VIEW_MONTH.equals(view)) { | |
569 | - calendar.set(Calendar.DATE, 1); | |
570 | - if (!showWeekends) { | |
571 | - int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
572 | - if (dayOfWeek == Calendar.SUNDAY) { | |
573 | - calendar.add(Calendar.DATE, 1); | |
574 | - } else if (dayOfWeek == Calendar.SATURDAY) { | |
575 | - calendar.add(Calendar.DATE, 2); | |
576 | - } | |
577 | - } | |
578 | - if (!showWeekends && firstDayOfWeek == Calendar.SUNDAY) { | |
579 | - firstDayOfWeek++; | |
580 | - } | |
581 | - /** | |
582 | - * Following 1 line is a fix to what i believe is a bug of java.util.Calendar | |
583 | - */ | |
584 | - calendar.get(Calendar.DAY_OF_WEEK); | |
585 | - calendar.set(Calendar.DAY_OF_WEEK, firstDayOfWeek); | |
586 | - return calendar.getTime(); | |
587 | - } else if (VIEW_AGENDA_WEEK.equals(view) || VIEW_BASIC_WEEK.equals(view)) { | |
588 | - calendar.set(Calendar.DAY_OF_WEEK, firstDayOfWeek); | |
589 | - if (!showWeekends) { | |
590 | - int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
591 | - if (dayOfWeek == Calendar.SUNDAY) { | |
592 | - calendar.add(Calendar.DATE, 1); | |
593 | - } else if (dayOfWeek == Calendar.SATURDAY) { | |
594 | - calendar.add(Calendar.DATE, 2); | |
595 | - } | |
596 | - } | |
597 | - return calendar.getTime(); | |
598 | - } else if (VIEW_AGENDA_DAY.equals(view) || VIEW_BASIC_DAY.equals(view)) { | |
599 | - return calendar.getTime(); | |
600 | - } else { | |
601 | - throw new IllegalStateException("Invalid view attribute: " + view); | |
602 | - } | |
603 | - } | |
632 | + public abstract Boolean getSelectHelper(); | |
604 | 633 | |
605 | - public static Date getLastDisplayedDate(UISchedule schedule) { | |
606 | - Calendar calendar = Calendar.getInstance(); | |
607 | - int firstDayOfWeek = getFirstDay(schedule); | |
608 | - String view = getView(schedule); | |
609 | - boolean showWeekends = isShowWeekends(schedule); | |
610 | - if (VIEW_MONTH.equals(view)) { | |
611 | - if (WEEK_MODE_FIXED.equals(getWeekMode(schedule))) { | |
612 | - calendar.setTime(getFirstDisplayedDay(schedule)); | |
613 | - calendar.add(Calendar.DAY_OF_YEAR, 42); | |
614 | - } else { | |
615 | - Date date = schedule.getDate(); | |
616 | - if (date != null) { | |
617 | - calendar.setTime(date); | |
618 | - } | |
634 | + public abstract Boolean getSelectable(); | |
619 | 635 | |
620 | - if (!showWeekends && firstDayOfWeek == Calendar.SUNDAY) { | |
621 | - firstDayOfWeek++; | |
622 | - } | |
623 | - calendar.setFirstDayOfWeek(firstDayOfWeek); | |
624 | - calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE)); | |
625 | - int dayOfWeek = firstDayOfWeek + 6; | |
626 | - if (dayOfWeek > Calendar.SATURDAY) { | |
627 | - dayOfWeek -= 7; | |
628 | - } | |
629 | - /** | |
630 | - * Following 1 line is a fix to what i believe is a bug of java.util.Calendar | |
631 | - */ | |
632 | - calendar.get(Calendar.DAY_OF_WEEK); | |
633 | - calendar.set(Calendar.DAY_OF_WEEK, dayOfWeek); | |
634 | - calendar.add(Calendar.DATE, 1); | |
635 | - } | |
636 | - return calendar.getTime(); | |
637 | - } else if (VIEW_AGENDA_WEEK.equals(view) || VIEW_BASIC_WEEK.equals(view)) { | |
638 | - calendar.setFirstDayOfWeek(firstDayOfWeek); | |
639 | - calendar.setTime(getFirstDisplayedDay(schedule)); | |
640 | - calendar.add(Calendar.DATE, 7); | |
641 | - if (!showWeekends) { | |
642 | - int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
643 | - if (dayOfWeek - 1 == Calendar.SUNDAY) { | |
644 | - calendar.add(Calendar.DATE, -2); | |
645 | - } else if (dayOfWeek - 1 == Calendar.SATURDAY) { | |
646 | - calendar.add(Calendar.DATE, -1); | |
647 | - } | |
648 | - } | |
649 | - return calendar.getTime(); | |
650 | - } else if (VIEW_AGENDA_DAY.equals(view) || VIEW_BASIC_DAY.equals(view)) { | |
651 | - calendar.setTime(getFirstDisplayedDay(schedule)); | |
652 | - calendar.add(Calendar.DATE, 1); | |
653 | - return calendar.getTime(); | |
654 | - } else { | |
655 | - throw new IllegalStateException("Invalid view attribute: " + view); | |
656 | - } | |
636 | + public abstract Boolean getShowWeekends(); | |
657 | 637 | |
658 | - } | |
638 | + public abstract Integer getSlotMinutes(); | |
659 | 639 | |
660 | - /** | |
661 | - * Here go static methods for getting value or default value of attributes. | |
662 | - */ | |
663 | - /** | |
664 | - * @param schedule | |
665 | - * @return | |
666 | - */ | |
667 | - public static boolean isShowWeekends(UISchedule schedule) { | |
668 | - Boolean showWeekends = schedule.getShowWeekends(); | |
669 | - return showWeekends == null ? UISchedule.DEFAULT_SHOW_WEEKENDS : schedule.getShowWeekends(); | |
670 | - } | |
640 | + public abstract String getStyleClass(); | |
671 | 641 | |
672 | - public static int getFirstDay(UISchedule schedule) { | |
673 | - Integer firstDay = schedule.getFirstDay(); | |
674 | - return firstDay == null ? UISchedule.DEFAULT_FIRST_DAY : firstDay; | |
675 | - } | |
642 | + public abstract String getSwitchType(); | |
676 | 643 | |
677 | - public static String getWeekMode(UISchedule schedule) { | |
678 | - String weekMode = schedule.getWeekMode(); | |
679 | - return weekMode == null ? UISchedule.DEFAULT_WEEK_MODE : weekMode; | |
680 | - } | |
644 | + public abstract Boolean getUnselectAuto(); | |
681 | 645 | |
682 | - public static String getView(UISchedule schedule) { | |
683 | - String view = schedule.getView(); | |
684 | - return view == null ? UISchedule.DEFAULT_VIEW : view; | |
685 | - } | |
646 | + public abstract String getUnselectCancel(); | |
686 | 647 | |
687 | - protected DataModel getDataModel() { | |
688 | - // Return any previously cached DataModel instance | |
689 | - if (this.model != null) { | |
690 | - return model; | |
691 | - } | |
648 | + public abstract Object getValue(); | |
692 | 649 | |
693 | - // Synthesize a DataModel around our current value if possible | |
694 | - Object current = getValue(); | |
695 | - if (current == null) { | |
696 | - setDataModel(new ListDataModel(Collections.EMPTY_LIST)); | |
697 | - } else if (current instanceof DataModel) { | |
698 | - setDataModel((DataModel) current); | |
699 | - } else if (current instanceof List) { | |
700 | - setDataModel(new ListDataModel((List) current)); | |
701 | - } else if (Object[].class.isAssignableFrom(current.getClass())) { | |
702 | - setDataModel(new ArrayDataModel((Object[]) current)); | |
703 | - } else if (current instanceof ResultSet) { | |
704 | - setDataModel(new ResultSetDataModel((ResultSet) current)); | |
705 | - } else if (current instanceof Result) { | |
706 | - setDataModel(new ResultDataModel((Result) current)); | |
707 | - } else { | |
708 | - setDataModel(new ScalarDataModel(current)); | |
709 | - } | |
710 | - return model; | |
650 | + public abstract String getVar(); | |
711 | 651 | |
712 | - } | |
652 | + public abstract String getView(); | |
653 | + | |
654 | + public abstract MethodBinding getViewChangeListener(); | |
655 | + | |
656 | + public abstract String getWeekMode(); | |
657 | + | |
658 | + public abstract String getWidgetVar(); | |
659 | + | |
660 | + public abstract void setAllDayByDefault(Boolean allDayByDefault); | |
661 | + | |
662 | + public abstract void setAllDaySlot(Boolean allDaySlot); | |
663 | + | |
664 | + public abstract void setAllDayText(String allDayText); | |
665 | + | |
666 | + public abstract void setAspectRatio(Double aspectRatio); | |
667 | + | |
668 | + public abstract void setAxisFormat(String axisFormat); | |
669 | + | |
670 | + public abstract void setContentHeight(Integer contentHeight); | |
713 | 671 | |
714 | 672 | public void setDataModel(DataModel model) { |
715 | 673 | this.model = model; |
716 | 674 | } |
717 | 675 | |
718 | - public void addItemSelectListener(ScheduleItemSelectListener listener) { | |
719 | - addFacesListener(listener); | |
720 | - } | |
676 | + public abstract void setDate(Date date); | |
721 | 677 | |
722 | - public void removeItemSelectListener(ScheduleItemSelectListener listener) { | |
723 | - removeFacesListener(listener); | |
724 | - } | |
678 | + public abstract void setDateRangeChangeListener(MethodBinding listener); | |
725 | 679 | |
726 | - public ScheduleItemSelectListener[] getItemSelectListeners() { | |
727 | - return (ScheduleItemSelectListener[]) getFacesListeners(ScheduleItemSelectListener.class); | |
728 | - } | |
680 | + public abstract void setDateRangeSelectListener(MethodBinding listener); | |
729 | 681 | |
730 | - public void addItemMoveListener(ScheduleItemMoveListener listener) { | |
731 | - addFacesListener(listener); | |
732 | - } | |
682 | + public abstract void setDateSelectListener(MethodBinding listener); | |
733 | 683 | |
734 | - public void removeItemMoveListener(ScheduleItemMoveListener listener) { | |
735 | - removeFacesListener(listener); | |
736 | - } | |
684 | + public abstract void setDefaultEventMinutes(Integer defaultEventMinutes); | |
737 | 685 | |
738 | - public ScheduleItemMoveListener[] getItemMoveListeners() { | |
739 | - return (ScheduleItemMoveListener[]) getFacesListeners(ScheduleItemMoveListener.class); | |
740 | - } | |
686 | + public abstract void setDisableDragging(Boolean disableDragging); | |
741 | 687 | |
742 | - public void addItemResizeListener(ScheduleItemResizeListener listener) { | |
743 | - addFacesListener(listener); | |
744 | - } | |
688 | + public abstract void setDisableResizing(Boolean disableResizing); | |
745 | 689 | |
746 | - public void removeItemResizeListener(ScheduleItemResizeListener listener) { | |
747 | - removeFacesListener(listener); | |
748 | - } | |
690 | + public abstract void setDragRevertDuration(Integer dragRevertDuration); | |
749 | 691 | |
750 | - public ScheduleItemResizeListener[] getItemResizeListeners() { | |
751 | - return (ScheduleItemResizeListener[]) getFacesListeners(ScheduleItemResizeListener.class); | |
752 | - } | |
692 | + public abstract void setEditable(Boolean editable); | |
753 | 693 | |
754 | - public void addViewChangeListener(ScheduleViewChangeListener listener) { | |
755 | - addFacesListener(listener); | |
756 | - } | |
694 | + public abstract void setFirstDay(Integer firstDay); | |
757 | 695 | |
758 | - public void removeViewChangeListener(ScheduleViewChangeListener listener) { | |
759 | - removeFacesListener(listener); | |
760 | - } | |
696 | + public abstract void setFirstHour(Integer firstHour); | |
761 | 697 | |
762 | - public ScheduleViewChangeListener[] getViewChangeListeners() { | |
763 | - return (ScheduleViewChangeListener[]) getFacesListeners(ScheduleViewChangeListener.class); | |
764 | - } | |
698 | + public abstract void setHeaderCenter(String headerCenter); | |
765 | 699 | |
766 | - public void addDateRangeChangeListener(ScheduleDateRangeChangeListener listener) { | |
767 | - addFacesListener(listener); | |
768 | - } | |
700 | + public abstract void setHeaderLeft(String headerLeft); | |
769 | 701 | |
770 | - public void removeDateRangeChangeListener(ScheduleDateRangeChangeListener listener) { | |
771 | - removeFacesListener(listener); | |
772 | - } | |
702 | + public abstract void setHeaderRight(String headerRight); | |
773 | 703 | |
774 | - public ScheduleDateRangeChangeListener[] getDateRangeChangeListeners() { | |
775 | - return (ScheduleDateRangeChangeListener[]) getFacesListeners(ScheduleDateRangeChangeListener.class); | |
776 | - } | |
704 | + public abstract void setHeight(Integer height); | |
777 | 705 | |
778 | - public void addDateRangeSelectListener(ScheduleDateRangeSelectListener listener) { | |
779 | - addFacesListener(listener); | |
780 | - } | |
706 | + public abstract void setIsRTL(Boolean isrtl); | |
781 | 707 | |
782 | - public void removeDateRangeSelectListener(ScheduleDateRangeSelectListener listener) { | |
783 | - removeFacesListener(listener); | |
784 | - } | |
708 | + public abstract void setItemMoveListener(MethodBinding listener); | |
785 | 709 | |
786 | - public ScheduleDateRangeSelectListener[] getDateRangeSelectListeners() { | |
787 | - return (ScheduleDateRangeSelectListener[]) getFacesListeners(ScheduleDateRangeSelectListener.class); | |
788 | - } | |
710 | + public abstract void setItemResizeListener(MethodBinding listener); | |
789 | 711 | |
790 | - public void addDateSelectListener(ScheduleDateSelectListener listener) { | |
791 | - addFacesListener(listener); | |
792 | - } | |
712 | + public abstract void setItemSelectListener(MethodBinding listener); | |
793 | 713 | |
794 | - public void removeDateSelectListener(ScheduleDateSelectListener listener) { | |
795 | - removeFacesListener(listener); | |
796 | - } | |
714 | + public abstract void setMaxTime(String maxTime); | |
797 | 715 | |
798 | - public ScheduleDateSelectListener[] getDateSelectListeners() { | |
799 | - return (ScheduleDateSelectListener[]) getFacesListeners(ScheduleDateSelectListener.class); | |
716 | + public abstract void setMinTime(String minTime); | |
717 | + | |
718 | + public abstract void setOnbeforedaterangeselect(String onbeforedaterangeselect); | |
719 | + | |
720 | + public abstract void setOnbeforedateselect(String onbeforedateselect); | |
721 | + | |
722 | + public abstract void setOnbeforeitemdrop(String onbeforeitemdrop); | |
723 | + | |
724 | + public abstract void setOnbeforeitemresize(String onbeforeitemresize); | |
725 | + | |
726 | + public abstract void setOnbeforeitemselect(String onbeforeitemselect); | |
727 | + | |
728 | + public abstract void setOndaterangechange(String ondaterangechange); | |
729 | + | |
730 | + public abstract void setOndaterangeselect(String ondaterangeselect); | |
731 | + | |
732 | + public abstract void setOndateselect(String ondateselect); | |
733 | + | |
734 | + public abstract void setOnitemdragstart(String onitemdragstop); | |
735 | + | |
736 | + public abstract void setOnitemdragstop(String onitemdragstop); | |
737 | + | |
738 | + public abstract void setOnitemdrop(String onitemdrop); | |
739 | + | |
740 | + public abstract void setOnitemmouseout(String onitemmouseout); | |
741 | + | |
742 | + public abstract void setOnitemmouseover(String onitemmouseover); | |
743 | + | |
744 | + public abstract void setOnitemresize(String onitemresize); | |
745 | + | |
746 | + public abstract void setOnitemresizestart(String onitemresizestart); | |
747 | + | |
748 | + public abstract void setOnitemresizestop(String onitemresizestop); | |
749 | + | |
750 | + public abstract void setOnitemselect(String onitemselect); | |
751 | + | |
752 | + public abstract void setOnviewchange(String onviewchange); | |
753 | + | |
754 | + public abstract void setOnviewdisplay(String onviewdisplay); | |
755 | + | |
756 | + public abstract void setSelectHelper(Boolean selectHelper); | |
757 | + | |
758 | + public abstract void setSelectable(Boolean selectable); | |
759 | + | |
760 | + public abstract void setShowWeekends(Boolean showWeekends); | |
761 | + | |
762 | + public abstract void setSlotMinutes(Integer slotMinutes); | |
763 | + | |
764 | + public abstract void setStyleClass(String styleClass); | |
765 | + | |
766 | + public abstract void setSwitchType(String switchType); | |
767 | + | |
768 | + public abstract void setUnselectAuto(Boolean unselectAuto); | |
769 | + | |
770 | + public abstract void setUnselectCancel(String unselectCancel); | |
771 | + | |
772 | + public abstract void setValue(Object value); | |
773 | + | |
774 | + public abstract void setVar(String value); | |
775 | + | |
776 | + public abstract void setView(String defaultView); | |
777 | + | |
778 | + public abstract void setViewChangeListener(MethodBinding listener); | |
779 | + | |
780 | + public abstract void setWeekMode(String weekMode); | |
781 | + | |
782 | + public abstract void setWidgetVar(String widgetVar); | |
783 | + | |
784 | + protected DataModel getDataModel() { | |
785 | + // Return any previously cached DataModel instance | |
786 | + if (this.model != null) { | |
787 | + return model; | |
788 | + } | |
789 | + | |
790 | + // Synthesize a DataModel around our current value if possible | |
791 | + Object current = getValue(); | |
792 | + if (current == null) { | |
793 | + setDataModel(new ListDataModel(Collections.EMPTY_LIST)); | |
794 | + } else if (current instanceof DataModel) { | |
795 | + setDataModel((DataModel) current); | |
796 | + } else if (current instanceof List) { | |
797 | + setDataModel(new ListDataModel((List) current)); | |
798 | + } else if (Object[].class.isAssignableFrom(current.getClass())) { | |
799 | + setDataModel(new ArrayDataModel((Object[]) current)); | |
800 | + } else if (current instanceof ResultSet) { | |
801 | + setDataModel(new ResultSetDataModel((ResultSet) current)); | |
802 | + } else if (current instanceof Result) { | |
803 | + setDataModel(new ResultDataModel((Result) current)); | |
804 | + } else { | |
805 | + setDataModel(new ScalarDataModel(current)); | |
806 | + } | |
807 | + return model; | |
800 | 808 | } |
801 | 809 | } | ... | ... |
... | ... | @@ -3,7 +3,9 @@ package org.richfaces.component; |
3 | 3 | import javax.faces.component.UIComponentBase; |
4 | 4 | |
5 | 5 | public abstract class UIScheduleAgendaDayView extends UIComponentBase implements ScheduleCommonViewAttributes { |
6 | +// ------------------------------ FIELDS ------------------------------ | |
6 | 7 | |
7 | - public static final String COMPONENT_TYPE = "org.richfaces.ScheduleAgendaDayView"; | |
8 | 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
9 | + | |
10 | + public static final String COMPONENT_TYPE = "org.richfaces.ScheduleAgendaDayView"; | |
9 | 11 | } | ... | ... |
... | ... | @@ -3,7 +3,9 @@ package org.richfaces.component; |
3 | 3 | import javax.faces.component.UIComponentBase; |
4 | 4 | |
5 | 5 | public abstract class UIScheduleAgendaWeekView extends UIComponentBase implements ScheduleCommonViewAttributes { |
6 | +// ------------------------------ FIELDS ------------------------------ | |
6 | 7 | |
7 | - public static final String COMPONENT_TYPE = "org.richfaces.ScheduleAgendaWeekView"; | |
8 | 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
9 | + | |
10 | + public static final String COMPONENT_TYPE = "org.richfaces.ScheduleAgendaWeekView"; | |
9 | 11 | } | ... | ... |
... | ... | @@ -3,7 +3,9 @@ package org.richfaces.component; |
3 | 3 | import javax.faces.component.UIComponentBase; |
4 | 4 | |
5 | 5 | public abstract class UIScheduleBasicDayView extends UIComponentBase implements ScheduleCommonViewAttributes { |
6 | +// ------------------------------ FIELDS ------------------------------ | |
6 | 7 | |
7 | - public static final String COMPONENT_TYPE = "org.richfaces.ScheduleBasicDayView"; | |
8 | 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
9 | + | |
10 | + public static final String COMPONENT_TYPE = "org.richfaces.ScheduleBasicDayView"; | |
9 | 11 | } | ... | ... |
... | ... | @@ -3,7 +3,9 @@ package org.richfaces.component; |
3 | 3 | import javax.faces.component.UIComponentBase; |
4 | 4 | |
5 | 5 | public abstract class UIScheduleBasicWeekView extends UIComponentBase implements ScheduleCommonViewAttributes { |
6 | +// ------------------------------ FIELDS ------------------------------ | |
6 | 7 | |
7 | - public static final String COMPONENT_TYPE = "org.richfaces.ScheduleBasicWeekView"; | |
8 | 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
9 | + | |
10 | + public static final String COMPONENT_TYPE = "org.richfaces.ScheduleBasicWeekView"; | |
9 | 11 | } | ... | ... |
... | ... | @@ -7,45 +7,51 @@ import java.util.Date; |
7 | 7 | * JSF component class |
8 | 8 | */ |
9 | 9 | public abstract class UIScheduleItem extends UIComponentBase { |
10 | +// ------------------------------ FIELDS ------------------------------ | |
10 | 11 | |
11 | - public static final String COMPONENT_TYPE = "org.richfaces.ScheduleItem"; | |
12 | 12 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
13 | - public static final boolean DEFAULT_ALL_DAY = true; | |
14 | - public static final boolean DEFAULT_EDITABLE = UISchedule.DEFAULT_EDITABLE; | |
15 | 13 | |
16 | - public abstract String getStyleClass(); | |
14 | + public static final String COMPONENT_TYPE = "org.richfaces.ScheduleItem"; | |
17 | 15 | |
18 | - public abstract void setStyleClass(String styleClass); | |
16 | + public static final boolean DEFAULT_ALL_DAY = true; | |
19 | 17 | |
20 | - public abstract String getTitle(); | |
18 | + public static final boolean DEFAULT_EDITABLE = UISchedule.DEFAULT_EDITABLE; | |
21 | 19 | |
22 | - public abstract void setTitle(String title); | |
20 | +// -------------------------- OTHER METHODS -------------------------- | |
23 | 21 | |
24 | - public abstract Date getStartDate(); | |
22 | + public abstract Boolean getAllDay(); | |
25 | 23 | |
26 | - public abstract void setStartDate(Date date); | |
24 | + public abstract Object getData(); | |
27 | 25 | |
28 | - public abstract Date getEndDate(); | |
26 | + public abstract Boolean getEditable(); | |
29 | 27 | |
30 | - public abstract void setEndDate(Date date); | |
28 | + public abstract Date getEndDate(); | |
31 | 29 | |
32 | 30 | public abstract String getEventId(); |
33 | 31 | |
34 | - public abstract void setEventId(String eventId); | |
32 | + public abstract Date getStartDate(); | |
35 | 33 | |
36 | - public abstract Boolean getAllDay(); | |
34 | + public abstract String getStyleClass(); | |
37 | 35 | |
38 | - public abstract void setAllDay(Boolean isAllDay); | |
36 | + public abstract String getTitle(); | |
39 | 37 | |
40 | 38 | public abstract String getUrl(); |
41 | 39 | |
42 | - public abstract void setUrl(String url); | |
40 | + public abstract void setAllDay(Boolean isAllDay); | |
43 | 41 | |
44 | - public abstract Boolean getEditable(); | |
42 | + public abstract void setData(Object data); | |
45 | 43 | |
46 | 44 | public abstract void setEditable(Boolean editable); |
47 | 45 | |
48 | - public abstract Object getData(); | |
46 | + public abstract void setEndDate(Date date); | |
49 | 47 | |
50 | - public abstract void setData(Object data); | |
48 | + public abstract void setEventId(String eventId); | |
49 | + | |
50 | + public abstract void setStartDate(Date date); | |
51 | + | |
52 | + public abstract void setStyleClass(String styleClass); | |
53 | + | |
54 | + public abstract void setTitle(String title); | |
55 | + | |
56 | + public abstract void setUrl(String url); | |
51 | 57 | } | ... | ... |
... | ... | @@ -3,10 +3,14 @@ package org.richfaces.component; |
3 | 3 | import javax.faces.component.UIComponentBase; |
4 | 4 | |
5 | 5 | public abstract class UIScheduleMonthView extends UIComponentBase implements ScheduleCommonViewAttributes { |
6 | +// ------------------------------ FIELDS ------------------------------ | |
6 | 7 | |
7 | - public static final String COMPONENT_TYPE = "org.richfaces.ScheduleMonthView"; | |
8 | 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; |
9 | 9 | |
10 | + public static final String COMPONENT_TYPE = "org.richfaces.ScheduleMonthView"; | |
11 | + | |
12 | +// -------------------------- OTHER METHODS -------------------------- | |
13 | + | |
10 | 14 | public abstract String getWeekMode(); |
11 | 15 | |
12 | 16 | public abstract void setWeekMode(String mode); | ... | ... |
... | ... | @@ -6,29 +6,39 @@ import javax.faces.event.FacesListener; |
6 | 6 | import java.util.Date; |
7 | 7 | |
8 | 8 | public class ScheduleDateRangeChangeEvent extends FacesEvent { |
9 | +// ------------------------------ FIELDS ------------------------------ | |
9 | 10 | |
10 | - private Date startDate; | |
11 | 11 | private Date endDate; |
12 | 12 | |
13 | + private Date startDate; | |
14 | + | |
15 | +// --------------------------- CONSTRUCTORS --------------------------- | |
16 | + | |
13 | 17 | public ScheduleDateRangeChangeEvent(UIComponent component, Date startDate, Date endDate) { |
14 | 18 | super(component); |
15 | 19 | this.startDate = startDate; |
16 | 20 | this.endDate = endDate; |
17 | 21 | } |
18 | 22 | |
19 | - public Date getStartDate() { | |
20 | - return startDate; | |
21 | - } | |
23 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
22 | 24 | |
23 | 25 | public Date getEndDate() { |
24 | 26 | return endDate; |
25 | 27 | } |
26 | 28 | |
29 | + public Date getStartDate() { | |
30 | + return startDate; | |
31 | + } | |
32 | + | |
33 | +// ------------------------ CANONICAL METHODS ------------------------ | |
34 | + | |
27 | 35 | @Override |
28 | 36 | public String toString() { |
29 | 37 | return getClass().getSimpleName() + "[startDate=" + startDate + ";endDate=" + endDate + "]"; |
30 | 38 | } |
31 | 39 | |
40 | +// -------------------------- OTHER METHODS -------------------------- | |
41 | + | |
32 | 42 | @Override |
33 | 43 | public boolean isAppropriateListener(FacesListener listener) { |
34 | 44 | return listener instanceof ScheduleDateRangeChangeListener; | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleDateRangeChangeListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | void dateRangeChanged(ScheduleDateRangeChangeEvent event); |
8 | 9 | } | ... | ... |
... | ... | @@ -6,11 +6,16 @@ import javax.faces.event.FacesListener; |
6 | 6 | import java.util.Date; |
7 | 7 | |
8 | 8 | public class ScheduleDateRangeSelectEvent extends FacesEvent { |
9 | +// ------------------------------ FIELDS ------------------------------ | |
9 | 10 | |
10 | - private Date startDate; | |
11 | - private Date endDate; | |
12 | 11 | private boolean allDay; |
13 | 12 | |
13 | + private Date endDate; | |
14 | + | |
15 | + private Date startDate; | |
16 | + | |
17 | +// --------------------------- CONSTRUCTORS --------------------------- | |
18 | + | |
14 | 19 | public ScheduleDateRangeSelectEvent(UIComponent component, Date startDate, Date endDate, boolean allDay) { |
15 | 20 | super(component); |
16 | 21 | this.startDate = startDate; |
... | ... | @@ -18,28 +23,34 @@ public class ScheduleDateRangeSelectEvent extends FacesEvent { |
18 | 23 | this.allDay = allDay; |
19 | 24 | } |
20 | 25 | |
21 | - public boolean isAppropriateListener(FacesListener facesListener) { | |
22 | - return facesListener instanceof ScheduleDateSelectListener; | |
23 | - } | |
26 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
24 | 27 | |
25 | - public void processListener(FacesListener facesListener) { | |
26 | - ((ScheduleDateRangeSelectListener) facesListener).dateRangeSelected(this); | |
28 | + public Date getEndDate() { | |
29 | + return endDate; | |
27 | 30 | } |
28 | 31 | |
29 | 32 | public Date getStartDate() { |
30 | 33 | return startDate; |
31 | 34 | } |
32 | 35 | |
33 | - public Date getEndDate() { | |
34 | - return endDate; | |
35 | - } | |
36 | - | |
37 | 36 | public boolean isAllDay() { |
38 | 37 | return allDay; |
39 | 38 | } |
40 | 39 | |
40 | +// ------------------------ CANONICAL METHODS ------------------------ | |
41 | + | |
41 | 42 | @Override |
42 | 43 | public String toString() { |
43 | 44 | return getClass().getSimpleName() + "[startDate=" + startDate + ";endDate=" + endDate + ";allDay=" + allDay + "]"; |
44 | 45 | } |
46 | + | |
47 | +// -------------------------- OTHER METHODS -------------------------- | |
48 | + | |
49 | + public boolean isAppropriateListener(FacesListener facesListener) { | |
50 | + return facesListener instanceof ScheduleDateSelectListener; | |
51 | + } | |
52 | + | |
53 | + public void processListener(FacesListener facesListener) { | |
54 | + ((ScheduleDateRangeSelectListener) facesListener).dateRangeSelected(this); | |
55 | + } | |
45 | 56 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleDateRangeSelectListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | void dateRangeSelected(ScheduleDateRangeSelectEvent event); |
8 | 9 | } | ... | ... |
... | ... | @@ -6,23 +6,21 @@ import javax.faces.event.FacesListener; |
6 | 6 | import java.util.Date; |
7 | 7 | |
8 | 8 | public class ScheduleDateSelectEvent extends FacesEvent { |
9 | +// ------------------------------ FIELDS ------------------------------ | |
9 | 10 | |
10 | - private Date date; | |
11 | 11 | private boolean allDay; |
12 | 12 | |
13 | + private Date date; | |
14 | + | |
15 | +// --------------------------- CONSTRUCTORS --------------------------- | |
16 | + | |
13 | 17 | public ScheduleDateSelectEvent(UIComponent component, Date date, boolean allDay) { |
14 | 18 | super(component); |
15 | 19 | this.date = date; |
16 | 20 | this.allDay = allDay; |
17 | 21 | } |
18 | 22 | |
19 | - public boolean isAppropriateListener(FacesListener facesListener) { | |
20 | - return facesListener instanceof ScheduleDateSelectListener; | |
21 | - } | |
22 | - | |
23 | - public void processListener(FacesListener facesListener) { | |
24 | - ((ScheduleDateSelectListener) facesListener).dateSelected(this); | |
25 | - } | |
23 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
26 | 24 | |
27 | 25 | public Date getDate() { |
28 | 26 | return date; |
... | ... | @@ -32,8 +30,20 @@ public class ScheduleDateSelectEvent extends FacesEvent { |
32 | 30 | return allDay; |
33 | 31 | } |
34 | 32 | |
33 | +// ------------------------ CANONICAL METHODS ------------------------ | |
34 | + | |
35 | 35 | @Override |
36 | 36 | public String toString() { |
37 | 37 | return getClass().getSimpleName() + "[date=" + date + ";allDay=" + allDay + "]"; |
38 | 38 | } |
39 | + | |
40 | +// -------------------------- OTHER METHODS -------------------------- | |
41 | + | |
42 | + public boolean isAppropriateListener(FacesListener facesListener) { | |
43 | + return facesListener instanceof ScheduleDateSelectListener; | |
44 | + } | |
45 | + | |
46 | + public void processListener(FacesListener facesListener) { | |
47 | + ((ScheduleDateSelectListener) facesListener).dateSelected(this); | |
48 | + } | |
39 | 49 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleDateSelectListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | void dateSelected(ScheduleDateSelectEvent event); |
8 | 9 | } | ... | ... |
... | ... | @@ -5,11 +5,17 @@ import javax.faces.event.FacesEvent; |
5 | 5 | import javax.faces.event.FacesListener; |
6 | 6 | |
7 | 7 | public class ScheduleItemMoveEvent extends FacesEvent { |
8 | +// ------------------------------ FIELDS ------------------------------ | |
9 | + | |
10 | + private boolean allDay; | |
8 | 11 | |
9 | - private String eventId; | |
10 | 12 | private int dayDelta; |
13 | + | |
14 | + private String eventId; | |
15 | + | |
11 | 16 | private int minuteDelta; |
12 | - private boolean allDay; | |
17 | + | |
18 | +// --------------------------- CONSTRUCTORS --------------------------- | |
13 | 19 | |
14 | 20 | public ScheduleItemMoveEvent(UIComponent component, String eventId, int dayDelta, int minuteDelta, boolean allDay) { |
15 | 21 | super(component); |
... | ... | @@ -19,22 +25,16 @@ public class ScheduleItemMoveEvent extends FacesEvent { |
19 | 25 | this.allDay = allDay; |
20 | 26 | } |
21 | 27 | |
22 | - public boolean isAppropriateListener(FacesListener facesListener) { | |
23 | - return facesListener instanceof ScheduleItemMoveListener; | |
24 | - } | |
28 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
25 | 29 | |
26 | - public void processListener(FacesListener facesListener) { | |
27 | - ((ScheduleItemMoveListener) facesListener).itemMove(this); | |
30 | + public int getDayDelta() { | |
31 | + return dayDelta; | |
28 | 32 | } |
29 | 33 | |
30 | 34 | public String getEventId() { |
31 | 35 | return eventId; |
32 | 36 | } |
33 | 37 | |
34 | - public int getDayDelta() { | |
35 | - return dayDelta; | |
36 | - } | |
37 | - | |
38 | 38 | public int getMinuteDelta() { |
39 | 39 | return minuteDelta; |
40 | 40 | } |
... | ... | @@ -43,9 +43,21 @@ public class ScheduleItemMoveEvent extends FacesEvent { |
43 | 43 | return allDay; |
44 | 44 | } |
45 | 45 | |
46 | +// ------------------------ CANONICAL METHODS ------------------------ | |
47 | + | |
46 | 48 | @Override |
47 | 49 | public String toString() { |
48 | 50 | return getClass().getSimpleName() + "[eventId=" + eventId + ";dayDelta=" + dayDelta |
49 | 51 | + ";minuteDelta=" + minuteDelta + ";allDay=" + allDay + "]"; |
50 | 52 | } |
53 | + | |
54 | +// -------------------------- OTHER METHODS -------------------------- | |
55 | + | |
56 | + public boolean isAppropriateListener(FacesListener facesListener) { | |
57 | + return facesListener instanceof ScheduleItemMoveListener; | |
58 | + } | |
59 | + | |
60 | + public void processListener(FacesListener facesListener) { | |
61 | + ((ScheduleItemMoveListener) facesListener).itemMove(this); | |
62 | + } | |
51 | 63 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleItemMoveListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | void itemMove(ScheduleItemMoveEvent event); |
8 | 9 | } | ... | ... |
... | ... | @@ -5,11 +5,16 @@ import javax.faces.event.FacesEvent; |
5 | 5 | import javax.faces.event.FacesListener; |
6 | 6 | |
7 | 7 | public class ScheduleItemResizeEvent extends FacesEvent { |
8 | +// ------------------------------ FIELDS ------------------------------ | |
8 | 9 | |
9 | - private String eventId; | |
10 | 10 | private int dayDelta; |
11 | + | |
12 | + private String eventId; | |
13 | + | |
11 | 14 | private int minuteDelta; |
12 | 15 | |
16 | +// --------------------------- CONSTRUCTORS --------------------------- | |
17 | + | |
13 | 18 | public ScheduleItemResizeEvent(UIComponent component, String eventId, int dayDelta, int minuteDelta) { |
14 | 19 | super(component); |
15 | 20 | this.eventId = eventId; |
... | ... | @@ -17,29 +22,35 @@ public class ScheduleItemResizeEvent extends FacesEvent { |
17 | 22 | this.minuteDelta = minuteDelta; |
18 | 23 | } |
19 | 24 | |
20 | - public boolean isAppropriateListener(FacesListener facesListener) { | |
21 | - return facesListener instanceof ScheduleItemResizeListener; | |
22 | - } | |
25 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
23 | 26 | |
24 | - public void processListener(FacesListener facesListener) { | |
25 | - ((ScheduleItemResizeListener) facesListener).itemResize(this); | |
27 | + public int getDayDelta() { | |
28 | + return dayDelta; | |
26 | 29 | } |
27 | 30 | |
28 | 31 | public String getEventId() { |
29 | 32 | return eventId; |
30 | 33 | } |
31 | 34 | |
32 | - public int getDayDelta() { | |
33 | - return dayDelta; | |
34 | - } | |
35 | - | |
36 | 35 | public int getMinuteDelta() { |
37 | 36 | return minuteDelta; |
38 | 37 | } |
39 | 38 | |
39 | +// ------------------------ CANONICAL METHODS ------------------------ | |
40 | + | |
40 | 41 | @Override |
41 | 42 | public String toString() { |
42 | 43 | return getClass().getSimpleName() + "[eventId=" + eventId + ";dayDelta=" + dayDelta |
43 | 44 | + ";minuteDelta=" + minuteDelta + "]"; |
44 | 45 | } |
46 | + | |
47 | +// -------------------------- OTHER METHODS -------------------------- | |
48 | + | |
49 | + public boolean isAppropriateListener(FacesListener facesListener) { | |
50 | + return facesListener instanceof ScheduleItemResizeListener; | |
51 | + } | |
52 | + | |
53 | + public void processListener(FacesListener facesListener) { | |
54 | + ((ScheduleItemResizeListener) facesListener).itemResize(this); | |
55 | + } | |
45 | 56 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleItemResizeListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | void itemResize(ScheduleItemResizeEvent event); |
8 | 9 | } | ... | ... |
... | ... | @@ -5,28 +5,37 @@ import javax.faces.event.FacesEvent; |
5 | 5 | import javax.faces.event.FacesListener; |
6 | 6 | |
7 | 7 | public class ScheduleItemSelectEvent extends FacesEvent { |
8 | +// ------------------------------ FIELDS ------------------------------ | |
8 | 9 | |
9 | 10 | private String eventId; |
10 | 11 | |
12 | +// --------------------------- CONSTRUCTORS --------------------------- | |
13 | + | |
11 | 14 | public ScheduleItemSelectEvent(UIComponent component, String eventId) { |
12 | 15 | super(component); |
13 | 16 | this.eventId = eventId; |
14 | 17 | } |
15 | 18 | |
16 | - public boolean isAppropriateListener(FacesListener facesListener) { | |
17 | - return facesListener instanceof ScheduleItemSelectListener; | |
18 | - } | |
19 | - | |
20 | - public void processListener(FacesListener facesListener) { | |
21 | - ((ScheduleItemSelectListener) facesListener).itemSelected(this); | |
22 | - } | |
19 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
23 | 20 | |
24 | 21 | public String getEventId() { |
25 | 22 | return eventId; |
26 | 23 | } |
27 | 24 | |
25 | +// ------------------------ CANONICAL METHODS ------------------------ | |
26 | + | |
28 | 27 | @Override |
29 | 28 | public String toString() { |
30 | 29 | return getClass().getSimpleName() + "[eventId=" + eventId + "]"; |
31 | 30 | } |
31 | + | |
32 | +// -------------------------- OTHER METHODS -------------------------- | |
33 | + | |
34 | + public boolean isAppropriateListener(FacesListener facesListener) { | |
35 | + return facesListener instanceof ScheduleItemSelectListener; | |
36 | + } | |
37 | + | |
38 | + public void processListener(FacesListener facesListener) { | |
39 | + ((ScheduleItemSelectListener) facesListener).itemSelected(this); | |
40 | + } | |
32 | 41 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleItemSelectListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | public void itemSelected(ScheduleItemSelectEvent event); |
8 | 9 | } | ... | ... |
1 | 1 | package org.richfaces.component.event; |
2 | 2 | |
3 | 3 | public interface ScheduleListenerEventsProducer { |
4 | +// -------------------------- OTHER METHODS -------------------------- | |
4 | 5 | |
5 | - void addItemSelectListener(ScheduleItemSelectListener listener); | |
6 | + void addDateRangeChangeListener(ScheduleDateRangeChangeListener listener); | |
6 | 7 | |
7 | - void removeItemSelectListener(ScheduleItemSelectListener listener); | |
8 | + void addDateRangeSelectListener(ScheduleDateRangeSelectListener listener); | |
8 | 9 | |
9 | - ScheduleItemSelectListener[] getItemSelectListeners(); | |
10 | + void addDateSelectListener(ScheduleDateSelectListener listener); | |
10 | 11 | |
11 | 12 | void addItemMoveListener(ScheduleItemMoveListener listener); |
12 | 13 | |
13 | - void removeItemMoveListener(ScheduleItemMoveListener listener); | |
14 | - | |
15 | - ScheduleItemMoveListener[] getItemMoveListeners(); | |
16 | - | |
17 | 14 | void addItemResizeListener(ScheduleItemResizeListener listener); |
18 | 15 | |
19 | - void removeItemResizeListener(ScheduleItemResizeListener listener); | |
20 | - | |
21 | - ScheduleItemResizeListener[] getItemResizeListeners(); | |
16 | + void addItemSelectListener(ScheduleItemSelectListener listener); | |
22 | 17 | |
23 | 18 | void addViewChangeListener(ScheduleViewChangeListener listener); |
24 | 19 | |
25 | - void removeViewChangeListener(ScheduleViewChangeListener listener); | |
20 | + ScheduleDateRangeChangeListener[] getDateRangeChangeListeners(); | |
26 | 21 | |
27 | - ScheduleViewChangeListener[] getViewChangeListeners(); | |
22 | + ScheduleDateRangeSelectListener[] getDateRangeSelectListeners(); | |
28 | 23 | |
29 | - void addDateRangeChangeListener(ScheduleDateRangeChangeListener listener); | |
24 | + ScheduleDateSelectListener[] getDateSelectListeners(); | |
30 | 25 | |
31 | - void removeDateRangeChangeListener(ScheduleDateRangeChangeListener listener); | |
26 | + ScheduleItemMoveListener[] getItemMoveListeners(); | |
32 | 27 | |
33 | - ScheduleDateRangeChangeListener[] getDateRangeChangeListeners(); | |
28 | + ScheduleItemResizeListener[] getItemResizeListeners(); | |
34 | 29 | |
35 | - void addDateRangeSelectListener(ScheduleDateRangeSelectListener listener); | |
30 | + ScheduleItemSelectListener[] getItemSelectListeners(); | |
36 | 31 | |
37 | - void removeDateRangeSelectListener(ScheduleDateRangeSelectListener listener); | |
32 | + ScheduleViewChangeListener[] getViewChangeListeners(); | |
38 | 33 | |
39 | - ScheduleDateRangeSelectListener[] getDateRangeSelectListeners(); | |
34 | + void removeDateRangeChangeListener(ScheduleDateRangeChangeListener listener); | |
40 | 35 | |
41 | - void addDateSelectListener(ScheduleDateSelectListener listener); | |
36 | + void removeDateRangeSelectListener(ScheduleDateRangeSelectListener listener); | |
42 | 37 | |
43 | 38 | void removeDateSelectListener(ScheduleDateSelectListener listener); |
44 | 39 | |
45 | - ScheduleDateSelectListener[] getDateSelectListeners(); | |
40 | + void removeItemMoveListener(ScheduleItemMoveListener listener); | |
41 | + | |
42 | + void removeItemResizeListener(ScheduleItemResizeListener listener); | |
43 | + | |
44 | + void removeItemSelectListener(ScheduleItemSelectListener listener); | |
45 | + | |
46 | + void removeViewChangeListener(ScheduleViewChangeListener listener); | |
46 | 47 | } | ... | ... |
... | ... | @@ -5,28 +5,37 @@ import javax.faces.event.FacesEvent; |
5 | 5 | import javax.faces.event.FacesListener; |
6 | 6 | |
7 | 7 | public class ScheduleViewChangeEvent extends FacesEvent { |
8 | +// ------------------------------ FIELDS ------------------------------ | |
8 | 9 | |
9 | 10 | private String view; |
10 | 11 | |
12 | +// --------------------------- CONSTRUCTORS --------------------------- | |
13 | + | |
11 | 14 | public ScheduleViewChangeEvent(UIComponent component, String view) { |
12 | 15 | super(component); |
13 | 16 | this.view = view; |
14 | 17 | } |
15 | 18 | |
16 | - public boolean isAppropriateListener(FacesListener facesListener) { | |
17 | - return facesListener instanceof ScheduleViewChangeListener; | |
18 | - } | |
19 | - | |
20 | - public void processListener(FacesListener facesListener) { | |
21 | - ((ScheduleViewChangeListener) facesListener).viewChanged(this); | |
22 | - } | |
19 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
23 | 20 | |
24 | 21 | public String getView() { |
25 | 22 | return view; |
26 | 23 | } |
27 | 24 | |
25 | +// ------------------------ CANONICAL METHODS ------------------------ | |
26 | + | |
28 | 27 | @Override |
29 | 28 | public String toString() { |
30 | 29 | return getClass().getSimpleName() + "[view=" + view + "]"; |
31 | 30 | } |
31 | + | |
32 | +// -------------------------- OTHER METHODS -------------------------- | |
33 | + | |
34 | + public boolean isAppropriateListener(FacesListener facesListener) { | |
35 | + return facesListener instanceof ScheduleViewChangeListener; | |
36 | + } | |
37 | + | |
38 | + public void processListener(FacesListener facesListener) { | |
39 | + ((ScheduleViewChangeListener) facesListener).viewChanged(this); | |
40 | + } | |
32 | 41 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.richfaces.component.event; |
3 | 3 | import javax.faces.event.FacesListener; |
4 | 4 | |
5 | 5 | public interface ScheduleViewChangeListener extends FacesListener { |
6 | +// -------------------------- OTHER METHODS -------------------------- | |
6 | 7 | |
7 | 8 | void viewChanged(ScheduleViewChangeEvent event); |
8 | 9 | } | ... | ... |
... | ... | @@ -5,10 +5,14 @@ import org.ajax4jsf.model.Range; |
5 | 5 | import java.util.Date; |
6 | 6 | |
7 | 7 | public class DateRange implements Range { |
8 | +// ------------------------------ FIELDS ------------------------------ | |
8 | 9 | |
9 | - private Date startDate; | |
10 | 10 | private Date endDate; |
11 | 11 | |
12 | + private Date startDate; | |
13 | + | |
14 | +// --------------------------- CONSTRUCTORS --------------------------- | |
15 | + | |
12 | 16 | public DateRange() { |
13 | 17 | } |
14 | 18 | |
... | ... | @@ -17,13 +21,7 @@ public class DateRange implements Range { |
17 | 21 | setEndDate(endDate); |
18 | 22 | } |
19 | 23 | |
20 | - public Date getStartDate() { | |
21 | - return startDate; | |
22 | - } | |
23 | - | |
24 | - public void setStartDate(Date startDate) { | |
25 | - this.startDate = startDate; | |
26 | - } | |
24 | +// --------------------- GETTER / SETTER METHODS --------------------- | |
27 | 25 | |
28 | 26 | public Date getEndDate() { |
29 | 27 | return endDate; |
... | ... | @@ -32,4 +30,12 @@ public class DateRange implements Range { |
32 | 30 | public void setEndDate(Date endDate) { |
33 | 31 | this.endDate = endDate; |
34 | 32 | } |
33 | + | |
34 | + public Date getStartDate() { | |
35 | + return startDate; | |
36 | + } | |
37 | + | |
38 | + public void setStartDate(Date startDate) { | |
39 | + this.startDate = startDate; | |
40 | + } | |
35 | 41 | } | ... | ... |
... | ... | @@ -35,6 +35,13 @@ import java.util.Locale; |
35 | 35 | import java.util.Map; |
36 | 36 | |
37 | 37 | public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
38 | +// ------------------------------ FIELDS ------------------------------ | |
39 | + | |
40 | + public static final String DATE_RANGE_CHANGE_EVENT = "dateRangeChange"; | |
41 | + | |
42 | + public static final String DATE_RANGE_SELECT_EVENT = "dateRangeSelect"; | |
43 | + | |
44 | + public static final String DATE_SELECT_EVENT = "dateSelect"; | |
38 | 45 | |
39 | 46 | public static final String ITEM_MOVE_EVENT = "itemMove"; |
40 | 47 | |
... | ... | @@ -42,33 +49,29 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
42 | 49 | |
43 | 50 | public static final String ITEM_SELECT_EVENT = "itemSelect"; |
44 | 51 | |
45 | - public static final String DATE_RANGE_CHANGE_EVENT = "dateRangeChange"; | |
46 | - | |
47 | 52 | public static final String VIEW_CHANGE_EVENT = "viewChange"; |
48 | 53 | |
49 | - public static final String DATE_SELECT_EVENT = "dateSelect"; | |
50 | - | |
51 | - public static final String DATE_RANGE_SELECT_EVENT = "dateRangeSelect"; | |
54 | + private static final String ALL_DAY_PARAM = "allDay"; | |
52 | 55 | |
53 | 56 | private static final String CALLBACK = "callback"; |
54 | 57 | |
58 | + private static final String DAY_DELTA_PARAM = "dayDelta"; | |
59 | + | |
60 | + private static final Map<String, Object> DEFAULTS; | |
61 | + | |
55 | 62 | private static final String END_DATE_PARAM = "endDate"; |
56 | 63 | |
57 | - private static final String START_DATE_PARAM = "startDate"; | |
64 | + private static final String EVENT_TYPE_PARAM = "eventType"; | |
58 | 65 | |
59 | 66 | private static final String ITEM_ID_PARAM = "itemId"; |
60 | 67 | |
61 | - private static final String DAY_DELTA_PARAM = "dayDelta"; | |
62 | - | |
63 | 68 | private static final String MINUTE_DELTA_PARAM = "minuteDelta"; |
64 | 69 | |
65 | - private static final String ALL_DAY_PARAM = "allDay"; | |
66 | - | |
67 | - private static final String EVENT_TYPE_PARAM = "eventType"; | |
70 | + private static final String START_DATE_PARAM = "startDate"; | |
68 | 71 | |
69 | 72 | private static final String VIEW_PARAM = "view"; |
70 | 73 | |
71 | - private static final Map<String, Object> DEFAULTS; | |
74 | +// -------------------------- STATIC METHODS -------------------------- | |
72 | 75 | |
73 | 76 | /** |
74 | 77 | * Following defaults are be used by addOptionIfSetAndNotDefault |
... | ... | @@ -119,6 +122,15 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
119 | 122 | DEFAULTS = Collections.unmodifiableMap(defaults); |
120 | 123 | } |
121 | 124 | |
125 | + private static void copyAttribute(String attribute, String suffix, UIComponent source, UIComponent target) { | |
126 | + Object value = source.getAttributes().get(attribute); | |
127 | + if (value != null) { | |
128 | + target.getAttributes().put(attribute + suffix, value); | |
129 | + } | |
130 | + } | |
131 | + | |
132 | +// -------------------------- OTHER METHODS -------------------------- | |
133 | + | |
122 | 134 | @Override |
123 | 135 | public void decode(FacesContext context, UIComponent component) { |
124 | 136 | if (!component.isRendered()) { |
... | ... | @@ -198,6 +210,26 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
198 | 210 | null); |
199 | 211 | } |
200 | 212 | |
213 | + private void addOptionHash(String attribute, UIComponent source, Map<String, Object> options) { | |
214 | + Map<String, Object> hash = new HashMap<String, Object>(3); | |
215 | + Map<String, Object> attributes = source.getAttributes(); | |
216 | + addOptionIfSetAndNotDefault("month", attributes.get(attribute + "Month"), hash); | |
217 | + addOptionIfSetAndNotDefault("basicWeek", attributes.get(attribute + "BasicWeek"), hash); | |
218 | + addOptionIfSetAndNotDefault("agendaWeek", attributes.get(attribute + "AgendaWeek"), hash); | |
219 | + addOptionIfSetAndNotDefault("basicDay", attributes.get(attribute + "BasicDay"), hash); | |
220 | + addOptionIfSetAndNotDefault("agendaDay", attributes.get(attribute + "AgendaDay"), hash); | |
221 | + addOptionIfSetAndNotDefault("", attributes.get(attribute), hash); | |
222 | + if (hash.size() > 0) { | |
223 | + options.put(attribute, hash); | |
224 | + } | |
225 | + } | |
226 | + | |
227 | + protected void addOptionIfSetAndNotDefault(String optionName, Object value, Map<String, Object> options) { | |
228 | + if (value != null && !"".equals(value) && !value.equals(DEFAULTS.get(optionName))) { | |
229 | + options.put(optionName, value); | |
230 | + } | |
231 | + } | |
232 | + | |
201 | 233 | protected Object createSubmitEventFunction(FacesContext context, UISchedule component) { |
202 | 234 | JSFunction jsFunction; |
203 | 235 | Map<String, Object> params = new HashMap<String, Object>(); |
... | ... | @@ -229,6 +261,10 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
229 | 261 | END_DATE_PARAM, DAY_DELTA_PARAM, MINUTE_DELTA_PARAM, ALL_DAY_PARAM, CALLBACK).addToBody(jsFunction); |
230 | 262 | } |
231 | 263 | |
264 | + protected String getFieldId(FacesContext context, UISchedule component, String attribute) { | |
265 | + return getUtils().clientId(context, component) + NamingContainer.SEPARATOR_CHAR + attribute; | |
266 | + } | |
267 | + | |
232 | 268 | protected Map<String, Object> getOptions(UISchedule schedule) throws IOException { |
233 | 269 | /** |
234 | 270 | * Copy attributes from child view components |
... | ... | @@ -355,16 +391,6 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
355 | 391 | return options; |
356 | 392 | } |
357 | 393 | |
358 | - protected void addOptionIfSetAndNotDefault(String optionName, Object value, Map<String, Object> options) { | |
359 | - if (value != null && !"".equals(value) && !value.equals(DEFAULTS.get(optionName))) { | |
360 | - options.put(optionName, value); | |
361 | - } | |
362 | - } | |
363 | - | |
364 | - protected String getFieldId(FacesContext context, UISchedule component, String attribute) { | |
365 | - return getUtils().clientId(context, component) + NamingContainer.SEPARATOR_CHAR + attribute; | |
366 | - } | |
367 | - | |
368 | 394 | protected boolean isAjaxMode(UISchedule component) { |
369 | 395 | String mode = component.getSwitchType(); |
370 | 396 | return UISchedule.SWITCH_TYPE_AJAX.equals(mode) || "".equals(mode) || null == mode; |
... | ... | @@ -374,25 +400,4 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { |
374 | 400 | String mode = component.getSwitchType(); |
375 | 401 | return UISchedule.SWITCH_TYPE_CLIENT.equals(mode); |
376 | 402 | } |
377 | - | |
378 | - private void addOptionHash(String attribute, UIComponent source, Map<String, Object> options) { | |
379 | - Map<String, Object> hash = new HashMap<String, Object>(3); | |
380 | - Map<String, Object> attributes = source.getAttributes(); | |
381 | - addOptionIfSetAndNotDefault("month", attributes.get(attribute + "Month"), hash); | |
382 | - addOptionIfSetAndNotDefault("basicWeek", attributes.get(attribute + "BasicWeek"), hash); | |
383 | - addOptionIfSetAndNotDefault("agendaWeek", attributes.get(attribute + "AgendaWeek"), hash); | |
384 | - addOptionIfSetAndNotDefault("basicDay", attributes.get(attribute + "BasicDay"), hash); | |
385 | - addOptionIfSetAndNotDefault("agendaDay", attributes.get(attribute + "AgendaDay"), hash); | |
386 | - addOptionIfSetAndNotDefault("", attributes.get(attribute), hash); | |
387 | - if (hash.size() > 0) { | |
388 | - options.put(attribute, hash); | |
389 | - } | |
390 | - } | |
391 | - | |
392 | - private static void copyAttribute(String attribute, String suffix, UIComponent source, UIComponent target) { | |
393 | - Object value = source.getAttributes().get(attribute); | |
394 | - if (value != null) { | |
395 | - target.getAttributes().put(attribute + suffix, value); | |
396 | - } | |
397 | - } | |
398 | 403 | } | ... | ... |
... | ... | @@ -16,11 +16,19 @@ import java.util.MissingResourceException; |
16 | 16 | import java.util.ResourceBundle; |
17 | 17 | |
18 | 18 | public class ScheduleMessages extends ClientScript { |
19 | +// ------------------------------ FIELDS ------------------------------ | |
19 | 20 | |
20 | 21 | public static final String BUNDLE_NAME = "org.richfaces.component.UIScheduleMessages"; |
21 | - private static final String MESSAGE_KEY_BASE = "org.richfaces.component.UISchedule."; | |
22 | + | |
22 | 23 | private static final Log LOG = LogFactory.getLog(ScheduleMessages.class); |
23 | 24 | |
25 | + private static final String MESSAGE_KEY_BASE = "org.richfaces.component.UISchedule."; | |
26 | + | |
27 | +// ------------------------ INTERFACE METHODS ------------------------ | |
28 | + | |
29 | + | |
30 | +// --------------------- Interface InternetResource --------------------- | |
31 | + | |
24 | 32 | @Override |
25 | 33 | public InputStream getResourceAsStream(ResourceContext context) { |
26 | 34 | //TODO how to access messages from here if user keeps them somewhere else? |
... | ... | @@ -63,6 +71,18 @@ public class ScheduleMessages extends ClientScript { |
63 | 71 | } |
64 | 72 | } |
65 | 73 | |
74 | + @Override | |
75 | + public boolean requireFacesContext() { | |
76 | + return true; | |
77 | + } | |
78 | + | |
79 | +// -------------------------- OTHER METHODS -------------------------- | |
80 | + | |
81 | + @Override | |
82 | + public String getJavaScript() { | |
83 | + return getClass().getCanonicalName(); | |
84 | + } | |
85 | + | |
66 | 86 | private void appendArray(StringBuilder out, ResourceBundle applicationBundle, ResourceBundle stockBundle, |
67 | 87 | String jsPropertyName, String prefix, String[] keys) { |
68 | 88 | String key; |
... | ... | @@ -93,6 +113,10 @@ public class ScheduleMessages extends ClientScript { |
93 | 113 | out.append("}"); |
94 | 114 | } |
95 | 115 | |
116 | + private String escape(String message) { | |
117 | + return message.replaceAll("'", "\\\\'"); | |
118 | + } | |
119 | + | |
96 | 120 | private String getMessageFromBundle(String key, ResourceBundle applicationBundle, ResourceBundle stockBundle) { |
97 | 121 | try { |
98 | 122 | return applicationBundle.getString(key); |
... | ... | @@ -107,18 +131,4 @@ public class ScheduleMessages extends ClientScript { |
107 | 131 | } |
108 | 132 | } |
109 | 133 | } |
110 | - | |
111 | - private String escape(String message) { | |
112 | - return message.replaceAll("'", "\\\\'"); | |
113 | - } | |
114 | - | |
115 | - @Override | |
116 | - public String getJavaScript() { | |
117 | - return getClass().getCanonicalName(); | |
118 | - } | |
119 | - | |
120 | - @Override | |
121 | - public boolean requireFacesContext() { | |
122 | - return true; | |
123 | - } | |
124 | 134 | } | ... | ... |
... | ... | @@ -15,14 +15,22 @@ import javax.faces.component.UIComponent; |
15 | 15 | import javax.faces.el.MethodBinding; |
16 | 16 | |
17 | 17 | public class ScheduleTagHandlerBase extends ComponentHandler { |
18 | +// ------------------------------ FIELDS ------------------------------ | |
18 | 19 | |
19 | 20 | private final static String DATE_RANGE_CHANGED_LISTENER = "dateRangeChangeListener"; |
21 | + | |
20 | 22 | private final static String DATE_SELECTED_LISTENER = "dateSelectListener"; |
21 | - private final static String ITEM_RESIZE_LISTENER = "itemResizeListener"; | |
23 | + | |
22 | 24 | private final static String ITEM_MOVE_LISTENER = "itemMoveListener"; |
25 | + | |
26 | + private final static String ITEM_RESIZE_LISTENER = "itemResizeListener"; | |
27 | + | |
23 | 28 | private final static String ITEM_SELECTED_LISTENER = "itemSelectListener"; |
29 | + | |
24 | 30 | private final static String VIEW_CHANGED_LISTENER = "viewChangeListener"; |
25 | 31 | |
32 | +// --------------------------- CONSTRUCTORS --------------------------- | |
33 | + | |
26 | 34 | public ScheduleTagHandlerBase(ComponentConfig config) { |
27 | 35 | super(config); |
28 | 36 | } |
... | ... | @@ -32,11 +40,9 @@ public class ScheduleTagHandlerBase extends ComponentHandler { |
32 | 40 | MetaRuleset ruleset = super.createMetaRuleset(clazz); |
33 | 41 | |
34 | 42 | ruleset.addRule(new MetaRule() { |
35 | - | |
36 | 43 | public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget metadataTarget) { |
37 | 44 | if (DATE_RANGE_CHANGED_LISTENER.equals(name)) { |
38 | 45 | return new Metadata() { |
39 | - | |
40 | 46 | public void applyMetadata(FaceletContext context, Object object) { |
41 | 47 | MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[]{NodeExpandedEvent.class}); |
42 | 48 | ((UIComponent) object).getAttributes().put(DATE_RANGE_CHANGED_LISTENER, binding); |
... | ... | @@ -44,7 +50,6 @@ public class ScheduleTagHandlerBase extends ComponentHandler { |
44 | 50 | }; |
45 | 51 | } else if (DATE_SELECTED_LISTENER.equals(name)) { |
46 | 52 | return new Metadata() { |
47 | - | |
48 | 53 | public void applyMetadata(FaceletContext context, Object object) { |
49 | 54 | MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[]{NodeSelectedEvent.class}); |
50 | 55 | ((UIComponent) object).getAttributes().put(DATE_SELECTED_LISTENER, binding); |
... | ... | @@ -52,7 +57,6 @@ public class ScheduleTagHandlerBase extends ComponentHandler { |
52 | 57 | }; |
53 | 58 | } else if (ITEM_RESIZE_LISTENER.equals(name)) { |
54 | 59 | return new Metadata() { |
55 | - | |
56 | 60 | public void applyMetadata(FaceletContext context, Object object) { |
57 | 61 | MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[]{NodeSelectedEvent.class}); |
58 | 62 | ((UIComponent) object).getAttributes().put(ITEM_RESIZE_LISTENER, binding); |
... | ... | @@ -60,7 +64,6 @@ public class ScheduleTagHandlerBase extends ComponentHandler { |
60 | 64 | }; |
61 | 65 | } else if (ITEM_MOVE_LISTENER.equals(name)) { |
62 | 66 | return new Metadata() { |
63 | - | |
64 | 67 | public void applyMetadata(FaceletContext context, Object object) { |
65 | 68 | MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[]{NodeSelectedEvent.class}); |
66 | 69 | ((UIComponent) object).getAttributes().put(ITEM_MOVE_LISTENER, binding); |
... | ... | @@ -68,7 +71,6 @@ public class ScheduleTagHandlerBase extends ComponentHandler { |
68 | 71 | }; |
69 | 72 | } else if (ITEM_SELECTED_LISTENER.equals(name)) { |
70 | 73 | return new Metadata() { |
71 | - | |
72 | 74 | public void applyMetadata(FaceletContext context, Object object) { |
73 | 75 | MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[]{NodeSelectedEvent.class}); |
74 | 76 | ((UIComponent) object).getAttributes().put(ITEM_SELECTED_LISTENER, binding); |
... | ... | @@ -76,7 +78,6 @@ public class ScheduleTagHandlerBase extends ComponentHandler { |
76 | 78 | }; |
77 | 79 | } else if (VIEW_CHANGED_LISTENER.equals(name)) { |
78 | 80 | return new Metadata() { |
79 | - | |
80 | 81 | public void applyMetadata(FaceletContext context, Object object) { |
81 | 82 | MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[]{NodeSelectedEvent.class}); |
82 | 83 | ((UIComponent) object).getAttributes().put(VIEW_CHANGED_LISTENER, binding); | ... | ... |
Please
register
or
login
to post a comment