JDeveloper 11g – Model based (ViewObject) List of Values and their end-to-end benefit in the web tier

In JDeveloper 11g, as another example of declarative productivity, we can add a List of Values definition to an attribute in a ViewObject, indicating that typically that attribute whenever included in for example and ADF Faces page should be implemented with a List Binding in a SelectOne… component such as ListBox, Radio or Dropdownlist or through a List of values. I will demonstrate that new feature in this article, using EMP and DEPT and creating a List of Values for the DeptNo attribute in the EmployeesView. The List of Values should display the Deptno and Department Name values.

We will see how – without any programming and in less than five  minutes – we create a pretty rich JSF page with a List of Values dialog for the Deptno item.

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov1

....

As a simple example, let’s specify that the ViewObject EmployeeView should have a lookup attribute for the name of the Department. Double click on the ViewObject and the new VO Editor appears.

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov2
 
This style of wizard is also used in the latest BPEL design time – for example the Workflow Task Editor – as well as the ESB editors.
Let’s first add the DeptView to the EmpView. Notice the new join types available – though the full outer join is not yet available. No more (+) to be added in Expert Mode!
 
Now I can click on the green plus sign to add an attribute, or use the Add from Entity button. If I do the latter, I can select one of the attributes in the Entities associated with this ViewObject.

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov3
 

Once the attribute has been added, I can bring it up and press the Add a List of Values button.

 JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov4

We get a Popup window. I add the DepartmentView to the model. Next I specify two return values: Deptno and Dname – from the List Attributes – and I associate them with the EmployeeView’s attributes Deptno and Dname.
JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov5 
Now I can close the LOV editor.

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov6
 
I wonder whether this LOV can be seen in the ADF BC Tester. I run the tester to find that out. And lo and behold: you do get to see it in the Tester:

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov7
 
That is pretty cool and useful.

Now let’s see how that can be leveraged in the ADF Faces page.

Create a new JSF page, accepting all defaults. Drag and drop the EmployeeView collection from the DataControl palette onto the page, dropping it as a Form.

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov8
 
The page is created as follows:
JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov9 
Look at the selectOneChoice element created for the Deptno element. Let’s run the page.
JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov10 
That was quick!

Alternatively, and even more impressive, we can drag the Deptno attribute as a List of Values element to the page. This will create a new ADF Faces component called inputListOfValues. It displays the list of values as well as handles the return of the selection.

JDeveloper 11g - Model based (ViewObject) List of Values and their end-to-end benefit in the web tier jdev11gbclov1
 
Note: this is NOT a popup window, it a floating DIV element. Not only does it look much nicer and less clunky, it also does not get the user into trouble with her popup blocker.

So here we see declarative end-to-end support for List of Values, all the way from the ADF BC definition in the ViewObject to the List of Values or Dropdown List in the Web page.

 

2 Comments

  1. Johan Tuitel August 18, 2009
  2. Grant May 11, 2007