How to Create a Calendar

15-8 Web User Interface Developers Guide for Oracle Application Development Framework ■ day ■ list ■ all If you want to enter more than one value, enter the values with a space between. For example, if you want the calendar to use day and week views, you would enter the following: day week The corresponding buttons will automatically be displayed in the toolbar, in the order they appear in the list. If you do not enter day as an available view, then activities will be listed as plain text rather than as links in the list and week views provided you do not also enter all. 4. If you want the user to be able to drag a handle on an existing activity to expand or collapse the time period of the activity, then implement a handler for CalendarActivityDurationChangeListener. This handler should include functionality that changes the end time of the activity. If you want the user to be able to move the activity and, therefore, change the start time as well as the end time, then implement drag and drop functionality. For more information, see Section 32.7, Adding Drag and Drop Functionality to a Calendar. You can now add the following functionality: ■ Allow users to create, edit, and delete activities using popup components. For more information, see Section 15.4, Adding Functionality Using Popup Components. ■ Allow users to move activities around on the calendar. For more information, see Section 32.7, Adding Drag and Drop Functionality to a Calendar. ■ Change or add to the toolbar buttons in the toolbar. For more information, see Section 15.5, Customizing the Toolbar. ■ Change the appearance of the calendar and events. For more information, see Section 15.6, Styling the Calendar.

15.3.2 What Happens at Runtime: Calendar Events and PPR

The calendar has two events that are used in conjunction with facets to provide a way to easily implement additional functionality needed in a calendar, such as editing or adding activities. These two events are CalendarActivityEvent invoked when an action occurs on an activity and CalendarEvent invoked when an action occurs on the calendar, itself. For more information about using these events to provide Note: If all is entered, then all views are available, regardless if one is left out of the list. Note: In order to handle an overflow of tasks for a given day in the month view, if you enter month and do not also enter all, then you must also enter day. Creating a Calendar Application 15-9 additional functionality, see Section 15.4, Adding Functionality Using Popup Components. The calendar also supports events that are fired when certain changes occur. The CalendarActivityDurationChangeEvent is fired when the user changes the duration of an activity by dragging the box that displays the activity. The CalendarDisplayChangeEvent is fired whenever the component changes the value of a display attribute, for example when the view attribute changes from month to day. When a CalendarDisplayChangeEvent is fired, the calendar component adds itself as a partial page rendering PPR target, allowing the calendar to be immediately refreshed. This is because the calendar assumes that if the display changed programatically, then the calendar must need to be rerendered. For example, if a user changes the view attribute from day to month, then the calendar is rerendered automatically.

15.4 Adding Functionality Using Popup Components

When a user acts upon an activity, a CalendarActivityEvent is fired. This event causes the popup component contained in a facet to be displayed, based on the user’s action. For example, if the user right-clicks an activity, the CalendarActivityEvent causes the popup component in the activityContextMenu to be displayed. The event is also delivered to the server, where a configured listener can act upon the event. You create the popup components for the facets or if you do not want to use a popup component, implement the server-side listener. It is in these popup components and facets where you can implement functionality that will allow users to create, delete, and edit activities, as well as to configure their instances of the calendar. Table 15–1 shows the different user actions that invoke events, the event that is invoked, and the associated facet that will display its contents when the event is invoked. The table also shows the component you must use within the popup component. You create the popup and the associated component within the facet, along with any functionality implemented in the handler for the associated listener. If you do not insert a popup component into any of the facets in the table, then the associated event will be delivered to the server, where you can act on it accordingly by implementing handlers for the events. Table 15–1 Calendar Faces Events and Associated Facets User Action Event Associated Facet Component to Use in Popup Right-click an activity. CalendarActivity Event activityContextMenu: The enclosed popup component can be used to display a context menu, where a user can choose some action to execute against the activity, for example edit or delete. menu Select an activity and press the Delete key. CalendarActivity Event activityDelete: The enclosed popup component can be used to display a dialog that allows the user to delete the selected activity. dialog