Data for a Project Gantt Chart

Using ADF Gantt Chart Components 28-13

28.5 Creating an ADF Gantt Chart

You can use any of the following data sources to create an ADF Faces Gantt chart component: ■ ADF Data Controls: You declaratively create a databound Gantt chart by dragging and dropping a data collection from the ADF Data Controls panel. You can create a Gantt chart using a data collection that provides row set data as described in the Creating Databound ADF Gantt Charts section in the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. ■ Data Model: You programmatically specify the data model for the Gantt chart by providing an EL expression that references a backing bean method using the value attribute of the Gantt tag.

28.6 Customizing Gantt Chart Legends, Toolbars, and Context Menus

You can modify default Gantt chart features including the information panel and legend that are displayed below the Gantt chart, menu bar options and toolbar buttons, and the popup menu that is displayed when you right-click in the Gantt chart table or chart regions.

28.6.1 How to Customize a Gantt Chart Legend

The optional Gantt chart legend subcomponent includes an area that displays detailed information about the selected task, or metrics about the selected time bucket, and a legend that displays the symbol and color code bar used to represent each type of task in a Gantt chart. At runtime, users can hide or show the information panel using a toolbar button. The dvt:ganttLegend tag must be added as a child of the Gantt chart tag in order to provide the legend areas. The content of the legend areas is automatically generated based on the properties for each type of task registered with the taskbarFormatManager. labelPlacement String. The alignment of the label in the task bar for all tasks. Valid values are left default, right, inside, inside_left, inside_right, and inside_center. Recurring tasks node A list of recurring tasks for all tasks. resourceId required String. The unique identifier of a resource. Split tasks node A collection of tasks without a continuous time line for all tasks. startTime required Date. The start time for all tasks. startupTime Date. The startup time before a task begins. Tasks node required A list of tasks associated with a resource. taskId required String. The unique identifier of the task for all tasks. taskType String. The type of the task for all tasks. workingDaysOfTheWeek Object. A list of the working days of the week. workingEndTime Date. The work end time for the resource. workingStartTime Date. The work start time for the resource. Table 28–4 Cont. Data Object Keys for Scheduling Gantt Charts Data Object Key Data Type and Description 28-14 Web User Interface Developers Guide for Oracle Application Development Framework You can customize the information displayed when a task or time bucket is selected by using the keys and label attributes on the Gantt chart legend tag. The keys attribute should specify the data object keys used to retrieve the value to display and the labels attribute should contain the corresponding labels for the values retrieved with the keys. If these attributes are not specified, the legend will use the entire space of the information panel. You can also add icons to the legend by using the iconKeys and iconLabels attributes on the Gantt chart legend tag. Icons will be automatically resized to 12 by 12 pixels if the icon size is too large. Example 28–2 show sample code to display information about an On Hold task in the legend of a project Gantt chart. Example 28–2 Adding a Gantt Chart Legend dvt:projectGantt var=task dvt:ganttLegend id=gl keys=TaskName StartTime EndTime labels=Name Start Finish icons=imageswait.png iconLabels=OnHold dvt:projectGantt

28.6.2 Customizing Gantt Chart Toolbars

The Gantt chart toolbar subcomponent allows users to perform operations on the Gantt chart. The left section of the toolbar is a menu bar that contains a set of default menu options for each Gantt chart type. The right section of the toolbar displays a set of default action buttons for working with each Gantt chart type. You can supply your own menu items and toolbar buttons by using the menu and toolbar facets in your Gantt chart. The Gantt chart merges the new menu items with the standard items in the Gantt chart. Example 28–3 shows sample code for specifying a new menu item. Example 28–3 Sample Code for Custom Menu Item dvt:projectGantt var=task f:facet name=”menus” af:menu text=”My Menu” af:commandMenuItem text=Add... af:commandMenuItem text=Create.. af:menu f:facet dvt:projectGantt Example 28–4 shows sample code for specifying a new toolbar button. Example 28–4 Sample Code for Custom Toolbar Button dvt:schedulingGantt var=task f:facet name=toolbar af:toolbar af:commandToolbarButton text=Custom disabled=true af:toolbar dvt:schedulingGantt Actions initiated on the menu bar and toolbar buttons are handled through a registered listener, DataChangeListener, on the Gantt chart component. For example, when a user presses the delete button in the toolbar, a DataChangeEvent with the ID of the task selected for deletion would be fired on the server. The Using ADF Gantt Chart Components 28-15 registered listener is then responsible for performing the actual deletion of the task, and the Gantt chart data model is refreshed with the updated information. You can register DataChangeListener by specifying a method binding using the dataChangeListener attribute on the Gantt chart tag. For example, if you put the code in a backing bean in a method called handleDataChange, then the setting for the dataChangeListener attribute becomes: {myBackingBean.handleDataChange}. Example 28–5 shows sample code in a backing bean. Example 28–5 Backing Bean for Handling Data Change public void handleDataChangedDataChangeEvent evt { if DataChangeEvent.DELETE == evt.getActionType ………… }

28.6.3 Customizing Gantt Chart Context Menus

When users right-click in the Gantt chart table or chart regions, a context menu is displayed to allow users to perform operations on the Gantt chart. A standard set of options is provided for each region. You can supply your own menu items using the tablePopupMenu and chartPopupMenu facets in your Gantt chart. The Gantt chart merges the new menu items with the standard items in the Gantt chart. Example 28–6 shows sample code for specifying a custom menu item in the table region context menu. Example 28–6 Sample Code for Custom Context Menu Item dvt:projectGantt startTime={test.startTime} endTime={test.endTime} value={test.treeModel} var=task f:facet name=tablePopupMenu af:popup af:commandMenuItem text=Custom disabled=true af:popup f:facet dvt:projectGantt You can also dynamically change the context menu at runtime. Example 28–7 shows sample code to update a custom popup menu on a task bar based on which task is selected in the chart region of a project Gantt chart. Example 28–7 Sample Code for Dynamic Context Menu dvt:projectGantt var=task taskSelectionListener={backing.handleTaskSelected} f:facet name=chartPopupMenu af:popup id=p1 contentDelivery=lazyUncached af:menu af:menu af:popup f:facet dvt:projectGantt