How to Apply Read-Only Values to Gantt Chart Features

28-24 Web User Interface Developers Guide for Oracle Application Development Framework Example 28–19 Sample ActionListener for Handling the Gantt Chart Print Event public void handleActionGanttActionEvent evt { if GanttActionEvent.PRINT == evt.getActionType { FacesContext _context = FacesContext.getCurrentInstance; ServletResponse _response = ServletResponse _context.getExternalContext.getResponse; _response.setContentTypeapplicationpdf; ServletOutputStream _sos = _response.getOutputStream; Generate FO. GanttPrinter _printer = new GanttPrinterm_gantt; Set column visibility by column index. _printer.setColumnVisible0, false; Set start and end date. _printer.setStartTimestartDate; _printer.setEndTimeendDate; Set top, bottom, left, and right margins in pixels. _printer.setMargin25, 16, 66, 66; Set height and width in pixels. _printer.setPageSize440, 660; File _file = File.createTempFilegantt, fo; OutputStream _out = new FileOutputStream_file; _printer.print_out; _out.close; generate PDF. FOProcessor _processor = new FOProcessor; _processor.setDatanew FileInputStream_file,UTF-8; _processor.setOutputFormatFOProcessor.FORMAT_PDF; _processor.setOutput_sos; _processor.generate; _context.responseComplete; } }

28.10 Using Gantt Charts as a Drop Target or Drag Source

You can add drag and drop functionality that allows users to drag an item from a collection, for example, a row from a table, and drop it into another collection component, such as a tree. Project and scheduling Gantt chart components can be enabled as drag sources as well as drop targets for ADF table or tree table components. A resource utilization Gantt chart component can be enabled only as a drop target. The application must register the Gantt chart component as a drag source or drop target by adding the af:collectionDragSource or af:collectionDropTarget behavior tags respectively as a child to the Gantt tag. For example, you can use the af:collectionDragSource to register a drop listener that would be invoked when a project Gantt chart task is dragged from a table region onto a separate table. shows a project Gantt chart with tasks dragged from the table region onto a table of tasks. Using ADF Gantt Chart Components 28-25 Figure 28–9 Project Gantt Chart as Drag Source Example 28–20 shows sample code for adding drag and drop functionality to a scheduling Gantt chart. Example 28–20 Sample Code for Adding Drag and Drop Functionality dvt:schedulingGantt value={test.treeModel} ............. af:schedulingDragSource actions=COPY MOVE modelName=treeModel dvt:projectGantt Example 28–21 shows sample code for the listener method for handling the drop event. Example 28–21 Event Handler Code for a dropListener for a Collection public DnDAction onTableDropDropEvent evt { Transferable _transferable = evt.getTransferable; Get the drag source, which is a row key, to identify which row has been dragged. RowKeySetImpl _rowKey = RowKeySetImpl_ transferable.getTransferDataDataFlavor.ROW_KEY_SET_FLAVOR.getData; Set the row key on the table model source to get the data. m_tableModel is the model for the Table the drag source. object _key = _rowKey.iterator.next; m_tableModel.setRowKey_key; See on which resource this is dropped specific for scheduling Gantt chart. String _resourceId = _transferable.getDataString.class; Resource _resource = findResourceById_resourceId; See on what time slot did this dropped.