1 package org.rcfaces.core.component;
2
3 import java.util.TimeZone;
4 import org.rcfaces.core.internal.converter.LiteralDateConverter;
5 import org.rcfaces.core.internal.component.Properties;
6 import org.rcfaces.core.component.capability.ILiteralLocaleCapability;
7 import org.apache.commons.logging.LogFactory;
8 import org.rcfaces.core.component.capability.IWidthCapability;
9 import javax.faces.context.FacesContext;
10 import org.rcfaces.core.component.capability.IImmediateCapability;
11 import org.rcfaces.core.internal.util.ComponentIterators;
12 import org.rcfaces.core.internal.converter.TimeZoneConverter;
13 import org.rcfaces.core.internal.component.CameliaBaseComponent;
14 import org.apache.commons.logging.Log;
15 import org.rcfaces.core.internal.converter.LocaleConverter;
16 import java.util.Locale;
17 import java.util.Set;
18 import org.rcfaces.core.component.capability.IScrollableCapability;
19 import org.rcfaces.core.component.capability.ISelectionEventCapability;
20 import java.util.List;
21 import java.lang.String;
22 import java.util.Date;
23 import org.rcfaces.core.component.capability.ITabIndexCapability;
24 import org.rcfaces.core.component.capability.IHeightCapability;
25 import org.rcfaces.core.lang.Time;
26 import javax.el.ValueExpression;
27 import org.rcfaces.core.component.capability.ILiteralTimeZoneCapability;
28 import java.util.HashSet;
29 import org.rcfaces.core.component.capability.IStyleClassCapability;
30 import org.rcfaces.core.internal.converter.LiteralTimeConverter;
31 import java.util.Arrays;
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 public class SchedulerComponent extends CameliaBaseComponent implements
69 IWidthCapability,
70 IHeightCapability,
71 IScrollableCapability,
72 ILiteralLocaleCapability,
73 ILiteralTimeZoneCapability,
74 IStyleClassCapability,
75 ITabIndexCapability,
76 IImmediateCapability,
77 ISelectionEventCapability {
78
79 private static final Log LOG = LogFactory.getLog(SchedulerComponent.class);
80
81 public static final String COMPONENT_TYPE="org.rcfaces.core.scheduler";
82
83 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaBaseComponent.CAMELIA_ATTRIBUTES);
84 static {
85 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"hourBegin","secondaryTick","periods","var","tabIndex","selectionListener","literalLocale","height","periodStyle","verticalScrollPosition","showSecondaryTickLabel","periodEnd","periodToolTip","literalTimeZone","hourEnd","periodSelectable","periodLabel","primaryTick","periodValue","styleClass","width","showPrimaryTickLabel","dateBegin","horizontalScrollPosition","immediate","periodType","periodBegin"}));
86 }
87
88 public SchedulerComponent() {
89 setRendererType(COMPONENT_TYPE);
90 }
91
92 public SchedulerComponent(String componentId) {
93 this();
94 setId(componentId);
95 }
96
97 public void setDateBegin(String date) {
98
99
100 engine.setProperty(Properties.DATE_BEGIN, date);
101
102 }
103
104 public Date getDateBegin(FacesContext facesContext) {
105
106
107 Object value=engine.getProperty(Properties.DATE_BEGIN, facesContext);
108 if (value instanceof String) {
109 value=LiteralDateConverter.SINGLETON.getAsObject(facesContext, this, (String)value);
110 }
111
112 return (Date)value;
113
114 }
115
116 public void setHourBegin(String time) {
117
118
119 Time timeValue=(Time)LiteralTimeConverter.SINGLETON.getAsObject(null, this, time);
120 setHourBegin(timeValue);
121
122 }
123
124 public void setHourEnd(String time) {
125
126
127 Time timeValue=(Time)LiteralTimeConverter.SINGLETON.getAsObject(null, this, time);
128 setHourEnd(timeValue);
129
130 }
131
132 public void setPeriodBegin(String date) {
133
134
135 engine.setProperty(Properties.PERIOD_BEGIN, date);
136
137 }
138
139 public Date getPeriodBegin(FacesContext facesContext) {
140
141
142 Object value=engine.getProperty(Properties.PERIOD_BEGIN, facesContext);
143 if (value instanceof String) {
144 value=LiteralDateConverter.SINGLETON.getAsObject(facesContext, this, (String)value);
145 }
146
147 return (Date)value;
148
149 }
150
151 public void setPeriodEnd(String date) {
152
153
154 engine.setProperty(Properties.PERIOD_END, date);
155
156 }
157
158 public Date getPeriodEnd(FacesContext facesContext) {
159
160
161 Object value=engine.getProperty(Properties.PERIOD_END, facesContext);
162 if (value instanceof String) {
163 value=LiteralDateConverter.SINGLETON.getAsObject(facesContext, this, (String)value);
164 }
165
166 return (Date)value;
167
168 }
169
170 public void setLiteralLocale(String locale) {
171
172
173 setLiteralLocale((Locale)LocaleConverter.SINGLETON.getAsObject(null, this, locale));
174
175 }
176
177 public void setLiteralTimeZone(String timeZone) {
178
179
180 setLiteralTimeZone((TimeZone)TimeZoneConverter.SINGLETON.getAsObject(null, this, timeZone));
181
182 }
183
184 public List getSchedulerColumn() {
185
186
187 return ComponentIterators.list(this, SchedulerColumnComponent.class);
188
189 }
190
191 public List getPeriodClientData() {
192
193
194 return ComponentIterators.list(this, PeriodClientDataComponent.class);
195
196 }
197
198 public java.lang.String getWidth() {
199 return getWidth(null);
200 }
201
202
203
204
205 public java.lang.String getWidth(javax.faces.context.FacesContext facesContext) {
206 return engine.getStringProperty(Properties.WIDTH, facesContext);
207 }
208
209
210
211
212
213 public final boolean isWidthSetted() {
214 return engine.isPropertySetted(Properties.WIDTH);
215 }
216
217 public void setWidth(java.lang.String width) {
218 engine.setProperty(Properties.WIDTH, width);
219 }
220
221 public java.lang.String getHeight() {
222 return getHeight(null);
223 }
224
225
226
227
228 public java.lang.String getHeight(javax.faces.context.FacesContext facesContext) {
229 return engine.getStringProperty(Properties.HEIGHT, facesContext);
230 }
231
232
233
234
235
236 public final boolean isHeightSetted() {
237 return engine.isPropertySetted(Properties.HEIGHT);
238 }
239
240 public void setHeight(java.lang.String height) {
241 engine.setProperty(Properties.HEIGHT, height);
242 }
243
244 public int getHorizontalScrollPosition() {
245 return getHorizontalScrollPosition(null);
246 }
247
248
249
250
251 public int getHorizontalScrollPosition(javax.faces.context.FacesContext facesContext) {
252 return engine.getIntProperty(Properties.HORIZONTAL_SCROLL_POSITION,0, facesContext);
253 }
254
255
256
257
258
259 public final boolean isHorizontalScrollPositionSetted() {
260 return engine.isPropertySetted(Properties.HORIZONTAL_SCROLL_POSITION);
261 }
262
263 public void setHorizontalScrollPosition(int horizontalScrollPosition) {
264 engine.setProperty(Properties.HORIZONTAL_SCROLL_POSITION, horizontalScrollPosition);
265 }
266
267 public int getVerticalScrollPosition() {
268 return getVerticalScrollPosition(null);
269 }
270
271
272
273
274 public int getVerticalScrollPosition(javax.faces.context.FacesContext facesContext) {
275 return engine.getIntProperty(Properties.VERTICAL_SCROLL_POSITION,0, facesContext);
276 }
277
278
279
280
281
282 public final boolean isVerticalScrollPositionSetted() {
283 return engine.isPropertySetted(Properties.VERTICAL_SCROLL_POSITION);
284 }
285
286 public void setVerticalScrollPosition(int verticalScrollPosition) {
287 engine.setProperty(Properties.VERTICAL_SCROLL_POSITION, verticalScrollPosition);
288 }
289
290 public java.util.Locale getLiteralLocale() {
291 return getLiteralLocale(null);
292 }
293
294
295
296
297 public java.util.Locale getLiteralLocale(javax.faces.context.FacesContext facesContext) {
298 return (java.util.Locale)engine.getProperty(Properties.LITERAL_LOCALE, facesContext);
299 }
300
301
302
303
304
305 public final boolean isLiteralLocaleSetted() {
306 return engine.isPropertySetted(Properties.LITERAL_LOCALE);
307 }
308
309 public void setLiteralLocale(java.util.Locale literalLocale) {
310 engine.setProperty(Properties.LITERAL_LOCALE, literalLocale);
311 }
312
313 public java.util.TimeZone getLiteralTimeZone() {
314 return getLiteralTimeZone(null);
315 }
316
317
318
319
320 public java.util.TimeZone getLiteralTimeZone(javax.faces.context.FacesContext facesContext) {
321 return (java.util.TimeZone)engine.getProperty(Properties.LITERAL_TIME_ZONE, facesContext);
322 }
323
324
325
326
327
328 public final boolean isLiteralTimeZoneSetted() {
329 return engine.isPropertySetted(Properties.LITERAL_TIME_ZONE);
330 }
331
332 public void setLiteralTimeZone(java.util.TimeZone literalTimeZone) {
333 engine.setProperty(Properties.LITERAL_TIME_ZONE, literalTimeZone);
334 }
335
336 public java.lang.String getStyleClass() {
337 return getStyleClass(null);
338 }
339
340
341
342
343 public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
344 return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
345 }
346
347
348
349
350
351 public final boolean isStyleClassSetted() {
352 return engine.isPropertySetted(Properties.STYLE_CLASS);
353 }
354
355 public void setStyleClass(java.lang.String styleClass) {
356 engine.setProperty(Properties.STYLE_CLASS, styleClass);
357 }
358
359 public java.lang.Integer getTabIndex() {
360 return getTabIndex(null);
361 }
362
363
364
365
366 public java.lang.Integer getTabIndex(javax.faces.context.FacesContext facesContext) {
367 return engine.getIntegerProperty(Properties.TAB_INDEX, facesContext);
368 }
369
370
371
372
373
374 public final boolean isTabIndexSetted() {
375 return engine.isPropertySetted(Properties.TAB_INDEX);
376 }
377
378 public void setTabIndex(java.lang.Integer tabIndex) {
379 engine.setProperty(Properties.TAB_INDEX, tabIndex);
380 }
381
382 public boolean isImmediate() {
383 return isImmediate(null);
384 }
385
386
387
388
389 public boolean isImmediate(javax.faces.context.FacesContext facesContext) {
390 return engine.getBoolProperty(Properties.IMMEDIATE, false, facesContext);
391 }
392
393
394
395
396
397 public final boolean isImmediateSetted() {
398 return engine.isPropertySetted(Properties.IMMEDIATE);
399 }
400
401 public void setImmediate(boolean immediate) {
402 engine.setProperty(Properties.IMMEDIATE, immediate);
403 }
404
405 public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
406 addFacesListener(listener);
407 }
408
409 public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
410 removeFacesListener(listener);
411 }
412
413 public final javax.faces.event.FacesListener [] listSelectionListeners() {
414 return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
415 }
416
417 public java.util.Date getDateBegin() {
418 return getDateBegin(null);
419 }
420
421 public void setDateBegin(java.util.Date dateBegin) {
422 engine.setProperty(Properties.DATE_BEGIN, dateBegin);
423 }
424
425
426
427
428
429 public boolean isDateBeginSetted() {
430 return engine.isPropertySetted(Properties.DATE_BEGIN);
431 }
432
433 public org.rcfaces.core.lang.Time getHourBegin() {
434 return getHourBegin(null);
435 }
436
437 public org.rcfaces.core.lang.Time getHourBegin(javax.faces.context.FacesContext facesContext) {
438 return (org.rcfaces.core.lang.Time)engine.getValue(Properties.HOUR_BEGIN, facesContext);
439 }
440
441 public void setHourBegin(org.rcfaces.core.lang.Time hourBegin) {
442 engine.setProperty(Properties.HOUR_BEGIN, hourBegin);
443 }
444
445
446
447
448
449 public boolean isHourBeginSetted() {
450 return engine.isPropertySetted(Properties.HOUR_BEGIN);
451 }
452
453 public org.rcfaces.core.lang.Time getHourEnd() {
454 return getHourEnd(null);
455 }
456
457 public org.rcfaces.core.lang.Time getHourEnd(javax.faces.context.FacesContext facesContext) {
458 return (org.rcfaces.core.lang.Time)engine.getValue(Properties.HOUR_END, facesContext);
459 }
460
461 public void setHourEnd(org.rcfaces.core.lang.Time hourEnd) {
462 engine.setProperty(Properties.HOUR_END, hourEnd);
463 }
464
465
466
467
468
469 public boolean isHourEndSetted() {
470 return engine.isPropertySetted(Properties.HOUR_END);
471 }
472
473 public int getPrimaryTick() {
474 return getPrimaryTick(null);
475 }
476
477 public int getPrimaryTick(javax.faces.context.FacesContext facesContext) {
478 return engine.getIntProperty(Properties.PRIMARY_TICK, 0, facesContext);
479 }
480
481 public void setPrimaryTick(int primaryTick) {
482 engine.setProperty(Properties.PRIMARY_TICK, primaryTick);
483 }
484
485
486
487
488
489 public boolean isPrimaryTickSetted() {
490 return engine.isPropertySetted(Properties.PRIMARY_TICK);
491 }
492
493 public int getSecondaryTick() {
494 return getSecondaryTick(null);
495 }
496
497 public int getSecondaryTick(javax.faces.context.FacesContext facesContext) {
498 return engine.getIntProperty(Properties.SECONDARY_TICK, 0, facesContext);
499 }
500
501 public void setSecondaryTick(int secondaryTick) {
502 engine.setProperty(Properties.SECONDARY_TICK, secondaryTick);
503 }
504
505
506
507
508
509 public boolean isSecondaryTickSetted() {
510 return engine.isPropertySetted(Properties.SECONDARY_TICK);
511 }
512
513 public boolean isShowPrimaryTickLabel() {
514 return isShowPrimaryTickLabel(null);
515 }
516
517 public boolean isShowPrimaryTickLabel(javax.faces.context.FacesContext facesContext) {
518 return engine.getBoolProperty(Properties.SHOW_PRIMARY_TICK_LABEL, true, facesContext);
519 }
520
521 public void setShowPrimaryTickLabel(boolean showPrimaryTickLabel) {
522 engine.setProperty(Properties.SHOW_PRIMARY_TICK_LABEL, showPrimaryTickLabel);
523 }
524
525
526
527
528
529 public boolean isShowPrimaryTickLabelSetted() {
530 return engine.isPropertySetted(Properties.SHOW_PRIMARY_TICK_LABEL);
531 }
532
533 public boolean isShowSecondaryTickLabel() {
534 return isShowSecondaryTickLabel(null);
535 }
536
537 public boolean isShowSecondaryTickLabel(javax.faces.context.FacesContext facesContext) {
538 return engine.getBoolProperty(Properties.SHOW_SECONDARY_TICK_LABEL, false, facesContext);
539 }
540
541 public void setShowSecondaryTickLabel(boolean showSecondaryTickLabel) {
542 engine.setProperty(Properties.SHOW_SECONDARY_TICK_LABEL, showSecondaryTickLabel);
543 }
544
545
546
547
548
549 public boolean isShowSecondaryTickLabelSetted() {
550 return engine.isPropertySetted(Properties.SHOW_SECONDARY_TICK_LABEL);
551 }
552
553 public Object getPeriods() {
554 return getPeriods(null);
555 }
556
557 public Object getPeriods(javax.faces.context.FacesContext facesContext) {
558 return engine.getValue(Properties.PERIODS, facesContext);
559 }
560
561 public void setPeriods(Object periods) {
562 engine.setValue(Properties.PERIODS, periods);
563 }
564
565
566
567
568
569 public boolean isPeriodsSetted() {
570 return engine.isPropertySetted(Properties.PERIODS);
571 }
572
573 public java.util.Date getPeriodBegin() {
574 return getPeriodBegin(null);
575 }
576
577 public void setPeriodBegin(java.util.Date periodBegin) {
578 engine.setProperty(Properties.PERIOD_BEGIN, periodBegin);
579 }
580
581
582
583
584
585 public boolean isPeriodBeginSetted() {
586 return engine.isPropertySetted(Properties.PERIOD_BEGIN);
587 }
588
589 public java.util.Date getPeriodEnd() {
590 return getPeriodEnd(null);
591 }
592
593 public void setPeriodEnd(java.util.Date periodEnd) {
594 engine.setProperty(Properties.PERIOD_END, periodEnd);
595 }
596
597
598
599
600
601 public boolean isPeriodEndSetted() {
602 return engine.isPropertySetted(Properties.PERIOD_END);
603 }
604
605 public String getPeriodLabel() {
606 return getPeriodLabel(null);
607 }
608
609 public String getPeriodLabel(javax.faces.context.FacesContext facesContext) {
610 return engine.getStringProperty(Properties.PERIOD_LABEL, facesContext);
611 }
612
613 public void setPeriodLabel(String periodLabel) {
614 engine.setProperty(Properties.PERIOD_LABEL, periodLabel);
615 }
616
617
618
619
620
621 public boolean isPeriodLabelSetted() {
622 return engine.isPropertySetted(Properties.PERIOD_LABEL);
623 }
624
625 public String getPeriodStyle() {
626 return getPeriodStyle(null);
627 }
628
629 public String getPeriodStyle(javax.faces.context.FacesContext facesContext) {
630 return engine.getStringProperty(Properties.PERIOD_STYLE, facesContext);
631 }
632
633 public void setPeriodStyle(String periodStyle) {
634 engine.setProperty(Properties.PERIOD_STYLE, periodStyle);
635 }
636
637
638
639
640
641 public boolean isPeriodStyleSetted() {
642 return engine.isPropertySetted(Properties.PERIOD_STYLE);
643 }
644
645 public boolean isPeriodSelectable() {
646 return isPeriodSelectable(null);
647 }
648
649 public boolean isPeriodSelectable(javax.faces.context.FacesContext facesContext) {
650 return engine.getBoolProperty(Properties.PERIOD_SELECTABLE, false, facesContext);
651 }
652
653 public void setPeriodSelectable(boolean periodSelectable) {
654 engine.setProperty(Properties.PERIOD_SELECTABLE, periodSelectable);
655 }
656
657
658
659
660
661 public boolean isPeriodSelectableSetted() {
662 return engine.isPropertySetted(Properties.PERIOD_SELECTABLE);
663 }
664
665 public String getPeriodToolTip() {
666 return getPeriodToolTip(null);
667 }
668
669 public String getPeriodToolTip(javax.faces.context.FacesContext facesContext) {
670 return engine.getStringProperty(Properties.PERIOD_TOOL_TIP, facesContext);
671 }
672
673 public void setPeriodToolTip(String periodToolTip) {
674 engine.setProperty(Properties.PERIOD_TOOL_TIP, periodToolTip);
675 }
676
677
678
679
680
681 public boolean isPeriodToolTipSetted() {
682 return engine.isPropertySetted(Properties.PERIOD_TOOL_TIP);
683 }
684
685 public String getPeriodValue() {
686 return getPeriodValue(null);
687 }
688
689 public String getPeriodValue(javax.faces.context.FacesContext facesContext) {
690 return engine.getStringProperty(Properties.PERIOD_VALUE, facesContext);
691 }
692
693 public void setPeriodValue(String periodValue) {
694 engine.setProperty(Properties.PERIOD_VALUE, periodValue);
695 }
696
697
698
699
700
701 public boolean isPeriodValueSetted() {
702 return engine.isPropertySetted(Properties.PERIOD_VALUE);
703 }
704
705 public String getPeriodType() {
706 return getPeriodType(null);
707 }
708
709 public String getPeriodType(javax.faces.context.FacesContext facesContext) {
710 return engine.getStringProperty(Properties.PERIOD_TYPE, facesContext);
711 }
712
713 public void setPeriodType(String periodType) {
714 engine.setProperty(Properties.PERIOD_TYPE, periodType);
715 }
716
717
718
719
720
721 public boolean isPeriodTypeSetted() {
722 return engine.isPropertySetted(Properties.PERIOD_TYPE);
723 }
724
725 public String getVar() {
726 return getVar(null);
727 }
728
729 public String getVar(javax.faces.context.FacesContext facesContext) {
730 return engine.getStringProperty(Properties.VAR, facesContext);
731 }
732
733 public void setVar(String var) {
734 engine.setProperty(Properties.VAR, var);
735 }
736
737
738
739
740
741 public boolean isVarSetted() {
742 return engine.isPropertySetted(Properties.VAR);
743 }
744
745 protected Set getCameliaFields() {
746 return CAMELIA_ATTRIBUTES;
747 }
748 }