Part 2: Developing a Simple ADF Desktop Integration-enabled Excel Workbook
Having set up the environment for ADF Desktop Integration, you are now ready to start creating workbooks that will integrate with the Fusion Web application that you installed in the previous part of this tutorial.

In this part of the tutorial you create the editable list of Departments workbook, a basic workbook that contains a table of department records.

The Excell worksheet

Step 1: Creating a Table of Departments Workbook
Based on an existing EditDept_LOV page definition, you create a list of Departments workbook.
  1. Right-click the ViewController project in the Navigator and select New > From Gallery... in the context menu.

    In the New Gallery, expand the Client Tier node if it is not already expanded, and select ADF Desktop Integration.

    Select Microsoft Excel Workbook in the Items pane, and click OK.

    New Gallery
  2. Name the workbook EditDept_LOV_src.xlsx

    The published version of the workbook must have a different name from that of the source file. It is a good idea to establish a standard naming convention to differentiate between the source and published workbooks.

    For example you might add the suffix _src to the name of the source file - EditDept_LOV_src.xlsx as here, and retain the more meaningful name for the published workbook - EditDept_LOV.xlsx.

    Create Excel integration

    Click OK.

  3. By default Excel opens and loads Oracle ADF Desktop Integration. In the Page Definition dialog, select the ADFdi_view_EditTable_LOVPageDef page definition.

    Then click OK.

    Page definition dialog

  4. Page definition files define the bindings that populate the data in the Oracle ADF components at runtime. Page definition files also define the action bindings and method action bindings that can be invoked from the worksheet.

    You define a separate page definition file for each Excel worksheet that you want to integrate with a Fusion Web application. The Page Definition dialog lists all available page definition files in the application. In this tutorial there are just two page definition files that were already created in the startup application.
    To view the data bindings in the ADFdi_view_EditTable_LOVPageDef page definition right-click EditTable_LOV.jspx in the Applications window and select Go to Page Definition from context.

    The .jspx page definition
  5. The new workbook appears in the Application window..
    You start adding content to it in the steps that follow.

    Application Navigator

  6. Go back in the Excel workbook. The Oracle ADF Desktop Integration 12c task pane appears presenting the available bindings from the page definition.

    Oracle ADF 11g Desktop Integration

     

  7. Select a cell in the worksheet, notice click the Oracle ADF tab option. This option allows you to work with ADF and your Excel book.

    the worksheet

    the worksheet
  8. In the Oracle ADF Desktop Integration 12c pane, click the Insert Binding button...

    Select Component dialog

    ... and in the Select Component dialog select ADF Table and click OK.

    Select Component dialog

  9. In the Insert Component: ADF Table dialog, click OK to accept default values.

    Insert Component: ADF Read-only Table dialog
  10. The Excel worksheet displays. Your worksheet should look like the image below.It displays the bindings for each cell that the project uses.

    Excel worksheet
  11. Click the Save icon Save Icon to save the worksheet.

    Save option
  12. Back in JDeveloper, Save all your work and then double-click the ViewController project to invoke the Project Properties dialog.

    Select the Java EE Application node and check that the fields, Java EE Web Application Name and Java EE Web Context Root, are both set to ADFdi_BC.

    These values will be used by the integrated Oracle WebLogic Server.

    Project Properties dialog

    Click OK.

  13. Return to Excel and click the Workbook Properties link in the Oracle ADF Desktop Integration 12c pane.

    Oracle ADF 11g Desktop Integration
  14. In the Edit Workbook Properties, next to the WebAppRoot field, enter http://127.0.0.1:7101/ADFdi_BC. This URL represents the URL of the Fusion Web application with which the workbook is integrated. Click OK.

    Edit Workbook Properties
  15. Click the Oracle ADF tab in the Excel ribbon, and then select the Worksheet Properties menu item.

    Oracle ADF tab in the Excel ribbon
  16. Click the Events field, and then click the more button More Icon.

    Edit Worksheet Properties

  17. In the Edit Events dialog, click the Add button to add a Startup event.

    Edit Events dialog
  18. Expand the ActionSet node and click the more button More Icon next to the Actions field to open an Edit Actions dialog.

    Edit Events dialog
  19. The Oracle ADF Desktop Integration add-in provides a number of worksheet events that, when triggered, can invoke an action set. Startup is one such event.

    In this step you have added a Startup event, and in the steps that follow you go on to define the action set that the event should invoke i.e. what the worksheet should do when the Startup event occurs.
  20. In the Edit Actions dialog, click the Add button and select ComponentAction from the drop down list.

    Edit Actions dialog
  21. Click the more button More Icon next to the Action field.

    Edit Actions dialog
  22. In the select Choose Component Action dialog, select Download. (Notice that the Table ID, ROT1709241693 will be different in your case).
    Click OK.

    Choose Component Action dialog
  23. The ADF Read-only Table component exposes only one component action, Download, while the ADF Table component exposes a number of other actions. In this part of the tutorial you added a read-only table to the worksheet, and so this is why Download is the only component action offered as available by the Choose Component Action dialog.

    The Download component action causes the table to be automatically downloaded to the worksheet when the Startup event is triggered.

  24. In the Edit Actions dialog, in the Design | Annotation field, type Download Data.

    Edit Actions dialog
  25. You can use the Annotation field to enter a comment about the component's use in the worksheet.

    Comments you enter in the field have no effect on the behavior of the worksheet. They are the equivalent of code comments.

    Click OK. Back in the Edit Events, click OK, and back in the Edit Worksheet Properties dialog, click OK.

  26. You have finished the design of this simple Desktop Integration-enabled worksheet. In the next step you will test it.

Step 2: Testing the EditDept_LOV Workbook
To be able to test your workbook, the application needs to run in Oracle WebLogic Server.
  1. In JDeveloper right-click the EditTable_LOV.jspx node and select Run from the context menu. (This step may take a while if Oracle WebLogic Server has not yet been set up on this computer.)

    Application Navigator
    Typing a weblogic password.

    The first time you run a page after a fresh install of JDeveloper, you will be required to type a Password for Oracle WebLogic Server. Enter a value of your choice for the password and click OK.

    Create Default Domain dialog

  2. The EditDept_LOV loads, displaying department information.

    DepartmentPage in the browser
  3. Now that the page has been deployed in the Oracle WebLogic Server, you can run the Excel workbook. If not open already, in the Applications window double-click EditTable_LOV.xlsx to open Microsoft Excel.

    Application Navigator
  4. The workbook loads. Click the Oracle ADF tab in the Excel ribbon.

    Oracle ADF tab in the Excel ribbon
  5. In the Test group, click the Validate button Validate icon for validating the workbook. Click Close on positive validation.

    Validation dialog
  6. Click Run Run Icon to start loading data.

    Run button
  7. The list of departments is returned in the worksheet.

    list of departments in the worksheet
  8. Adjust the columns widths to achieve the desired look.

    list of departments in the worksheet
  9. Click the Stop button in the Test group of the Oracle ADF tab in the Excel ribbon.

    Stop button
  10. Close the Excel applicationwithout saving. You've successfully created a basic Excel workbook that is integrated with a Fusion Web application, and that automatically downloads data from a database table.

Bookmark Print Expand all | Hide all
Back to top
Copyright © 2014, Oracle. All rights reserved.