In this tutorial, you use the DVT (Data Visualization Tool) components in Oracle ADF to build some graphical representations of data, such as Bar Charts, Gauges, Gantt charts and Geographical maps. You also explore the use of a pivot table. ADF Data Visualization components are a set of rich interactive ADF Faces components that provide significant graphical and tabular capabilities for analyzing data.
show more or lessRead more...

The application to build reflects the Model-View-Controller architecture. The model is provided by EJB Components, while the view and controller are provided by JavaServer Faces.You use the ADF Faces set of JSF-compatible components to build a richer web interface.

Purpose Duration Application

In this tutorial, starting from a predefined application, you use Oracle JDeveloper 11g Version 11.1.2.0.0 to build a web application. For the data model based on the FOD database schema, you use ADF Business Components. For the web client side, JavaServer Faces (JSF) is used. You create a main master-detail Order page, then, you improve the UI by adding graphical components like bar charts, gauge, geographic map, gantt chart and pivot table.
To see the completed application you will create, click the Download button to download a zip of the final application, and then unzip it in your JDeveloper mywork folder.

120 minutes Download application name.zip
Part 1: Validating the Model and Starting Building the UI
You first install the FOD schema using a dedicated application to build the database requirements for this tutorial. Then you open a predefined application and validate the Model project that already exists. Finally you start creating a Master/Detail page using the ADF Business Components.
Building the model with EJB/JPA components. Show more or lessRead more... JDeveloper includes step-by-step wizards for creating EJB projects, entities, persistence units, session beans, and message-driven beans. You can build entities from online or offline database definitions and from application server data source connections. There is also seamless integration with JPA and TopLink technology to provide a complete persistence package.
Step 1: Create and Populate the Database Schema
Before you start working on your application, you must first create the FOD database schema.
  1. Download the FOD schema zip file from OTN or right click the following link and choose Save Link As... from context to download the fod_11.zip file on a local directory of your choice.

  2. Unzip the fod_11.zip file on a local directory of your choice (i.e. temp)

  3. Start JDeveloper by selecting Start > All Programs > Oracle Fusion Middleware 11.1.2 > JDeveloper Studio 11.1.2

  4. If prompted for a Role, choose Studio Developer (All Features) and click OK.

    Select Role dialog at startup
  5. Close the Tip of the Day window.

    Once loaded, the JDeveloper IDE appears. Show more or lessRead more...
    The very first time you open JDeveloper, the Start Page displays. You can re-invoke the Start Page later by choosing Help | Start Page.

    JDeveloper Start Page

    Notice the various options available to help you learn about JDeveloper. After exploring these options, click the X on the Start Page tab to close it. (the X appears when you mouse over the tab).
  6. Click the Open Application link (or from the tool menu, choose File | Open).

    The Open Application link
  7. Locate the workspace infrastructure.jws where you've unzipped the fod_11.zip file. i.e.: d:\temp\FOD_11\Infrastructure.

    The Open Application dialog.

    Click Open. If you are prompted to migrate the project, follow the steps of the migration wizard to proceed.

    Migrating a project. Show more or lessRead more... In case you open a workspace that was saved with a previous JDeveloper release, JDeveloper needs to migrate it to the latest versions. Accept the migration for the projects by clicking Next on the Migration wizard.


    Click Finish to proceed.

    The end of migration status

    Click OK to dismiss the Migration Status information window.
  8. In the Application Navigator, expand the MasterBuildScript | Resources nodes and double-click build.properties to open it in the editor.

    The build.properties file
  9. Set the appropriate values in the build.properties file (jdeveloper.home, and all the jdbc.* and db.* settings). The relevant settings are:

    Parameter name Value
    middleware.home Set the middleware.home variable to the directory where you installed JDeveloper i.e. C:/oracle/middleware
    jdbc.urlBase Base URI for your database, i.e., jdbc:oracle:thin:@localhost
    jdbc.port Port number for your database, i.e. , 1521
    jdbc.sid Database instance name, i.e. ,XE or ORCL
    db.adminUser Database user with admin privileges, i.e., system.
    db.demoUser Name of database user and schema to be created, i.e. , fod
    db.demoUser.password Password for database user to be created, i.e., fusion
    db.demoUser.tablespace Name of the user tablespace, i.e., USERS
    db.demoUser.tempTablespace Name of the temporary tablespace, i.e., TEMP
    The build.properties file
  10. In the MasterBuildScript project, select the build.xml file.

    The Application Navigator for the Infrastructure application
  11. In the Structure window, right-click the refreshSchema target and choose Run Target "refreshSchema".

    The Structure pane
  12. When prompted enter the database system user password.

    The Enter Property dialog for database password

    Click Continue.

  13. Verify that the log window doesn't report any major error. It should look like this:

    The Log window
  14. Next to the Infrastructure application name, click the down arrow Close and select Close Application.

    Closing the Application
Step 2: Get the Starter Application Ready

Before you create any component, you must first open the startup application. To do this, perform the following steps:

  1. Download the Gantt.zip file. Right click the following link and choose Save Link As... from context to download the gantt.zip file on a local directory of your choice.

    The Save As dialog
  2. Unzip the Gantt.zip file on a local directory of your choice (i.e. temp)

    Context menu for extrating the Gantt.zip file
  3. From the Application Navigator, click the Open Application link.

    The Open Application link
  4. Locate the workspace c:\temp\Gantt\BrowseEditApp\BrowseEditApp.jws.

    The Open Application dialog

    Click Open. If you are prompted to migrate the project, click Yes to confirm.

    Migrating a project. Show more or lessRead more... In case you open a workspace that was saved with a previous JDeveloper release, JDeveloper needs to migrate it to the latest versions. Accept the migration for the projects by clicking Next on the Migration wizard.


    Click Finish to proceed.

    The end of migration status

    Click OK to dismiss the Migration Status information window.
  5. You need to create a Database Connection to the FOD schema. To do this, perform the following steps: Right click the Model project node and select Project Properties from context.

    The Project Properties option
  6. In the Project Properties dialog, select the ADF Business Components node and in the Connection field, click the Create icon Add button to create a new database connection.

    Creating a new connection option
  7. Enter a name for the connection, select the connection type, and enter the username and password. To follow along with this example, use FOD for the connection name, fod for the username and fusion for the password. Note that the values provided here as example may need to be modified to work with your environment.

    Property Value
    Connection Name FOD
    Username/Password fod /fusion
    Save Password Checkbox checked
    Driver Thin
    Host Name The machine where the schema is installed (e.g. localhost)
    SID

    The database where the FOD schema is installed (XE, orcl...)


    The new database connection parameters
  8. Click Test Connection to confirm that you can connect.

    Testing the new connection

    Click OK if the connection was successful. Then OK again to dismiss the Project Properties dialog.


    If the connection fails,Show more or lessRead more...
    check that the parameters entered are correct and that the Oracle database and listener services are running.
    The connection should also appear in the Initialize Business Components Project page.
  9. In the Application Navigator, click the Application Resources accordion to open it.

    The Application Navigator
  10. In the Application Resources, expand the Connections and Database nodes to see the FOD connection you just created. You can expand the FOD node to view the database objects.

    The Application Resources
Step 3: Explore the Starter Application

The starter application uses Orders, OrderItems and ProductsBase entity objects and their corresponding view objects. It also uses additional view objects that you discover when required to use them. To explore and validate the data model, perform the following steps:

  1. Open the Application Navigator and expand the Model project nodes. Notice the existing Entities, Views, Links objects and the FODModule.

    The Model project in the Application Navigator

    The model project contains all the necessary components needed for the application.

  2. To run the module in the tester, in the Application Navigator, right-click FODModule and choose Run.

    Running the FODModule

    Wait for the Browser window to open.

    Testing the model. Show more or lessRead more...

    Oracle JDeveloper provides an easy way to test your business components defined in an application module. You can launch the tester by clicking the Run option in the Application Module and the ADF Model Tester opens up. Then select the view component in the hierarchy tree to visualize date retrieved by your entity objects.
  3. In the Oracle ADF Model Tester, double-click OrdersItemsOrdersFkLink1.

    The Oracle Business Component Browser
  4. Use the navigation buttons to browse through the Orders

    The master detail form in the BC browser
    The BC Browser. Show more or lessRead more...

    Notice that you can Insert Update Delete data through the provided default interface and test the validation rules for your business components.

    You can also Commit or Rollback your changes.
  5. Navigate back and forth to explore data.

    Changing master row in the BC Browser
  6. Close the Business Component Browser window.

    Closing the BC Browser
  7. Collapse the Model project. Expand the ViewController project nodes. Notice the existing components that are created by default when creating a Fusion Web Application.

    The ViewController project in the Application Navigator
Step 4: Create the Master Detail Order Page

The ViewController project uses Orders, OrderItems and ProductsBase entity objects and their corresponding view objects. It also uses additional view objects that you discover when required to use them. To create the Master/Detail page that will be used as a foundation of your UI project, perform the following steps:

  1. In the Application Navigator right click the ViewController node and select New from context.

    New menu option for the project
  2. In the New Gallery, click the Current Project Features tab, then select the Web Tier | JSF/Facelets category and select the Page item.

    The New Gallery dialog

    Click OK.

  3. Set the File Name field to OrdersAndStocks.

    Create JSF Page dialog

    Click OK.

  4. The new page opens up in the Design editor. Make sure it's selected.

    The page design editor
  5. From the Component Palette, using the ADF Faces | Layout library, drag and drop a Panel Tabbed component onto the page.
    Use the search box above the component list to find specific components.

    Dropping a Panel Tabbed onto the page
  6. Select the showDetailItem and in the Property Inspector using the Common node, type MDOrders in the text field.

    The Property Inspector
  7. In the Application Navigator, open the Data Controls accordion and expand the FODModuleDataControl node.

    The Data Controls accordion
  8. Drag the OrdersView1 node onto the visual editor, and drop it onto the Page. From the Create context menu, select Forms --> ADF Read-only Form.

    Dropping a DataControl onto the page
  9. In the Edit Form Fields dialog, check the Include Navigation Controls check box., multi select all the fields, and then unselect the following ones: OrderId, OrderDate, OrderStatusCode, OrderTotal, and CustomerId. Then click Delete Delete icon .

    The Edit Form Fields dialog

    Click OK.

    More on how to delete fields. Show more or lessRead more...

    When the list of fields to delete is greater than the list of fields to keep, it's more convenient to multi select all the fields first and then unselect the ones to keep, before clicking the Delete button.

  10. In the Data Controls panel, expand the OrdersView1 node. Drag the OrderItemsView2 node onto the lower part of the form.

    Dropping a DataControl onto the page
  11. From the Create context menu, select Table --> ADF Read-only Table.

    Dropping a DataControl onto the page
  12. In the Edit Table Columns dialog, select both Single Row and Enable Sorting. Multi select all the columns and deselect the following ones: LineItemId, Quantity, UnitPrice, and ProductName. Then click Delete Delete icon.

    The Edit Table Columns dialog

    Click OK.

  13. With the new table selected, in the Property Inspector, using the Layout tab in the Style node, set the StyleClass property to AFStretchWidth.

    The Property Inspector
  14. Select the Common tab and type OrdItem as the Id.

    The Property Inspector
    Overwriting the default Id Show more or lessRead more...

    Changing the Id for a more meaningful one will make it easier later on to identify the component you want to relate to.

  15. The page should look like this:

    The Page design editor
  16. Click Save All Save All icon icon on the JDeveloper menu bar, (or select File | Save All).

  17. Right-click within the page and select Run from context, or click the Run button Run icon to run the page.

    Run context menu option
  18. The page loads up in your browser.

    The page running in the browser
  19. Experiment the Navigation buttons.

    The page running in the browser
  20. Try the sorting facility on any of the detail columns.

    The page running in the browser
  21. Close the browser window.

    At this point you have a working page, you are now going to add graphical components such as bart chart, gauge, gantt chart, geographic info and create a Pivot Table.

Bookmark Print Expand all | Hide all
Back to top
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.