Legal | Privacy



Building a LOV with ADF UIX





Building a List of Values (LOV) with ADF UIX

This tutorial teaches you how to build a UIX page containing a List of Values (LOV).

Time to Complete

Approximately 30 minutes.

Topics

The tutorial contains the following sections:

Overview
Prerequisites
Create workspace, projects and ADF Business Services

Create View Controller components

Add the LOV functionality
Apply a filter to the LOV Window
Summary
Related Information

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.

 

Overview

The tutorial uses Oracle JDeveloper 10g to build an ADF UIX application that contains an LOV. The tutorial demonstrates how easy it is to create an LOV, and how you can apply a filter to your LOV using Oracle JDeveloper 10g.

Back to Topic List

The UIX page that you create in this tutorial will display employees information based on the "Human Resources" data model. After creating the Business Services layer, You will create a UIX page showing an employee record with an LOV displaying the Departments information.

Back to Topic List

Prerequisites

Before starting this tutorial, you should have completed the following:

1.

Install Oracle JDeveloper 10g.

 

2.

Install the sample schemas. This example uses the HR schema included in the Oracle database. The Sample Schemas installation guide is part of the Oracle Database documentation set. You may also install the schemas by following the instructions found in the Installing the Sample Schemas and Establishing a Database Connection OBE.

 

Back to Topic List

Create Workspace, Projects and ADF Business Services

When you work in JDeveloper, you organize your work in projects within application workspaces. JDeveloper provides a number of predefined templates which allow you to create a workspace and projects that are configured for developing the types of application you are working on. The templates provide the basic range of technologies that are needed, and you create your working environment by selecting the one that fits your needs, then configuring it to add any additional technologies you are going to use. The options that are available to you in the New Gallery and for some context menu operations depend on your choice of template for that workspace.

In this tutorial, you are going to choose the basic workspace and project creation with no predefined technology.

Create a new Workspace with empty projects
Create the business services

Back to Topic List

Create a New Workspace With Empty Projects

1.

In the application navigator, right-click Applications and choose New Application Workspace from the context menu.

Move your mouse over this icon to see the image


2.

In the Create Application Workspace dialog, rename the workspace Application to LOVApplication.
.(Notice that the directory name changes to match the new name.)
Change the Application Template to Web Application [default], and click OK.

Move your mouse over this icon to see the image

 

3.

On completion, you should have an application named LovApplication and two projects named Model and ViewController.

Move your mouse over this icon to see the image

 

4. From the File menu, choose Save All or click the icon.

Back to List

Create the Business Services

This section is going to cover how to create the business services layer using ADF business components.

1.

Select the Model node in the application navigator, and right-click to choose New to display the New Gallery.

Move your mouse over this icon to see the image


2.

In the New Gallery, open the Business Tier node, select the Business Components category and double-click the Business Components from Tables item.

Move your mouse over this icon to see the image

 

3.

In the Business Components Project Initialization dialog, select the connection that you created for the human resources (hr) schema, for example, hr_conn, and click OK.

Move your mouse over this icon to see the image

 

4.

The Create Business Components from Tables wizard appears. Click Next on the Welcome page to begin.

Move your mouse over this icon to see the image

 

5.

In Step 1 of 4: Entity Objects page, choose the HR schema from the dropdown menu of available database schema objects, then select the object type of Tables (if it is not already selected).
Select the DEPARTMENTS and EMPLOYEES tables in the Available list and click the Move button to move those selections to the Selected list.

Move your mouse over this icon to see the image


Click Next to continue.

 

6.

In Step 2 of 4: Updateable View Objects page, click the Move All button to move Departments and Employees views to the Selected list.

Move your mouse over this icon to see the image


Click Next to continue.

 

7.

Click Next on the Read Only View Objects From Tables page, and in the Application Module page, make no changes and click Next.

Move your mouse over this icon to see the image

 

8.

Click Finish to create the business components in the Model project

Move your mouse over this icon to see the image

 

9.

Your project should look like this:

Move your mouse over this icon to see the image

 

10.

From the File menu, choose Save All or click the icon.

 

Back to List

Back to Topic List

Create View Controller Components

In these steps you will create a UIX page to access the business components. The procedure shows how to create a form that displays data from Employees views using the Data Control Palette.

Create a Struts pageflow diagram
Create a UIX Input page
Add an Input Form to your page

Back to Topic List

Create a Struts Pageflow Diagram

1.

Expand the ViewController > Web Content > WEB-INF nodes in the application navigator, and double-click the struts-config.xml file.

Move your mouse over this icon to see the image

An empty pageflow diagram opens.

Move your mouse over this icon to see the image


2.

If the component palette isn't displayed, then open it from the menu View | Component Palette.

Move your mouse over this icon to see the image

 

3.

In the component palette, select the Data Page icon.

Move your mouse over this icon to see the image

Click the pageflow diagram to create the data page.

Move your mouse over this icon to see the image


4.

Rename the datapage /dataPage1 to /EmpWithLOV.

Move your mouse over this icon to see the image

 

Back to List

Create a UIX Input Page

1.

Double-click the /EmpWithLOV datapage on the pageflow diagram.

Move your mouse over this icon to see the image

 

2.

In the Select or Create Page dialog, leave the default name (/EmpWithLOV) and select the UIX option from the dropdown list. Click OK

Move your mouse over this icon to see the image

 

3.

The UIX XML page opens in the visual editor.

Move your mouse over this icon to see the image

 

4.

If the Data Control palette is not displayed, open it from the menu, choose View | Data Control to display it.

Move your mouse over this icon to see the image

 

5.

From the File menu, choose Save All or click the icon.

 

Add an Input Form to Your Page

1.

In the data control palette, expand the AppModuleDataControl node to display the available data controls - EmployeesView1 & DepartmentsView1.

Move your mouse over this icon to see the image

 

2.

Select the EmployeesView1 node under AppModuleDataControl and look at the different options available in the Drag and Drop as dropdown list.

Move your mouse over this icon to see the image

 

3.

Select Input Form (With Navigation) from the dropdown list:.


Move your mouse over this icon to see the image

 

4.

Drag and drop the EmployeesView1 node into the center of your page.

Move your mouse over this icon to see the image

Your page should now contain one input form that can be used to enter values. Your page should look like this:

Move your mouse over this icon to see the image

 

5.

From the File menu, choose Save All or click the icon.

 

 

Back to List

Back to Topic List

Add the LOV Functionality

We would like to add an LOV to the EmpWithLOV.uix page, for the Departments field. This field will be used to enter and change the department for a particular employee.

Add the LOV call in the EmpWithLOV page
Create the LOV window
Run the data page

Back to Topic List

Add the LOV Call in the EmpWithLOV Page

1.

In the EmpWithLOV editor, select the DepartmentId row.
.

Move your mouse over this icon to see the image

Remove the current DepartmentID field in the page.

Move your mouse over this icon to see the image

 

2.

Select the DepartmentId attribute in the DataControl palette underneath the EmployeesView1 node and set the "Drag and Drop As:" type to: MessageLovInput

Move your mouse over this icon to see the image

 

3.

Drag and drop the DepartmentId node onto the page. Your page should look like this:

Move your mouse over this icon to see the image

 

4.

From the File menu, choose Save All or click the icon.

 

Back to List

Create the LOV Window

When you used the Data Control palette to create your new MessageLovInput field, JDeveloper created a new UIX page called lovWindow0.uix, that is pre-wired to your MessageLovInput field. The only thing that you have to do is to add the data source for the LOV window.

1.

Open the application navigator and double-click the lovWindow0.uix node.

Move your mouse over this icon to see the image

The LovWindow0.uix page displays in the editor.

Move your mouse over this icon to see the image

 

2.

In the Data Control palette select the DepartmentId attribute underneath the DepartmentsView1 node.

Move your mouse over this icon to see the image

 

3.

In the "Drag and Drop As" list, choose "LOV Table", then Drag and drop the DepartmentId node on the page.

Move your mouse over this icon to see the image

 

4.

When you drop the DepartmentId attribute on your page, you will be prompted with the Select pageflow Data Binding Option dialog. Keep the default value; this will add a new node in your Struts page flow that will represent your lovWindow0.uix page.

Move your mouse over this icon to see the image

 

5.

Your page should look like this:

Move your mouse over this icon to see the image

 

6.

From the File menu, choose Save All or click the icon.

 

 

Back to List

Run the Data Page

1.

Open the Struts pageflow diagram.

Move your mouse over this icon to see the image

 

2.

Right-click the EmpWithLOV data page, and select the Run option from the context menu.

Move your mouse over this icon to see the image

 

3.

The UIX page opens in your browser.

Move your mouse over this icon to see the image

 

4.

Click the flash light icon located next to the Department field to open the LOV window.

Move your mouse over this icon to see the image

 

5.

Select a department by clicking on one of the radio buttons.

Move your mouse over this icon to see the image

To return to the main page, click on the Select button.

 

6.

The EmpWithLOV page should reflect the change of the department number, and the selected value will be returned to the Department Id field.

Move your mouse over this icon to see the image

 

7.

Close the browser window and return to JDeveloper.

 

 

Back to List

Back to Topic List

Apply a Filter to the LOV Window

As you will have noticed, the LOV window contains a Search field. This Search field is not wired up by default and in this session we will add some components in order to make this work.

In the listOfValues components, there are several named children (slots) that can be used, and one of them is particularly designed to hold a dropdown list - filterChoice. In ADF UIX terminology, we call dropdown lists "choice" components.

Add a Dropdown list to the search area
Modify the lovFilter event handler

Back to Topic List

Add a Dropdown List to the Search Area

First we need to add a dropdown list, so that the user can decide what search criteria to use.

1.

In the application navigator, double-click the lovWindow0.uix node to open it in the visual editor.

Move your mouse over this icon to see the image

 

2.

In the structure window, click the UI tab, then expand the nodes and select the filterChoice entry.

Move your mouse over this icon to see the image

 

3.

Right-click on the filterChoice slot and select "Show filterChoice Named Child".

Move your mouse over this icon to see the image

This will display the empty named child (slot) in the visual editor.

Move your mouse over this icon to see the image

 

4.

From the component palette click the messageChoice component to add it into the empty filterChoice slot.
.

Move your mouse over this icon to see the image

 

5 .

In the property inspector, remove the prompt from the messageChoice component by deleting the prompt text.

Move your mouse over this icon to see the image

Change the name property to: filterBy

Move your mouse over this icon to see the image

 

6.

In the Structure pane, right-click on the messageChoice component and insert an option components

Move your mouse over this icon to see the image

 

7.

In the property inspector, set the text property on the option component to: Department_Id.

Move your mouse over this icon to see the image

 

8.

In the structure pane, right-click on the messageChoice component and insert an option components.

Move your mouse over this icon to see the image

 

9.

In the property inspector, set the text property on the option component to: Department_Name.

Move your mouse over this icon to see the image

 

10.

The Structure pane should look like this:

Move your mouse over this icon to see the image

 

11. From the File menu, choose Save All or click the icon.

Back to List

Modify the lovFilter Event Handler

Now you need to modify the event handler to make the filtering option work.

1.

In the structure pane, open the handlers node and select the event - lovFilter..

Move your mouse over this icon to see the image

 

2.

Right-click and select "Insert inside ..." Select the invoke element

Move your mouse over this icon to see the image

 

3.

In the dialog that appears, enter "setWhereClause" for the Method property.

Move your mouse over this icon to see the image

Note: This will call the setWhereClause method on the ViewObject

 

4.

Select the Enter Advanced Properties tab, and set the following properties:

instance 
${bindings.DepartmentId.viewObject}
java type
oracle.jbo.ViewObject

Move your mouse over this icon to see the image

Then click OK.

 

5 .

Inside the new invoke element, add a Parameter element by right-clicking the invoke node in the structure pane and select "Insert Inside ..."

Move your mouse over this icon to see the image

 

6.

Right-click the new parameter entry in the structure pane, and select the parameter option.

Move your mouse over this icon to see the image

 

7.

In the Insert parameter dialog, set javaType to string.

Move your mouse over this icon to see the image

 

8.

Click the Enter Advanced Properties tab and set the value field to ${empty param.filterBy ? 'DEPARTMENT_ID' : param.filterBy} LIKE '${param.searchText}'

Move your mouse over this icon to see the image

Then click OK.

 

9.

Right-click the event - lovFilter node in the structure pane and add another invoke element.

Move your mouse over this icon to see the image

 

10.

In the Insert Invoke dialog, set the method field to executeQuery

Move your mouse over this icon to see the image

 

11.

Click the Enter Advanced Properties tab and set the following properties:

instance
${bindings.DepartmentId.viewObject}
javaType
oracle.jbo.ViewObject

Move your mouse over this icon to see the image

Click OK.

 

12.

Your event handler tree in the Structure pane should look like this:

Move your mouse over this icon to see the image

 

13.

In the structure pane, select the listOfValues - DepartmentId node.

Move your mouse over this icon to see the image

 

14.

In the property inspector, set the following properties:

Text property
${param.searchText}
searchAreaMode
filter

Move your mouse over this icon to see the image

 

15.

Open the pageflow diagram.

Move your mouse over this icon to see the image

 

16.

Right-click the /EmpWithLOV data page and choose Run from the context menu.

Move your mouse over this icon to see the image

 

17.

The EmpWithLOV opens in your browser.

Move your mouse over this icon to see the image

Click the flash light to open the Department LOV.

 

18.

In the Search By, specify a new Department-Id value then Go.

Move your mouse over this icon to see the image

Experiment with the Search By Department Name and specify a department value (Administration, Marketing, Purchasing and valid values)

 

19.

Click Select to return to the EmpWithLOV page.

Move your mouse over this icon to see the image

 

Back to List

Back to Topic List

 

In this lesson, you've learned how to:

Build an ADF UIX application that contains an LOV
Apply a filter to the LOV using Oracle JDeveloper 10g

Back to Topic List

To learn more about JDeveloper you can refer to:

Back to Topic List

Move your mouse over this icon to hide all screenshots

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy