How to Add a Double-Click Event to a Task Bar

28-22 Web User Interface Developers Guide for Oracle Application Development Framework

28.8.3.1 How to Create and Use a Custom Time Axis

You can create a custom time axis for the Gantt chart and specify that axis in the scale attribute of dvt:timeAxis. The custom time axis will be added to the Time Scale dialog at runtime. To create and use a custom time axis: 1. Implement the CustomTimescale.java interface to call the method getNextDateDate currentDate in a loop to build the time axis. Example 28–16 show sample code for the interface. Example 28–16 Interface to Build Custom Dates public interface CustomTimescale { public String getScaleName; public Date getPreviousDateDate ganttStartDate; public Date getNextDateDate currentDate; public String getLabelDate date; }

2. In the Structure window, right-click a Gantt chart node and choose Go to

Properties.

3. In the Other attributes category of the Property Inspector, for the

CustomTimeScales attribute, register the implementation of the interface for the custom time axis. The customTimeScales attributes value is a java.util.Map object. The specified map object contains pairs of keyvalues. The key is the time scale name fiveyears, and the value is the implementation of the CustomTimeScale.java interface. For example: customTimesScales={project.customTimescales}

4. Also in the Property Inspector, set the Scale attribute for major and minor time

axis, and specify the ZoomOrder attribute to zoom to the custom times scales. Example 28–17 shows sample code for setting a threeyears minor time axis and a fiveyears major time axis. Example 28–17 Custom Time Axis f:facet name=major dvt:timeAxis scale=fiveyears id=ta1 zoomOrder=fiveyears threeyears years halfyears quarters months weeks days hours f:facet f:facet name=minor dvt:timeAxis scale=threeyears id=ta2 f:facet

28.9 Printing a Gantt Chart

The ADF Gantt chart provides a helper class GanttPrinter that can generate a Formatted Object FO for use with XML Publisher to produce PDF files. Using ADF Gantt Chart Components 28-23

28.9.1 Print Options

In general, the GanttPrinter class prints the Gantt chart content as it appears on your screen. For example, if you hide the legend in the Gantt chart, then the legend will not be printed. Similarly, if you deselect a column in the List Pane section of the View Menu, then that column will not be visible in the Gantt chart and will not appear in the printed copy unless you take advantage of the column visibility print option. You can use the following print options in the GanttPrinter class: ■ Column visibility: The setColumnVisible method lets you control whether individual columns in the list region of the Gantt chart will appear in the printed output. For example, to hide the first column in the list region of a Gantt chart, use the following code, where the first parameter of the method is the zero-based index of the column and the second parameter indicates if the column should be visible in the printed Gantt chart: _printer.setColumnVisibleo, false; ■ Margins: The setMargin method of the GanttPrinter lets you specify the top, bottom, left, and right margins in pixels as shown in the following code, where _ printer is an instance of the GanttPrinter class: _printer.setMargin25, 16, 66, 66; ■ Page size : The setPageSize method of the GanttPrinter class lets you specify the height and width of the printed page in pixels as shown in the following code, where _printer is an instance of the GanttPrinter class: _printer.setPageSize 440, 600; ■ Time period : The setStartTime and setEndTime methods of the GanttPrinter class let you identify the time period of the Gantt chart that you want to print. Example 28–18 shows sample code for setting a specific time period in the Gantt chart for printing, where startDate and endDate are variables that represent the desired dates and _printer is an instance of the GanttPrinter class. Example 28–18 Code for Setting the Time Period Option for Printing a Gantt Chart _printer.setStartTimestartDate; _printer.setEndTimeendDate;

28.9.2 Action Listener to Handle the Print Event

The Gantt chart toolbar includes a print button that initiates a print action. To print a Gantt chart, you must create an ActionListener to handle the print event. The code in the ActionListener should include the following processes: 1. Access the servlet’s output stream. 2. Generate the FO. This process includes creating an instance of the GanttPrinter class and entering the code for any print options that you want to use. 3. Generate the PDF. Example 28–19 shows the code for an ActionListener that handles the print event. This listener includes settings for all the print options available in the GanttPrinter helper class.