Developer Tools
JDeveloper
You can work in JDeveloper's IDE to create a JSF application targeted for Mobile Device Browsers.
Install the schema: Download the schema zip file from OTN and install it. The cue cards use tables that are part of the Fusion Order Demo (FOD) schema.
Create a new application: Use the Create Application dialog to create an application for ADF Mobile.
Create a database connection: Use the Create Database Connection dialog to create a connection to the schema.
Create Oracle ADF Business Component objects: Use the Create Oracle ADF Business Components wizard to create the business components that will provide access to data and implement the business logic.
Edit the View Object : Modify the View Object to include only the fields necessary for the application.
Add Validation Logic: Add validation rules to the Entity Object.
Test the Application Logic in the Business Component Tester: Use the Business Component Tester to test the application logic components created in the previous steps.
Set the Screen Size: Use the Preferences dialog to set the default screen size for target mobile devices.
Create the ADF Mobile Project: Create the ViewController project for an ADF Mobile Application, and select the appropriate technology scope.
Create the Page Flow: Create the page flow for the ADF Mobile application.
Create a JSF Page: Create a JSF Page for mobile devices to browse orders by double clicking on the page in the Page Flow Editor.
Create a Browse Page: Define the JSF for browsing orders in mobile device browsers containing a read-only form and a table.
Create an Edit Page: Define the JSF for browsing orders in mobile device browsers containing a form to edit orders.
Run the Application: Run the application in a mobile device simulator.
Optimize the Layout:Create a Static View Object: Create a static view object for the order status values.
Create a Static LOV: Create a static LOV for the order status field on the Edit Order form, so the order status description is displayed in a drop-down list box.
Create a Lookup View Object: Create a lookup view object for the Customer ID field, so customer names can be displayed instead of the ID in the Edit Order view.
Create a Dynamic LOV: Create a dynamic LOV for the Customer ID field on the Edit Order form, so the customer name is displayed in a drop-down list box.
Test the LOV: Run the application after LOVs are added to the Edit Order view.
.
The steps and examples in the cue cards are based on tables that are part of the Fusion Order Demo (FOD) schema. This schema is also used as the database for the sample application that ships with Oracle JDeveloper 11g, as well as other collateral in this release. It will be convenient to have this schema installed, and you only need to do it once. If you have already installed the FOD schema, you can skip this step and go directly to the next card. [ tell me more...]
c:\temp).
c:\temp\Infrastructure\infrastructure.jws.
jdeveloper.home, and all the
jdbc.* and
db.* settings). Keep all other properties set to their default values. The demo user must be named
FOD.
/jdeveloper directory where you have JDeveloper installed, for example,
c:/JDeveloper_11/jdeveloper/
jdbc:oracle:thin:@localhost
1521
XE or
ORCL
system
USERS
After running the Ant task, you should see a build successful message in the JDeveloper Log window. [ tell me more...]
The JDeveloper application is the highest level in the organizational structure. It stores information about the objects you are working with, while you are creating your application. It keeps track of your projects and the environment settings while you are developing. [ tell me more...]
Application templates provide you with a quick way to create the project structure for standard applications with the appropriate combination of technologies already specified. The new application created from the template appears in the Application Navigator already partitioned into tiered projects, with the associated technology scopes set. The application template you select determines the initial project structure (the named project folders within the application) and the application libraries that will be added. The project templates define the associated technologies. You can modify existing templates or create new ones. You can then filter the work you do in JDeveloper such that the choices available are focused on the technologies you are working with. [ tell me more...]
adfm).
oracle.fod.mobile and then click
Next.
model).
In creating this application, you use the Create Generic Application wizard. You can use this wizard to create both an ADF Mobile application and project. After you open the wizard by selecting Applications and then Generic Applications in the New Galery, the first page opens where you enter the name of the mobile application and the Application Package Prefix: [ tell me more...]
You can connect to any database for which you have connection details, or install the sample schema used in the cue card examples and then establish a connection to it. If you installed the sample schema, you will be able to follow the steps in the cue cards exactly as written. If you work with your own database, you can supply your own values as needed. [ tell me more...]
FOD for the connection name and
fod for the username.
The database connection is now included as a resource for your application. [ tell me more...]
Oracle ADF Business Components is a model layer technology in the Oracle Application Development Framework (Oracle ADF). Oracle ADF Business Components is a fully-featured, XML-based framework for creating business services. That is, it governs interaction between the rest of the application and the data stored in the datasource, providing validation, specific services, and other business logic. [ tell me more...]
FODModule. Then click
Finish
.
The Create Oracle ADF Business Components from Tables wizard does not create a user interface (this is governed by the "view" portion of the application), nor does it determine other application logic such as control flow. It just provides a representation of, and access to, data, and implements business logic. [ tell me more...]
After completing the Business Components from Tables wizard, the model project in the Application Navigator should look like this: [ tell me more...]
A view object's main role is typically to fetch the data to be displayed by a client. You will modify the default view objects that you created earlier to reflect the data that will be displayed in your web pages. [ tell me more...]
Delete.
By removing attributes from the OrdersView view object you have reduced the number of columns in the view object's query. [ tell me more...]
A view object can be based on more than one entity object; you do this if you need your client pages to show data from multiple tables. In the list of order items on the client page you will show each item's id, quantity and price, from the OrderItems entity object, as well as the product name, from the ProductsBase entity object. [ tell me more...]
The OrdersView view object now contains attributes from both the Orders entity object and the ProductsBase entity object. Notice that OrderItemsView now contains two ProductId attributes: ProductId from the OrderItems entity object and ProductId1 from the ProductsBase entity object; this is necessary to specify the join between the two entity objects. [ tell me more...]
You can add validation logic to enforce a rule, in this case the rule that an order's ship date must occur after the date the order was placed. You will create your validation rule using ADF BC's declarative validation capabilities, and define the logic using the Groovy scripting language. [ tell me more...]
Add next to
Entity Validation Rules.
OrderShippedDate == null || OrderShippedDate >= OrderDate in the
Expression panel. Click
Test to verify the expression, and click
OK when you see the expression syntax check popup.
Add to add a row to the first table.
Orders_10. Change the default
Message String to
{0} cannot be earlier than {1}. Then press Enter or Tab.
source.hints.OrderShippedDate.label as the
Expression. For
Message Token 1, enter
source.hints.OrderDate.label. Then click
OK.
You have created a custom error message for your validation rule; the
{0} and
{1} are placeholders for parameters that you will define as the labels of the
OrderShippedDate and
OrderDate attributes. ADF Business Components allow you to create custom labels for each attribute; these labels are stored in message bundles that can be translated for different locales, and they are automatically displayed as the attribute's label on client pages. In this example you have not defined custom labels, so the labels default to the names of the attributes. [
tell me more...]
You can test the validation rules you added, in the ADF Business Components Tester. The tester is a dynamically generated Swing client that allows you to test your business components. It is useful for testing any enhancements, such as validation rules, LOVs or custom methods, that you have added to your business components; it is also a useful troubleshooting tool because it helps to narrow down problems by removing any client code from the picture. [ tell me more...]
2007-01-14, enter
2007-01-13 for the order shipped date.
2007-01-14, enter
2007-01-15 for the order shipped date, so that no error dialog displays.
After entering valid data, the tester shows the data that you have just saved to the database: [ tell me more...]
JDeveloper enables you to set the visual editor to the dimensions of a mobile device screen. In the example below, the screen size of the visual editor is set to 240X320 Pixels. This provides a visual aid in designing pages for mobile browsers. [ tell me more...]
The Preferences dialog enables you to set the default size of the visual editor to give you an approximation of how the components fit on a mobile device screen. [ tell me more...]
A JDeveloper project is used to logically group files that are related. A project keeps track of the source files, packages, classes, images, and other elements that your program may need. You can add multiple projects to your application to easily access, modify, and reuse your source code. [ tell me more...]
mvc as the name of the project. (
mvc stands for "Mobile" View Controller) and then click
Next.
Entering short, lower-case names for ADF Mobile applications and projects creates a shorter URL, which is easier to enter from a mobile device. [ tell me more...]
When you move Mobile from the Available pane to the Selected pane, Java, JSF (JavaServer Faces), JSP (JavaServer Pages) and Servlets are also shuttled to the pane. When you add Mobile technology, the Apache My Faces Trinidad library is automatically loaded to the workspace and the Trinidad component palette will be loaded when you create mobile JSF pages. [ tell me more...]
The mvc ("mobile" view-controller) project in the application contains a default JSF page flow,
faces-config.xml. A page flow includes the JSF pages and page navigation rules that define an application's page flow. [
tell me more...]
/br-o. This page is a browse order page, the the first application page which represents the default activity.
/ed-o.
/br-o and then
/ed-o in the visual editor.
goEdit on the outcome label of the JSF Navigation Case.
goBrowse on the outcome label of the JSF Navigation Case.
The page flow contains two JSF pages: browsing orders and editing orders, which are represented by the /br-o and /ed-o JSF pages. These pages are connected using the JSF Navigation Case components. [ tell me more...]
The pages you create for your web application using JavaServer Faces are JSP documents (which have the file extension
.jspx) or JSP pages (which have the file extension
.jsp). [
tell me more...]
/br-o.jspx and then click
OK. (Because Mobile technology scope is selected during Project creation, the
Render in Mobile Device option is selected by default.)
Browse Order.
To create the user interface, add Apache MyFaces Trinidad components to the JSF pages. [ tell me more...]
Browse Order as the text property in the Panel Header's Property Inspector.
The visual design of
br-o.jspx is displayed in the visual editor, and the Structure window shows the page's structure. As you add components to the page, you will drop them inside the
panelGroupLayout component, and their arrangement will be controlled by the layout manager of the
panelGroupLayout component. [
tell me more...]
The browse page enables a user to view and navigate through the data objects one at a time. Both a read-only form and read-only table will be added to supply the master/detail functionality in this browse page. You will add components to the br-o page, to browse orders and order items. The orders are shown one at a time, with the order information in a read-only form and the order's line items in a table. [ tell me more...]
The Data Control panel comprises a hierarchical display of available business objects, methods, and data control operations. [ tell me more...]
Edit as the Text property.
goEdit from the Action property drop-down list.
ID for the Header Text property in the Property Inspector.
Quan., the UnitPrice column as
Price, and the ProductName as
Name.
100% for the Width property.
The visual editor shows the read-only form, table and buttons that make up your page, and the Structure view shows the hierarchy of the components in the page. You can reorganize the page structure by dragging components in the Structure view, or moving them in either the visual editor or source editor. [ tell me more...]
ADF drag and drop databinding allows you to bind visual components on a page to data or to actions. You will use both techniques: you will create a form to edit orders data; and you will bind a button to the commit action. [ tell me more...]
Edit Order as the Text property in the PanelHeader's Property Inspector.
By dragging the commit operations from the data control panel onto the page, you create a button that saves the transaction on the editing page and also a button that returns the user to the browsing page. Note that while each data collection contains its own set of operations such as next, previous, create, and execute, the commit and rollback operations apply to all data in the data control. [ tell me more...]
Save as the Text property and then select
Reset to Default for the Disabled property.
Return as the Text property and then select
goBrowse from the Action property drop-down list.
When you create your edit page, the page should look like this in the visual editor: [ tell me more...]
The JDeveloper IDE includes a Java EE runtime service for packaged archive deployment called Integrated WLS. Based on zero-copy deployment, Integrated WLS lets you run and test an application and its projects as a Java EE application in a Java EE container. Integrated WLS server instances can be bound to applications and then started, stopped, and debugged. [ tell me more...]
To test an ADF Mobile application using an emulator, enter your computer's IP Address into the application URL, in place of the localhost reference. Device emulator cannot resolve the localhost reference as it simulates a network device, so you must substitute the localhost reference with the IP address of your computer. Other than the host name, the remainder of the application URL is correct. For example, enter
http://<IP Address>:<Port Number>/adfm-mvc-context-root/faces/br-o.jspx in the device browser. [
tell me more...]
When you run the
br-o.jspx page, it should look similar to this page in your browser: [
tell me more...]
In this step, you optimize the layout of both the .jspx pages for display on mobile devices by restricting the number of rows that display on browsing page and the field width on the editing page. Furthermore, you specify the display of the views to take up the entire viewport on the mobie device. This allows UI components to remain viewable even with increased screen resolution. [ tell me more...]
2 for the Rows property.
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
5 for the Columns property.
12 for the Columns property.
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
When you first open the br-o.jspx, the table component contains the defualt number of rows. [ tell me more...]
A static LOV is based on a view object where transient attributes are created and populated at design time. You will define a view object, populate it with the static values needed for the LOV and associate it with the view object that will use it as an LOV. [ tell me more...]
StatusCodes as the name of the view object.
StatusCodes as the name of the attribute and select
Key Attribute
. Then click
OK.
StatusDesc as the name of the attribute and click
OK. Then click
Next
twice.
Add seven times to create the static list values. Enter values and descriptions for
StatusCodes and
StatusDesc, for example:
PENDING Order submitted
SHIP Order is being shipped
PICK Order is being picked
COMPLETE Order complete
CANCEL Order cancelled
STOCK Waiting for stock
CART Order in cart
When you define a static list for a view object, JDeveloper creates a standard message bundle file in which to store them. The file is specific to the view object component to which it is related, and it is named accordingly. Internationalizing the model layer of an application built using ADF Business Components entails producing translated versions of each component's message bundle file. For example, the Italian version of the
ModelBundle.properties message bundle would be a class named
ModelBundle_it.properties, and a more specific Swiss Italian version would have the name
ModelBundle_it_ch.properties. [
tell me more...]
Add. Select
StatusCodes in the
Available View Objects
pane and shuttle it to the
View Accessors pane. Then click
OK.
Add next to the
List of Values item.
When you add the view object as a view accessor, it should look like this: [ tell me more...]
A static LOV is based on a view object where transient attributes are created and populated at design time. You will assign the view object to a specific attribute that requires an LOV and choose how the LOV will be displayed. You then edit a page to display the attribute as an LOV list. [ tell me more...]
The status codes are displayed as a choice list in the LOV UI. With a choice list, other options are available: you can display multiple columns in the LOV (in this example, the status code); and also allow the user to leave the selection blank. You also could have used a different LOV UI, for instance a combo box or a radio group. [ tell me more...]
In the edit page, an LOV is available next to the OrderStatusCode field: [ tell me more...]
A dynamic LOV is based on a view object which provides the SQL to populate the list of values. You will define the view object and specify the query that will used as the basis for the LOV in this case, retrieving all the customers. Once you've configured a view object to provide a list of values for a given field, you can easily allow that list to be used for validation. In this example, you can ensure that the CustomerId value that a user enters in the editOrders form is a valid CustomerId, that is, a value that is in the list of values. [ tell me more...]
CustomerView as the name of the view object.
SELECT * from PERSONS Persons
WHERE Persons.PERSON_TYPE_CODE = 'CUST'
The new view object can be added as a view accessor in the View Accessors dialog, available by clicking the View Accessors tab in the overview editor. [ tell me more...]
Add to open the View Accessors dialog. Select
CustomerView in the
Available View Objects
panel and shuttle it to the
View Accessors panel. Then click
OK.
Add next to the
Validation Rules item.
You created a view object that can be used as the provider for a list of values in the user interface. That view object also serves as a list of valid values in the validation of the CustomerId field. [ tell me more...]
You will use the dynamic view object (a view object populated from a SQL query) created earlier as the basis for a list of values. You will remove the CustomerId field from the form, and replace the field with an inputListOfValues component. This component displays as an input text field, with a button next to it which can be activated to display the list of values in a separate window. You will configure the list of values to display a subset of columns from the view object, and specify the relationship between the field and the value selected from the list [ tell me more...]
Add next to the
List of Values item, to create an LOV for this item.
Using the Data Controls panel, you can add the List of Values for CustomerId to the page, replacing the inputText field for CustomerId after you delete it. [ tell me more...]
You added an selectOneChoice component to the
ed-o.jspx form. Clicking on the button activates the list of values, from which you can select a value for the field from a user-friendly interface. [
tell me more...]