From 9f6252cae256469020f0878275fc2f6a85ee055c Mon Sep 17 00:00:00 2001 From: Bernard Labno Date: Mon, 28 Feb 2011 11:22:12 +0000 Subject: [PATCH] Added onviewdisplay javascript callback. --- src/main/config/component/schedule.xml | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/main/java/org/richfaces/component/UISchedule.java | 41 +++++++++++++++++++++++++++++++++++++++++ src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java | 17 +++++++++++++++++ src/main/resources/org/richfaces/renderkit/html/scripts/richfaces.schedule.js | 5 +++++ 4 files changed, 171 insertions(+), 195 deletions(-) diff --git a/src/main/config/component/schedule.xml b/src/main/config/component/schedule.xml index 8bda3db..c643db3 100644 --- a/src/main/config/component/schedule.xml +++ b/src/main/config/component/schedule.xml @@ -1,10 +1,6 @@ - - - - ] + [] > @@ -13,8 +9,7 @@ org.richfaces.component.html.HtmlSchedule org.richfaces.component.UISchedule - + org.richfaces.renderkit.ScheduleRenderer @@ -33,10 +28,7 @@ org.richfaces.taglib.ScheduleTagHandlerBase - &ui_component_attributes; - &commonViewAttributes; - &ajax_component_attributes; + --> &ui_component_attributes; &commonViewAttributes; &ajax_component_attributes; switchType java.lang.String @@ -54,8 +46,7 @@ widgetVar java.lang.String - Variable name of JavaScript component. - default: null + Variable name of JavaScript component. default: null null @@ -63,9 +54,7 @@ view java.lang.String - Schedule has a number of different "views", - or ways of displaying days and events. - The following 5 views are all built in to schedule: + Schedule has a number of different "views", or ways of displaying days and events. The following 5 views are all built in to schedule:
  • month
  • basicWeek
  • @@ -81,10 +70,8 @@ headerLeft java.lang.String - Defines the buttons and title at the top of the calendar. - Values separated by a comma will be displayed adjacently. - Values separated by a space will be displayed with a small gap in between. - Strings can contain any of the following values: + Defines the buttons and title at the top of the calendar. Values separated by a comma will be displayed adjacently. Values separated by a space + will be displayed with a small gap in between. Strings can contain any of the following values:
    • title @@ -123,10 +110,8 @@ headerCenter java.lang.String - Defines the buttons and title at the top of the calendar. - Values separated by a comma will be displayed adjacently. - Values separated by a space will be displayed with a small gap in between. - Strings can contain any of the following values: + Defines the buttons and title at the top of the calendar. Values separated by a comma will be displayed adjacently. Values separated by a space + will be displayed with a small gap in between. Strings can contain any of the following values:
      • title @@ -165,10 +150,8 @@ headerRight java.lang.String - Defines the buttons and title at the top of the calendar. - Values separated by a comma will be displayed adjacently. - Values separated by a space will be displayed with a small gap in between. - Strings can contain any of the following values: + Defines the buttons and title at the top of the calendar. Values separated by a comma will be displayed adjacently. Values separated by a space + will be displayed with a small gap in between. Strings can contain any of the following values:
        • title @@ -207,9 +190,8 @@ allDaySlot java.lang.Boolean - Determines if the "all-day" slot is displayed at the top of the calendar. - When hidden with false, all-day events will not be displayed in agenda views. - default: true + Determines if the "all-day" slot is displayed at the top of the calendar. When hidden with false, all-day events will not be displayed in agenda + views. default: true null @@ -217,8 +199,7 @@ allDayText java.lang.String - The text titling the "all-day" slot at the top of the calendar. - default: 'all-day' + The text titling the "all-day" slot at the top of the calendar. default: 'all-day' null @@ -226,9 +207,8 @@ axisFormat java.lang.String - Determines the time-text that will be displayed on the vertical axis of the agenda views. - The default value will produce times that look like "5pm" and "5:30pm". - default: 'h(:mm)tt' + Determines the time-text that will be displayed on the vertical axis of the agenda views. The default value will produce times that look like + "5pm" and "5:30pm". default: 'h(:mm)tt' null @@ -236,9 +216,7 @@ slotMinutes java.lang.Integer - The frequency for displaying time slots, in minutes. - The default will make a slot every half hour. - default: 30 + The frequency for displaying time slots, in minutes. The default will make a slot every half hour. default: 30 null @@ -246,10 +224,8 @@ defaultEventMinutes java.lang.Integer - Determines the length (in minutes) an event appears to be when it has an unspecified end date. - By default, if an Event Object has no end, it will appear to be 2 hours. - This option only affects events that appear in the agenda slots, meaning they have allDay set to true. - default: 120 + Determines the length (in minutes) an event appears to be when it has an unspecified end date. By default, if an Event Object has no end, it + will appear to be 2 hours. This option only affects events that appear in the agenda slots, meaning they have allDay set to true. default: 120 null @@ -257,11 +233,8 @@ firstHour java.lang.Integer - Determines the first hour that will be visible in the scroll pane. - Values must be from 0-23, where 0=midnight, 1=1am, etc. - The user will be able to scroll upwards to see events before this time. - If you want to prevent users from doing this, use the minTime option instead. - default: 6 + Determines the first hour that will be visible in the scroll pane. Values must be from 0-23, where 0=midnight, 1=1am, etc. The user will be able + to scroll upwards to see events before this time. If you want to prevent users from doing this, use the minTime option instead. default: 6 null @@ -269,11 +242,8 @@ minTime java.lang.String - Determines the first hour/time that will be displayed, even when the scrollbars have been scrolled all - the way up. - This can be a number like 5 (which means 5am), a string like '5:30' (which means 5:30am) or a string - like '5:30am'. - default: 0 + Determines the first hour/time that will be displayed, even when the scrollbars have been scrolled all the way up. This can be a number like 5 + (which means 5am), a string like '5:30' (which means 5:30am) or a string like '5:30am'. default: 0 null @@ -281,11 +251,8 @@ maxTime java.lang.String - Determines the last hour/time (exclusively) that will be displayed, even when the scrollbars have been - scrolled all the way down. - This can be a number like 22 (which means 10pm), a string like '22:30' (which means 10:30pm) or a string - like '10:30pm'. - default: 24 + Determines the last hour/time (exclusively) that will be displayed, even when the scrollbars have been scrolled all the way down. This can be a + number like 22 (which means 10pm), a string like '22:30' (which means 10:30pm) or a string like '10:30pm'. default: 24 null @@ -293,10 +260,7 @@ firstDay java.lang.Integer - The day that each week begins. - The value must be a number that represents the day of the week. - Sunday=0, Monday=1, Tuesday=2, etc. - default: 0 + The day that each week begins. The value must be a number that represents the day of the week. Sunday=0, Monday=1, Tuesday=2, etc. default: 0 null @@ -304,8 +268,7 @@ isRTL java.lang.Boolean - Displays the calendar in right-to-left mode. - default: false + Displays the calendar in right-to-left mode. default: false null @@ -313,8 +276,7 @@ showWeekends java.lang.Boolean - Whether to include Saturday/Sunday columns in any of the calendar views. - default: true + Whether to include Saturday/Sunday columns in any of the calendar views. default: true null @@ -322,8 +284,8 @@ height java.lang.Integer - Will make the entire calendar (including header) a pixel height. - By default, this option is unset and the calendar's height is calculated by aspectRatio. + Will make the entire calendar (including header) a pixel height. By default, this option is unset and the calendar's height is calculated by + aspectRatio. null @@ -331,8 +293,7 @@ contentHeight java.lang.Integer - Will make the calendar's content area a pixel height. - By default, this option is unset and the calendar's height is calculated by aspectRatio. + Will make the calendar's content area a pixel height. By default, this option is unset and the calendar's height is calculated by aspectRatio. null @@ -340,10 +301,8 @@ aspectRatio java.lang.Double - Determines the width-to-height aspect ratio of the calendar. - A calendar is a block-level element that fills its entire avaiable width. The calendar’s height, - however, is determined by this ratio of width-to-height. (Hint: larger numbers make smaller heights). - default: 1.35 + Determines the width-to-height aspect ratio of the calendar. A calendar is a block-level element that fills its entire avaiable width. The + calendar’s height, however, is determined by this ratio of width-to-height. (Hint: larger numbers make smaller heights). default: 1.35 null @@ -351,8 +310,7 @@ allDayByDefault java.lang.Boolean - Determines the default value for each Event Object's allDay property, when it is unspecified. - default: true + Determines the default value for each Event Object's allDay property, when it is unspecified. default: true null @@ -361,12 +319,9 @@ editable java.lang.Boolean - Determines whether the events on the calendar can be modified. - This determines if the events can be dragged and resized. - Enables/disables both at the same time. - If you don't want both, use editable in conjunction with disableDragging and disableResizing. - This option can be overridden on a per-event basis with the Event Object editable property. - default: false + Determines whether the events on the calendar can be modified. This determines if the events can be dragged and resized. Enables/disables both + at the same time. If you don't want both, use editable in conjunction with disableDragging and disableResizing. This option can be overridden on + a per-event basis with the Event Object editable property. default: false null @@ -374,9 +329,8 @@ selectable java.lang.Boolean - Allows a user to highlight multiple days or timeslots by clicking and dragging. - To let the user make selections by clicking and dragging, this option must be set to true. - default: false + Allows a user to highlight multiple days or timeslots by clicking and dragging. To let the user make selections by clicking and dragging, this + option must be set to true. default: false null @@ -384,12 +338,9 @@ selectHelper java.lang.Boolean - Whether to draw a "placeholder" event while the user is dragging. - A value of true will draw a "placeholder" event while the user - is dragging (similar to what Google Calendar does for its week - and day views). A value of false (the default) will draw - the standard highlighting over each cell. - default: false + Whether to draw a "placeholder" event while the user is dragging. A value of true will draw a "placeholder" event while the user is dragging + (similar to what Google Calendar does for its week and day views). A value of false (the default) will draw the standard highlighting over each + cell. default: false null @@ -397,10 +348,8 @@ unselectAuto java.lang.Boolean - Whether clicking elsewhere on the page will cause the current - selection to be cleared. - This option can only take effect when selectable is set to true. - default: true + Whether clicking elsewhere on the page will cause the current selection to be cleared. This option can only take effect when selectable is set + to true. default: true null @@ -408,15 +357,10 @@ unselectCancel java.lang.String - A way to specify elements that will ignore the unselectAuto option. - Clicking on elements that match this jQuery selector will prevent - the current selection from being cleared (due to the unselectAuto option). - This option is useful if you have a "Create an event" form that - shows up in response to the user making a selection. When the user - clicks on this form, you probably don't want to the current selection - to go away. Thus, you should add a class to your form such as "my-form", - and set the unselectAuto option to ".my-form". - default: '' + A way to specify elements that will ignore the unselectAuto option. Clicking on elements that match this jQuery selector will prevent the + current selection from being cleared (due to the unselectAuto option). This option is useful if you have a "Create an event" form that shows up + in response to the user making a selection. When the user clicks on this form, you probably don't want to the current selection to go away. + Thus, you should add a class to your form such as "my-form", and set the unselectAuto option to ".my-form". default: '' null @@ -424,8 +368,7 @@ disableDragging java.lang.Boolean - Disables all event dragging, even when events are editable. - default: false + Disables all event dragging, even when events are editable. default: false null @@ -433,8 +376,7 @@ disableResizing java.lang.Boolean - Disables all event resizing, even when events are editable. - default: false + Disables all event resizing, even when events are editable. default: false null @@ -442,8 +384,7 @@ dragRevertDuration java.lang.Integer - Time in millisecond it takes for an event to revert to its original position after an unsuccessful drag. - default: 500 + Time in millisecond it takes for an event to revert to its original position after an unsuccessful drag. default: 500 null @@ -452,8 +393,7 @@ date java.util.Date - The initial date when schedule loads. - default: + The initial date when schedule loads. default: current date null @@ -463,8 +403,7 @@ onbeforeitemselect java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
          • item - selected item
          • event - javascript event
          • @@ -477,9 +416,7 @@ onitemselect java.lang.String - JavaScript code called when ajax request triggered when item - is selected has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when item is selected has finished. Following data will be available in context:
            • item - selected item
            • event - javascript event
            • @@ -494,8 +431,7 @@ onitemdragstart java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
              • item - selected item
              • event - javascript event
              • @@ -509,8 +445,7 @@ onitemdragstop java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                • item - selected item
                • event - javascript event
                • @@ -524,8 +459,7 @@ onitemresizestart java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                  • item - selected item
                  • event - javascript event
                  • @@ -539,8 +473,7 @@ onitemresizestop java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                    • item - selected item
                    • event - javascript event
                    • @@ -554,19 +487,16 @@ onbeforeitemdrop java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                      • item - selected item
                      • -
                      • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards - (a negative number) +
                      • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards (a negative number)
                      • -
                      • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or - backwards (a negative number). Only useful for the agenda views. In other views, 0 is passed in. +
                      • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or backwards (a negative number). Only useful + for the agenda views. In other views, 0 is passed in.
                      • -
                      • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in - the agenda views. It will be false if dropped on a slot in the agenda views (meaning it has been - assigned a time). +
                      • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in the agenda views. It will be false if + dropped on a slot in the agenda views (meaning it has been assigned a time).
                      • event - javascript event
                      • ui - jQuery UI object
                      • @@ -579,20 +509,16 @@ onitemdrop java.lang.String - JavaScript code called when ajax request triggered when item - is dropped has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when item is dropped has finished. Following data will be available in context:
                        • item - selected item
                        • -
                        • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards - (a negative number) +
                        • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards (a negative number)
                        • -
                        • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or - backwards (a negative number). Only useful for the agenda views. In other views, 0 is passed in. +
                        • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or backwards (a negative number). Only useful + for the agenda views. In other views, 0 is passed in.
                        • -
                        • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in - the agenda views. It will be false if dropped on a slot in the agenda views (meaning it has been - assigned a time). +
                        • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in the agenda views. It will be false if + dropped on a slot in the agenda views (meaning it has been assigned a time).
                        • vetoed - is true if server side listener has raised veto and modification has been reverted
                        • event - javascript event
                        • @@ -608,17 +534,15 @@ onbeforeitemresize java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                          • item - selected item
                          • -
                          • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards - (a negative number)holds the number of minutes the event was moved forward (a positive number) - or backwards (a negative number). Only useful for the agenda views. In other views, 0 is passed - in. +
                          • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards (a negative number)holds the number of + minutes the event was moved forward (a positive number) or backwards (a negative number). Only useful for the agenda views. In other + views, 0 is passed in.
                          • -
                          • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or - backwards (a negative number). Only useful for the agenda views. In other views, 0 is passed in. +
                          • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or backwards (a negative number). Only useful + for the agenda views. In other views, 0 is passed in.
                          • event - javascript event
                          • ui - jQuery UI object
                          • @@ -631,16 +555,13 @@ onitemresize java.lang.String - JavaScript code called when ajax request triggered when item - is resized has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when item is resized has finished. Following data will be available in context:
                            • item - selected item
                            • -
                            • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards - (a negative number) +
                            • dayDelta - holds the number of days the event was moved forward (a positive number) or backwards (a negative number)
                            • -
                            • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or - backwards (a negative number). Only useful for the agenda views. In other views, 0 is passed in. +
                            • minuteDelta - holds the number of minutes the event was moved forward (a positive number) or backwards (a negative number). Only useful + for the agenda views. In other views, 0 is passed in.
                            • vetoed - is true if server side listener has raised veto and modification has been reverted
                            • event - javascript event
                            • @@ -656,8 +577,7 @@ onitemmouseover java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                              • item - selected item
                              • event - javascript event
                              • @@ -670,8 +590,7 @@ onitemmouseout java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                                • item - selected item
                                • event - javascript event
                                • @@ -686,8 +605,7 @@ JavaScript code for handling event. Any return instruction will be ignored - so this code cannot block anything. - Following data will be available in context: + so this code cannot block anything. Following data will be available in context:
                                  • view - object representing current view
                                  @@ -698,9 +616,7 @@ onviewchange java.lang.String - JavaScript code called when ajax request triggered when view - changes has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when view changes has finished. Following data will be available in context:
                                  • view - object representing current view
                                  • request - ajax request
                                  • @@ -713,12 +629,10 @@ onbeforedateselect java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                                    • date - selected date
                                    • -
                                    • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in - the agenda views. +
                                    • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in the agenda views.
                                    • event - javascript event
                                    • view - object representing current view
                                    • @@ -730,13 +644,10 @@ ondateselect java.lang.String - JavaScript code called when ajax request triggered when date - is selected has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when date is selected has finished. Following data will be available in context:
                                      • date - selected date
                                      • -
                                      • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in - the agenda views. +
                                      • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in the agenda views.
                                      • event - javascript event
                                      • view - object representing current view
                                      • @@ -750,13 +661,11 @@ onbeforedaterangeselect java.lang.String - JavaScript code for handling event. - Following data will be available in context: + JavaScript code for handling event. Following data will be available in context:
                                        • startDate - selection start date
                                        • endDate - selection end date
                                        • -
                                        • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in - the agenda views. +
                                        • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in the agenda views.
                                        • view - object representing current view
                                        @@ -767,14 +676,11 @@ ondaterangeselect java.lang.String - JavaScript code called when ajax request triggered when date - range is selected has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when date range is selected has finished. Following data will be available in context:
                                        • startDate - selection start date
                                        • endDate - selection end date
                                        • -
                                        • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in - the agenda views. +
                                        • allDay - is true if the event has been dropped on a day in month view, or the "all-day" slot in the agenda views.
                                        • view - object representing current view
                                        • request - ajax request
                                        • @@ -790,8 +696,7 @@ JavaScript code for handling event. Any return instruction will be ignored - so this code cannot block anything. - Following data will be available in context: + so this code cannot block anything. Following data will be available in context:
                                          • startDate - start date
                                          • endDate - end date
                                          • @@ -803,9 +708,8 @@ ondaterangechange java.lang.String - JavaScript code called when ajax request triggered when displayed - date range is changed has finished. - Following data will be available in context: + JavaScript code called when ajax request triggered when displayed date range is changed has finished. Following data will be available in + context:
                                            • startDate - selection start date
                                            • endDate - selection end date
                                            • @@ -816,12 +720,22 @@ null - styleClass + onviewdisplay java.lang.String + JavaScript code called when the schedule loads and every time a different date-range is displayed. Following data will be available in context: +
                                                +
                                              • view - object representing current view
                                              • +
                                              null
                                              + + styleClass + java.lang.String + + null + itemMoveListener @@ -860,6 +774,5 @@ - - &listeners; + &listeners; diff --git a/src/main/java/org/richfaces/component/UISchedule.java b/src/main/java/org/richfaces/component/UISchedule.java index 3eed911..7b62b61 100644 --- a/src/main/java/org/richfaces/component/UISchedule.java +++ b/src/main/java/org/richfaces/component/UISchedule.java @@ -41,51 +41,88 @@ import java.util.Map; public abstract class UISchedule extends UIComponentBase implements ScheduleCommonViewAttributes, ScheduleListenerEventsProducer, AjaxComponent { public static final String COMPONENT_TYPE = "org.richfaces.Schedule"; + public static final String COMPONENT_FAMILY = "org.richfaces.Schedule"; + /** * Values of view attribute. */ public static final String VIEW_MONTH = "month"; + public static final String VIEW_BASIC_WEEK = "basicWeek"; + public static final String VIEW_AGENDA_WEEK = "agendaWeek"; + public static final String VIEW_BASIC_DAY = "basicDay"; + public static final String VIEW_AGENDA_DAY = "agendaDay"; + public static final String DEFAULT_VIEW = VIEW_MONTH; + /** * Values of switchType attribute */ public static final String SWITCH_TYPE_AJAX = "ajax"; + public static final String SWITCH_TYPE_SERVER = "server"; + public static final String SWITCH_TYPE_CLIENT = "client"; + public static final String DEFAULT_SWITCH_TYPE = SWITCH_TYPE_AJAX; + /** * Values of weekMode attribute. */ public static final String WEEK_MODE_FIXED = "fixed"; + public static final String WEEK_MODE_LIQUID = "liquid"; + public static final String WEEK_MODE_VARIABLE = "variable"; + public static final String DEFAULT_WEEK_MODE = WEEK_MODE_FIXED; + public static final boolean DEFAULT_SHOW_WEEKENDS = true; + public static final boolean DEFAULT_RTL = false; + public static final int DEFAULT_FIRST_DAY = Calendar.SUNDAY; + public static final double DEFAULT_ASPECT_RATIO = 1.35; + public static final boolean DEFAULT_ALL_DAY_SLOT = true; + public static final String DEFAULT_AXIS_FORMAT = "h(:mm)tt"; + public static final int DEFAULT_SLOT_MINUTES = 30; + public static final int DEFAULT_EVENT_MINUTES = 120; + public static final int DEFAULT_FIRST_HOUR = 6; + public static final String DEFAULT_MIN_TIME = "0"; + public static final String DEFAULT_MAX_TIME = "24"; + public static final boolean DEFAULT_EDITABLE = false; + public static final boolean DEFAULT_SELECTABLE = false; + public static final boolean DEFAULT_SELECT_HELPER = false; + public static final boolean DEFAULT_UNSELECT_AUTO = true; + public static final String DEFAULT_UNSELECT_CANCEL = ""; + public static final boolean DEFAULT_DISABLE_DRAGGING = false; + public static final boolean DEFAULT_DISABLE_RESIZING = false; + public static final int DEFAULT_DRAG_REVERT_DURATION = 500; + public static final double DEFAULT_DRAG_OPACITY = .3; + public static final boolean DEFAULT_ALL_DAY_DEFAULT = true; + private DataModel model; public abstract Object getValue(); @@ -292,6 +329,10 @@ public abstract class UISchedule extends UIComponentBase implements ScheduleComm public abstract void setOndaterangechange(String ondaterangechange); + public abstract String getOnviewdisplay(); + + public abstract void setOnviewdisplay(String onviewdisplay); + public abstract MethodBinding getItemMoveListener(); public abstract void setItemMoveListener(MethodBinding listener); diff --git a/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java b/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java index cedecef..2306338 100644 --- a/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java +++ b/src/main/java/org/richfaces/renderkit/ScheduleRendererBase.java @@ -37,21 +37,37 @@ import java.util.Map; public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { public static final String ITEM_MOVE_EVENT = "itemMove"; + public static final String ITEM_RESIZE_EVENT = "itemResize"; + public static final String ITEM_SELECT_EVENT = "itemSelect"; + public static final String DATE_RANGE_CHANGE_EVENT = "dateRangeChange"; + public static final String VIEW_CHANGE_EVENT = "viewChange"; + public static final String DATE_SELECT_EVENT = "dateSelect"; + public static final String DATE_RANGE_SELECT_EVENT = "dateRangeSelect"; + private static final String CALLBACK = "callback"; + private static final String END_DATE_PARAM = "endDate"; + private static final String START_DATE_PARAM = "startDate"; + private static final String ITEM_ID_PARAM = "itemId"; + private static final String DAY_DELTA_PARAM = "dayDelta"; + private static final String MINUTE_DELTA_PARAM = "minuteDelta"; + private static final String ALL_DAY_PARAM = "allDay"; + private static final String EVENT_TYPE_PARAM = "eventType"; + private static final String VIEW_PARAM = "view"; + private static final Map DEFAULTS; /** @@ -306,6 +322,7 @@ public abstract class ScheduleRendererBase extends AjaxComponentRendererBase { addOptionIfSetAndNotDefault("onbeforedaterangeselect", schedule.getOnbeforedaterangeselect(), options); addOptionIfSetAndNotDefault("ondaterangeselect", schedule.getOndaterangeselect(), options); addOptionIfSetAndNotDefault("ondaterangechange", schedule.getOndaterangechange(), options); + addOptionIfSetAndNotDefault("onviewdisplay", schedule.getOnviewdisplay(), options); if (schedule.getDate() != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(schedule.getDate()); diff --git a/src/main/resources/org/richfaces/renderkit/html/scripts/richfaces.schedule.js b/src/main/resources/org/richfaces/renderkit/html/scripts/richfaces.schedule.js index 68d61bc..bbfd4cb 100644 --- a/src/main/resources/org/richfaces/renderkit/html/scripts/richfaces.schedule.js +++ b/src/main/resources/org/richfaces/renderkit/html/scripts/richfaces.schedule.js @@ -374,6 +374,11 @@ RichFaces.Schedule = function(id, locale, options, dateRangeChangeEventName, ite * ignored. */ var viewChanged = function(view) { + if (options.onviewdisplay != null) { + RichFaces.Schedule.eval("(function(){" + options.onviewdisplay + "})()", { + 'view':view + }); + } if (selectedView != view && selectedView != undefined) { if (submitEventFunction != null) { submitEventFunction({}, -- libgit2 0.24.0