What Happens at Runtime: Calendar Events and PPR

Creating a Calendar Application 15-11 Example 15–1 shows the JSF code for a dialog popup component used in the activityDelete facet. Example 15–1 JSF Code for an Activity Delete Dialog f:facet name=activityDelete af:popup id=delete contentDelivery=lazyUncached -- dont render if the activity is null -- af:dialog dialogListener={calendarBean.deleteListener} affirmativeTextAndAccessKey=Yes cancelTextAndAccessKey=No rendered={calendarBean.currActivity = null} af:outputText value=NOTE: This popup is for demo purposes only, it is not part of the built in functionality of the calendar. af:spacer height=20 af:outputText value=Are you sure you want to delete this activity? af:panelFormLayout af:inputText label=Title value={calendarBean.currActivity.title} readOnly=true af:inputDate label=From value={calendarBean.currActivity.from} readOnly=true af:convertDateTime type=date dateStyle=short timeZone={calendarBean.timeZone} pattern={calendarBean.currActivity.dateTimeFormat} af:inputDate af:inputDate label=To value={calendarBean.currActivity.to} readOnly=true af:convertDateTime type=date dateStyle=short timeZone={calendarBean.timeZone} pattern={calendarBean.currActivity.dateTimeFormat} af:inputDate af:inputText label=Location readOnly=true rendered={calendarBean.currActivity.location = null} value={calendarBean.currActivity.location} af:panelFormLayout af:dialog af:popup f:facet Figure 15–7 shows how the dialog is displayed when a user clicks an activity and presses the Delete key. Figure 15–7 Delete Activity Dialog

3. Implement any needed logic for the calendarActivityListener. For

example, if you are implementing a dialog for the activityDeleteFacet, then implement logic in the calendarActivityListener that can save-off the current activity so that when you implement the logic in the dialog listener in the next step, you will know which activity to delete. Example 15–2 shows the calendarActivityListener for the calendar.jspx page in the ADF Faces demo application. 15-12 Web User Interface Developers Guide for Oracle Application Development Framework Example 15–2 calendarActivityLIstener Handler public void activityListenerCalendarActivityEvent ae { CalendarActivity activity = ae.getCalendarActivity; if activity == null { no activity with that id is found in the model System.out.printlnNo activity with event + ae.toString; setCurrActivitynull; return; } System.out.printlnproviderId is + activity.getProviderId; System.out.printlnactivityId is + activity.getId; setCurrActivitynew DemoCalendarActivityBeanDemoCalendarActivityactivity, getTimeZone 4. Implement the logic for the popup component in the handler for the popup event. For example, for the delete dialog, implement a handler for the dialogListener that actually deletes the activity when the dialog is dismissed. For more information about creating dialogs and other popup components, see Chapter 13, Using Popup Dialogs, Menus, and Windows.

15.5 Customizing the Toolbar

By default, the toolbar in the calendar allows the user to change the view between day, week, month, and list, go to the next or previous item in the view, go to the present day, and also displays a text description of the current view, for example in the day view, it displays the active date, as shown in Figure 15–8 . Figure 15–8 Toolbar in Day View of a Calendar Figure 15–9 shows a toolbar that has been customized. It has added toolbar buttons, including buttons that are right-aligned on the top toolbar, and buttons in a second toolbar.