What You May Need to Know About Toolbars

15-2 Web User Interface Developers Guide for Oracle Application Development Framework configure it so that only the day and week views are available, as shown in Figure 15–2 . Because only day and week views are available, those are the only buttons displayed in the toolbar. Figure 15–2 Calendar Configured to Use Only Week and Day Views By default, the calendar displays dates and times based on the locale set in the trinidad-config.xml file for example, Section A.6, Configuration in trinidad-config.xml . If a locale is not set in that file, then it is based on the locale sent by the browser. For example, in the United States, by default, the start day of the week is Sunday, and 2 p.m. is shown as 2:00 PM. In France, the default start day is Monday, and 2 p.m. is shown as 14:00. The time zone for the calendar is also based on the setting in trinidad-config.xml. You can override the default when you configure the calendar. For more information, see Section 15.3, Configuring the Calendar Component. The calendar uses the CalendarModel class to display the activities for a given time period. You must create your own implementation of the model class for your calendar. If your application uses the Fusion technology stack, then you can create ADF Business Components over your data source that represents the activities, and the model will be created for you. You can then declaratively create the calendar, and it will automatically be bound to that model. For more information, see the Using the ADF Faces Calendar Component section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. If your application does not use the Fusion technology stack, then you create your own implementation of the CalendarModel class and the associated CalendarActivity and CalendarProvider classes. The classes are abstract classes with abstract methods. You must provide the functionality behind the methods, suitable for your implementation of the calendar. For more information, see Section 15.2, Creating the Calendar. The calendar includes a toolbar with built-in functionality that allows a user to change the view between daily, weekly, monthly, or list, go to the previous or next day, week, or month, and return to today. The toolbar is fully customizable. You can choose which buttons and text to display, and you can also add buttons or other components. For more information, see Section 15.5, Customizing the Toolbar. Creating a Calendar Application 15-3 The calendar component displays activities based on those activities and the provider returned by the CalendarModel class. By default, the calendar component is read-only. That is, it can display only those activities that are returned. You can add functionality within supported facets of the calendar so that users can edit, create, and delete activities. When certain events are invoked, popup components placed in these corresponding facets are opened, which can allow the user to act on activities or the calendar. For example, when a user clicks on an activity in the calendar, the CalendarActivityEvent is invoked and the popup component in the ActivityDetail facet is opened. You might use a dialog component that contains a form where users can view and edit the activity, as shown in Figure 15–3 . Figure 15–3 Dialog Implemented to Edit an Activity For more information about implementing additional functionality using events, facets, and popup components, see Section 15.4, Adding Functionality Using Popup Components. The calendar component supports the ADF Faces drag and drop architectural feature. Users can drag activities to different areas of the calendar, executing either a copy or a move operation, and can also drag handles on the activity to change the duration of the activity. For more information about adding drag and drop functionality, see Section 32.7, Adding Drag and Drop Functionality to a Calendar. By default, the calendar displays activities using a blue ramp. Color ramps are groups of colors all based on the same hue, for example, blue. In the default calendar, for a short-duration activity shown in the daily view, the time of an activity is shown with a dark blue background, while the title of the activity is shown with a light blue Tip: When these toolbar buttons are used, attribute values on the calendar are changed. You can configure these values to be persisted so that they remain for the user during the duration of the session. For more information, see Chapter 31, Allowing User Customization on JSF Pages. You can also configure your application so that the values will be persisted and used each time the user logs into the system. For this persistence to take place, your application must use the Fusion technology stack. For more information, see the Allowing User Customizations at Runtime chapter of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. 15-4 Web User Interface Developers Guide for Oracle Application Development Framework background, as shown in Figure 15–1 . You can customize how the activities are displayed by changing the color ramp. Each activity is associated with a provider, that is, an owner. If you implement your calendar so that it can display activities from more than one provider, you can also style those activities so that each provider’s activity shows in a different color, as shown in Figure 15–4 . Figure 15–4 Month View with Activities from Different Providers

15.2 Creating the Calendar

Before you can add a calendar component to a page, you must implement the logic required by the calendar in Java classes that extend ADF Faces calendar abstract classes. For an ADF Faces application, create the classes as managed beans. After you create the classes, you can add the calendar to a page. Before you implement your logic, it helps to have an understanding of the CalendarModel and CalendarActivity classes, as described in the following section.

15.2.1 Calendar Classes

The calendar component must be bound to an implementation of the CalendarModel class. The CalendarModel class contains the data for the calendar. Note: If your application uses the Fusion technology stack, implement the calendar classes using ADF Business Components. This will allow you to declaratively create and bind your calendar component. For more information, see the Using the ADF Faces Calendar Component section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework.