Data for a Resource Utilization Gantt Chart

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 28-16 Web User Interface Developers Guide for Oracle Application Development Framework The handleTaskSelected method is specified in a backing bean. Example 28–8 shows sample code for the backing bean. Example 28–8 Backing Bean for Handling Task Selection public void handleTaskSelectedTaskSelectionEvent evt { JUCtrlHierNodeBinding _task = JUCtrlHierNodeBindingevt.getTask; String _type = _task.getAttributeTaskType; RichPopup _popup = m_gantt.getFacetchartPopupMenu; if _popup = null { RichMenu _menu = RichMenu_popup.getChildren.get0; _menu.getChildren.clear; if Summary.equals_type { RichCommandMenuItem _item = new RichCommandMenuItem; _item.setIdi1; _item.setTextCustom Action 1; _menu.getChildren.add_item; } else if Normal.equals_type { RichCommandMenuItem _item = new RichCommandMenuItem; _item.setIdi1; _item.setTextCustom Action 2; _menu.getChildren.add_item; } } } For more information about using the af:popup components see Chapter 13, Using Popup Dialogs, Menus, and Windows .

28.7 Working with Gantt Chart Tasks and Resources

You can customize Gantt chart tasks to create a new task type, specify a custom data filter, and add a double-click event to a task bar.

28.7.1 How to Create a New Task Type

A task type is represented visually as a bar in the chart region of a Gantt chart. You can create a new task type in one of three ways: ■ Defining the task type style properties in the .jspx file or in a separate CSS file. ■ Defining a TaskbarFormat object and registering the object with the taskbarFormatManager. ■ Modifying the properties of a predefined task type by retrieving the associated TaskbarFormat object and updating its properties through a set method. The TaskBarFormat object exposes the following properties: ■ Fill color ■ Fill image pattern ■ Border color ■ Images used for a milestone task ■ Images used for the beginning and end of a summary task