Skip Headers
Oracle® Fusion Middleware Mobile Client Developer's Guide for Oracle Application Development Framework
11g Release 1 (11.1.1.5.0)

Part Number E14826-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

3 Introduction to the ADF Mobile Client Sample Application

The ADF Mobile client sample application, also referred to as the Fusion Order Demo Mobile Client application, is a modified version of the Fusion Order Demo. It demonstrates the extension of the Fusion application technology to mobile platforms. This application is a companion to this guide and is used as an example throughout to illustrate points and provide code examples.

Before you examine the individual components of the sample application in depth, you may find it helpful to install and become familiar with the functionality of the Fusion Order Demo Mobile Client application.

This chapter includes the following sections:

For information on the Oracle ADF Fusion Order Demo application, see "Introduction to the ADF Sample Application" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

3.1 About the Fusion Order Demo Mobile Client Application

The sample application enables you to browse and edit orders for electronic devices. For more information, see Section 3.5.2, "Runtime Components."

The sample application requires an existing installation of Oracle JDeveloper 11g and an Oracle database. For a complete list of tasks for preparing your environment for the Fusion Order Demo Mobile Client application, see Chapter 2, "Setting Up the ADF Mobile Client Environment."

3.2 Installing the Fusion Order Demo Schema

You can download the Fusion Order Demo application from the Oracle Technology Network (OTN) web site.

To download the demo and install the FOD schema to your database:

  1. Navigate to Oracle Technology Network (OTN) http://www.oracle.com/technetwork/index.html and search for "Fusion Order Demo Sample Application."

  2. Download the ZIP file to a local directory.

  3. Start Oracle JDeveloper 11g and from the main menu choose File then Open.

  4. In the Open dialog, browse to the location where you extracted the ZIP file to in Step 1 and select Infrastructure.jws from the infrastructure directory. Click Open.

  5. In the Application Navigator, expand MasterBuildScript and then Resources, and double-click build.properties.

  6. In the editor, modify the properties shown in Table 3-1 for your environment.

    Table 3-1 Properties Required to Install the Fusion Order Demo Application

    Property Description

    jdeveloper.home

    The root directory where you have Oracle JDeveloper 11g installed. For example:

    C:/JDeveloper/11/jdeveloper

    jdbc.urlBase

    The base JDBC URL for your database in the format jdbc:oracle:thin:@<yourhostname>. For example:

    jdbc:oracle:thin:@localhost

    jdbc.port

    The port for your database. For example:

    1521

    jdbc.sid

    The SID of your database. For example:

    ORCL

    db.adminUser

    The administrative user for your database. For example:

    system

    db.demoUser.tablespace

    The table space name where FOD users will be installed. For example:

    USERS


  7. From the JDeveloper main menu, choose File > Save All.

  8. In the Application Navigator, under the Resources node, right-click build.xml and choose Run Ant Target > buildAll.

  9. In the Enter Property dialog, enter the password for the database system user and click Continue.

    Once you enter the password, the Ant build script creates the FOD users and populates the tables in the FOD schema. In the Apache Ant - Log window, you will see a series of SQL scripts and finally:

    buildAll:

    BUILD SUCCESSFULTotal time: nn minutes nn seconds

    For more information on the demo schema and scripts, see the README.txt file in the MasterBuildScript project.

3.2.1 Mounting the Sample Client Database

In addition to installing the FOD database, you also need to install client databases for both Windows Mobile devices and BlackBerry smartphones. The sample client database is delivered on a simulated SD card that is included in the sample application ZIP file, ADFMCSampleApp.zip. The simulated cards are located within ADFMCSampleApp at WindowsMobileSDCard and BlackBerrySDCard.

3.2.1.1 How to Mount the Sample Client Database on Windows Mobile Devices

Use the Windows Mobile simulator to mount the simulated SD card, WindowsMobileSDCard, that contains the sample client database.

Before you begin:

Create the sample database that represents the database used by the server application as described in Section 3.2, "Installing the Fusion Order Demo Schema," download and extract ADFMCSampleApp.zip on your computer, and install the Windows Mobile device simulator. You must start and connect the Windows Mobile simulator to the computer as described in Chapter 2, "Setting Up the ADF Mobile Client Environment."

To mount the client database on a Windows Mobile device simulator:

  1. On the Windows Mobile simulator, choose File > Configure.

  2. In the Shared Folder folder, browse to WindowsMobileSDCard in ADFMCSampleApp, as shown in Figure 3-1.

  3. Click OK.

    Figure 3-1 Mounting the Simulated SD Card on a Windows Mobile Device Simulator

    Browse to WindowsMobileSDCard.

3.2.1.2 How to Mount the Sample Client Database on a BlackBerry Smartphone Simulator

Use the BlackBerry smartphone simulator to mount the sample client database that is contained on the simulated SD card, BlackBerrySDCard.

Before you begin:

Create the sample database that represents the database used by the server application as described in Section 3.2, "Installing the Fusion Order Demo Schema," download and extract ADFMCSampleApp.zip on your computer, and install BlackBerry Java Development Environment (JDE 5.0).

Start the BlackBerry smartphone simulator to the computer as described in Chapter 2, "Setting Up the ADF Mobile Client Environment."

To mount the client database on a BlackBerry Smartphone simulator:

  1. On the BlackBerry smartphone simulator, select Simulate > Change SD Card.

  2. Click Add Directory and then browse to, and select, the BlackBerrySDCard folder. Click OK.

  3. Select BlackBerrySDCard as the current SD card as shown in Figure 3-2. Click Close.

Figure 3-2 Mounting the Simulated SD Card to a BlackBerry Smartphone Simulator

Add BlackBerrySDCard folder.

3.3 Overview of the Fusion Order Demo Mobile Client Application Schema

The schema of the Fusion Order Demo Mobile Client application consists of the following core tables:

Queue-based snapshots (described in "Manage Snapshots on SQLite Mobile Client" in Oracle Database Lite SQLite Mobile Client Guide) create a database file called OSE_<database name>.db. This database file contains the following tables:

In addition to these tables, SQLite replicates the following:

3.4 Running the Fusion Order Demo Mobile Client Application

Before you run the demo application on a BlackBerry Smartphone or a Windows Mobile device, you must first do the following:

  1. Open the demo application in JDeveloper.

  2. Install simulators and other required development tools for the target platforms.

  3. Connect and start the simulators.

  4. Deploy the ADF Mobile client runtime components on BlackBerry smartphones and Windows Mobile devices.

  5. Deploy the demo application to the simulators.

  6. Run the demo application.

For more information on Oracle Lite Mobile Development Kit (MDK), Mobile Sync (mSync), and SQLite Mobile Client, see Chapter 2, "Setting Up the ADF Mobile Client Environment."

3.4.1 How to Run the Demo Application on a Windows Mobile Device Emulator

You run the demo application after you have deployed it to a Windows Mobile device emulator.

To run the demo application:

  1. In JDeveloper, choose Tools the Deploy ADF Mobile Client Runtime then to Windows Mobile.

  2. Choose ADF Mobile Client Runtime and then click Deploy.

  3. Monitor the deployment progress on the Windows Mobile device emulator. Deployment must complete before you deploy another ADF Mobile client runtime component.

  4. Choose Java Virtual Machine and then click Deploy.

  5. Click Close. Verify the deployment by viewing JDeveloper's Deployment-Log file.

  6. In the Application Navigator, right-click the Mobile Client project.

  7. Choose Deploy then choose ADFMCSampleApp_RC1 to Windows Mobile Device.

  8. On the Windows Mobile simulator, use the File Explorer utility to navigate to My Device then Program Files and then MobileFOD.

  9. Select the MobileFOD executable file, as shown in Figure 3-3.

    Figure 3-3 Selecting the MobileFOD Executable File

    Select the MobileFOD executable to run demo.

    Figure 3-4 shows the Fusion Order Demo Mobile Client application's Browse page, which appears after you click the MOBILEFOD executable. For more information, see Section 3.5, "Taking a Look at the Fusion Order Demo Mobile Client Application."

    Figure 3-4 The Browse Order Page

    The blank Browse Order page.

3.4.2 Running the Sample Application on a BlackBerry Smartphone Simulator

Before you run the sample application on a BlackBerry Smartphone or simulator, you must download the BlackBerry Java Development Environment (JDE 5.0), the BlackBerry smartphone simulator, and BlackBerry Desktop Manager from BlackBerry (http://na.blackberry.com).

3.4.2.1 How to Start the Demo Application on a BlackBerry Smartphone Simulator

You run the demo application after you have deployed it to a BlackBerry smartphone or simulator.

Before you begin:

You must set the location of the JDE and the simulator directory in which JDeveloper places the COD file.

To run the demo application:

  1. If needed, stop the BlackBerry smartphone simulator.

  2. In JDeveloper, choose Tools then Deploy ADF Mobile Client Runtime then choose to BlackBerry Simulator.

  3. Choose ADF Mobile Client Runtime and then click Deploy.

  4. In the Application Navigator, right-click the mobile client project.

  5. Choose Deploy then ADFMCSampleApp_BlackBerry to BlackBerry Device.

  6. After the deployment completes, start the BlackBerry smartphone simulator.

  7. On the BlackBerry smartphone or simulator, navigate to the Downloads folder, as shown in Figure 3-5.

  8. Click ADFMCSampleApp_BlackBerry.

    Note:

    Do not deploy an application to BlackBerry smartphone simulator while it is running. To load the COD file to the simulator, you must first stop it, then restart it. If you would like to deploy a COD file manually, put it in the simulator location specified in the Mobile Client Preferences page described in Chapter 2, "Setting Up the ADF Mobile Client Environment."

    Figure 3-5 The BlackBerry Smartphone Downloads Folder

    Downloads folder.

3.5 Taking a Look at the Fusion Order Demo Mobile Client Application

The design time artifacts of the ADF Mobile sample application are visible in Oracle JDeveloper. Its runtime UI consists of screens that are displayed natively on the device outside of a mobile browser.

3.5.1 Design Time Components

After you have opened the projects in Oracle JDeveloper, you can then review the artifacts within each project. The development environment for the Fusion Order Demo Mobile Client application contains a view-controller project named MobileClient and a model project named Model.

3.5.1.1 MobileClient Project

MobileClient project contains the files for the interface, including the backing beans, deployment files, and MCX files (the ADF Mobile client equivalent of the JSPX file).

Figure 3-6 The MobileClient Project

MobileClient project contents

Figure 3-6 shows the MobileClient project and its associated directories. The MobileClient project contains the following directories:

  • Application Sources: Contains the code used by the mobile client, including the managed and backing beans, property files used for internationalization, the metadata used by ADF Mobile client to display bound data as well as the MCX files and images. This project also includes MobileClient-task-flow.xml, the source file for the bounded task flow.

  • META-INF (subdirectory of Application Sources): includes the following:

    • UiApplication.jad—the Java Application Descriptor file (JAD) that is required by BlackBerry to deploy applications over the air (OTA).

    • adfm.xml—Used at runtime in order to help resolve data bindings.

3.5.1.2 Model Project

The Model project (shown in Figure 3-7) is a data model project that contains the data definitions that allow the product data to be displayed in the sample application.

Figure 3-7 The Model Project

Mobile project contents

The Model project contains the Application Sources directory, which contains the files used to access the product data. Included are the metadata files used by Oracle Application Development Framework (ADF) to bind the data to the view.

3.5.2 Runtime Components

The Fusion Order Demo Mobile Client application displays the following pages at runtime:

  • Browse Orders (home.mcx)

  • Order Details (details.mcx)

  • Edit Order (editorder.mcx)

  • Order Items (orderitems.mcx)

3.5.3 Browsing Orders

You start the Fusion Order Demo Mobile Client application by running the home.mcx page. This page, which is the entry point of the application, displays on a BlackBerry smartphone or Windows Mobile device as the Browse Orders page. As shown in Figure 3-8, this page contains a dropdown list of order status codes. You use this list in conjunction with the page's Search button to retrieve a list of customers whose orders belong to the category that you selected. Clicking a customer name opens the Order Details page (shown in Figure 3-12), which displays information about the customer.

Clicking Add Order displays the Add Order page, which is comprised mainly of inputText components. For more information about the Order Details page, see Section 3.5.4, "Viewing Order Details." For more information on the Add Order page, see Section 3.5.5, "Editing or Adding an Order."

Figure 3-8 The Browse Order Page

The Browse Order page.

After you select an order status and click Search (a commandButton component), the application performs a search, executes a query and populates the table. Figure 3-9 shows the results of selecting the Order being picked status. As illustrated in Figure 3-9, the table is populated with a status image, the customer name, and read-only information about the date of the order and its total cost. The name is a commandLink component that enables you to navigate to the details screen.

Figure 3-9 Records Retrieved by Order Status

Orders retrieved by order status.

The images are dynamic, reflecting the status of the order. Note, for example, that the images reflect the Order being picked status in Figure 3-9 and the Order completed status in Figure 3-10.

Figure 3-10 Dynamic Images

Images change per order status.

Where to Find Implementation Details

Following are the sections of Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework and Oracle Fusion Middleware Mobile Client Developer's Guide for Oracle Application Development Framework that describe how to define queries and create query search forms:

  • Laying out ADF Mobile Tables

    The Browse Orders page includes a single-column table which uses panelGroupLayout components for the status images and the output text. For more information, see Section 6.8, "Creating and Using Tables."

  • Enable navigation through the application

    The demo application provides navigation using commandLink components, In Figure 3-10, Add Order and the customer names (for example, Nancy Greenberg) are commandLink components. For more information, see Section 6.9, "Using Buttons and Links."

  • Creating dynamic images

    The page achieves the dynamic, status-related images through an EL expression and a string. For example,

    <amc:image id="image1"source="/statusimages/#{row.OrderStatusCode}.gif"/>
    

    For more information see "Creating EL Expressions" in Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework and also "Displaying Images."

  • Creating a static view object

    In the Browse Orders page, the selectOneChoice component for the order status is backed by a list binding. The Status and StatusDesc attributes of the OrderStatus view object, a static view object, populate the values for the dropdown list. For more information, see "Populating View Object Rows with Static Data" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  • Defining a list of values for selection lists

    Input forms displayed in the user interface can utilize databound ADF Faces selection components to display a list of values (LOV) for individual attributes of the data collection. To facilitate this common design task, Oracle ADF Business Components provides declarative support to specify the LOV usage for attributes in the data model project. For example, in the Fusion Order Demo application, the selectOneChoice component displayed in the Browse Orders page is bound to LOV-enabled attributes configured for the OrderStatus view object. For more information about configuring attributes for LOV usage, see "Working with Lists of Values (LOV) in View Object Attribtutes" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  • Creating menus for Windows Mobile devices and BlackBerry smartphones

    Windows Mobile applications have two types of menus: The Main menu and the ALT menu. The Main menu describes the right Standard menu button for the form (such as the Menu button in Figure 3-10) and the ALT menu is the left Standard menu button for the form. For BlackBerry, the MAIN menu describes the Full menu for the form. The ALT menu is amalgamated into the Full menu for the form. For more information, see Section 6.11, "Creating and Using Menus."

3.5.4 Viewing Order Details

The Order Details page displays information about the customer who placed the order.

Figure 3-11 The Order Details Page

Order details shows customer data.

This page contains two navigational links: Back to Order List, which you use to return to the result list shown in Figure 3-10 and Show Order Items. Clicking Edit enables you to edit the order details. For more information, see Section 3.5.5, "Editing or Adding an Order."

Figure 3-12 The Order Items Page

Order details shows list of customer orders.

Clicking Show Order Items enables you to drill down to a list of ordered items that match the status that you selected in the Browse Orders page. For example, Figure 3-12 shows customer Nancy Greenberg's items that have the status of Order completed (shown in Figure 3-10). This page also includes a form that enables you to filter order items. For more information, see Section 3.5.6, "Viewing Ordered Items."

3.5.5 Editing or Adding an Order

Clicking Edit opens a read-write form that enables you to modify order details. This page (editorder.mcx) displays as either the Edit Order page or the Add Order page depending on if the user is at the Browse Page (home.mcx) or the Order Details page (details.mcx).

Figure 3-13 The Edit Order Page

Editing order details.

Where to Find Implementation Details

Following are sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework and Oracle Fusion Middleware Mobile Client Developer's Guide for Oracle Application Development Framework that describe how to create a task flow and how to create an input form with required values.

  • Laying out the ADF Mobile page

    This page, called editorder.mcx, consists primarily of inputText components within panelFormLayout and panelLabelAndMessage components. For more information, see Section 6.4, "Designing the Layout of the Page."

  • Grouping activities using a bounded task flow

    ADF Mobile client applications use bounded task flows. As described in "Task Flow Types" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework, a bounded task flow has one point of entry, zero or more exits, and represents the reusable portion of an application. The task flow for the demo application (MobileClient-task-flow.xml) is comprised of view activities (home.mcx, editorder.mcx, details.mcx, and orderitems.mcx), a router activity, a task flow return, and a wildcard control rule. For more information see Section 6.2, "Creating Task Flows."

  • Using a router activity

    The conditional routing that enables editorder.mcx page to display as either the Edit Order page or the Add Order page is achieved through a router in the application's task flow that evaluates the applicationScope EL expression for the panelGroupLayout component. If the scope variable for addMode is true (that is, when the user is at the Browse Order page), then the application opens the Add Order page. For more information, see "Using Router Activities" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  • Creating a databound edit form

    When you want to create a basic form that collects values from the user, instead of having to drop individual attributes, JDeveloper allows you to drop all attributes for an object at once as an input form. You can create forms that display values, forms that allow users to edit values, and forms that collect values. For example, in the Fusion Order Demo application, the Order Details displays a form that displays user information and the Add Order and Edit Order forms used for collecting shipping information for the user's order. For more information, see "Creating an Input Form" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework and Section 6.5, "Creating and Using Input Components."

  • Creating databound UI controls

    The page's selectOneChoice components are used to filter view accessors and lists of values for status codes and for customer ID. Such selectOneChoice components are created by dragging and dropping the OrderStatus Code and CustomerID attributes of the OrderView data control into the Structure view and then by selecting Select One Choice from the context menu.

  • Using commit and rollback functions

    The page's Save and Undo menu functions are standard ADF commit and rollback operations. For more information, see Section 6.11, "Creating and Using Menus."

3.5.6 Viewing Ordered Items

The Order Items page lists the items that the customer has ordered, providing information on the number of units and the price of each item. You can filter the results using the search form, as shown in Figure 3-14.

Figure 3-14 The Order Items Page

The Edit Order Page

Where to Find Implementation Details

  • Creating a search form

    You create a query search form by dropping a named view criteria item from the Data Controls panel onto a page. The Order Items page includes a search form, one that JDeveloper creates automatically when you drag a view object in to the Structure view and then select Filtering as the Enable ADF Behavior option in the Edit Table Columns dialog. For more information, see "Creating Query Search Forms" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  • Displaying the results of a query search

    Normally, you drop a query search panel with the results table. JDeveloper automatically wires the results table with the query panel. For more information, see "How to Create a Query Search Form and Add a Results Component Later" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.