Showing posts from 2010

ADF 11g : How to control where a new row is inserted

On the JDeveloper forum a question was asked how to insert a new row in an ADF table after the selected row. Default behavior is insertion before the current row. In this short post I describe how to achieve this. In order to do this I create a custom method on the application module that takes the position (BEFORE or AFTER) as an argument. Based on this argument the new row is inserted at the appropriate position.

public void createRow(String beforeOrAfter){
Row newRow = getJobsView1().createRow();
//get instance of the above created view object
ViewObjectImpl vo=getJobsView1();
// to insert row at the end of the table
if (beforeOrAfter.equalsIgnoreCase("AFTER")){;

I publish the method, and drop it as a Button on the page. I copied the button so I have one for each option.

<af:panelCollection i…

ADF 11g : Change a Viewobjects' Query on the Fly

One of the requirements at my current project is to have one ADF table display data from different database tables. That is, depending on criteria entered by the user, the query behind the view object needs to change. All in all 12 different database tables are involved in this story. This requirement is based on functionally in the original (oracle forms) application. This forms application used the set_block_property built-in:
set_block_property('<blockName>, query_data_source_name, <datasource>);

I was able to reproduce this behavior in an ADF application. In this post I explain how I did this.

Database and ADF Business Components.
Luckily these tables all have the same attributes so it is relatively easy to achieve this. I created two database views. One based on the employees table, and a second one based on the locations table. Mark that I defined identical column aliases for both views.
create view EMP_ABSTRACT_VW as

ADF 11g : SelectOneRadio in Table Layout

Today at one of my customers I was asked the question if you can use a SelectOneRadio component in table layout. I know that the first thing they should have done is try Google to find a solution. As a matter of fact they did and found this blogpost by Frank Nimphius. This however is based on ADF 10g. The part where Frank converts the InputText to a selectOneRadio isn't available in ADF 11g anymore. It can be achieved in ADF 11g very simple as well.

Based on an example I will explain how to do this in ADF 11g. For this I added an extra column to the EMPLOYEES table. This column called "OutOfOffice" holds the status of the selected employee. I created ADF BC for the Employees table. When dropping this as an ADF table you will see the result as below.

Not user-friendly at all. But how can we change this ?

Actually it's simple. First remove the inputText field from the column.
Next drop the OutOfOffice attribute from the datacontrol on the column as a selectOneRadio.

In th…

Book Review: Quick Start Guide to Oracle Fusion Development

A couple of weeks ago yet another ADF book was released. This time it was Grant Ronald’s turn. He managed to write a “Quick Start Guide to Oracle Fusion Development”. I was somewhat worried because it is seemingly impossible to write a Quick Start Guide to Fusion Development. However after reading the book I was very surprised of what the book has to offer to people starting with fusion development. In this post I share my findings with you...

A look at the content immediately learns that this book covers the whole development process. The “Quick Start Guide” provides the essential information you need to build applications. Nothing more and, more important, nothing less. The book really is an introduction to the most important building blocks and functionality that you’ll use while starting ADF development.

Part I : Introductions and Overviews.
1. Introduction to Fusion and the Fusion Technologies.
2. Introduction to JDeveloper and Oracle ADF.
3. Finding your Way Around JDeveloper.

ADF 11g inputNumberSpinbox: Changing Value When Value is Null

This post is a short one, however, it is useful. When you use a Spinbox to change and display values, you might encounter a problem when the Spinbox' value is empty (or Null).

I used the Employees table in the HR Schema for this example.
Created ADF BC for this, and dropped the collection as an ADF Form an a simple page.
I converted the commission inputText component to an inputNumberSpinbox and set stepSize="0.1".

You can click whatever you want but the Spinbox just doesn't work for NULL values.

One of the options you have, is to enter a value in the Spinbox by just typing it.

A somewhat more elegant solution is the use of javascript.
For this I add a client Listener to the Spinbox.

The clientListener invokes a javascript function as soon as the Spinbox gets focus. Whenever the value is NULL, it will set the value to ZERO. The Spinbox now knows what to do.

<af:document id="d1">
<af:resource type="javascript">
function initSp…

ADF 11g: toggle operators in query component

When you use view criteria to be exposed in an <af:query/> component, it is sometimes weird that ADF allows you to change query operators. In this use case I define a view criteria using a BETWEEN clause on two dates.

When you create an <af:query/> component based on this criteria, you will see that it is rendered with operation 'between' as the selected operator. You do however have the possibility to change the operators. This actually makes no sense because you only need between.

You can change this behavior on the UI-hints tab of the view criteria editor.

When you run the application again, no operators are shown, but you can still insert two dates, still making it clear to the user that the search will be from - to.

This is a design-time solution. You can also manipulate this at run-time.

Run-time manipulation

For this you need to create the view object implementation class. In this class you then create a method that will show or hide the operators. By setting the …

ADF 11g: Change attribute order in query component

Ever wondered if you can change the order in which the attributes are displayed in an 'af:query' component? It can be done. Here is how.

After you have created BC you can drop the named criteria "all queriable attributes" as an 'af:query' component with table.

When you run this, you will see the default generated query component. let's assume that the attributes in this component are not in the order that you like. You are in desperate need to show the "job" attribute first.

The solution is at view object level. You can change the order of the attributes by invoking the "Set Source Order" button. This button will show you a popup in which you can reorder the attributes. Use the button(s) so the attributes are in the order you want.

If you run the page again, the query component shows the "job" attribute first.

Too bad that this is a design time solution. There are some pending ER's regarding this subject.

ADF 11g: Using a List in Query component

When you create a default query component you might miss some of the features that ADF offers to you. One of these is the use of lists in the query component. In this post I'll explain to you how to do that.

First image here is the way a query component displays when you use all the defaults, and do no tweaking at all. Forget that I already changed some attributes so they are not displayed in the query component.

It looks ok, but the user of your application might not be so happy. They have to know the id of all departments. This is fine when you only have a few, but what if you have many ?

Let's try to add a list to the query component.

We have to start with the creation of the lookup item for department name. This can also be used in the actual table showing the results. First we add an entity usage for departments to the employees view object

After this we can add the lookup items.

Now create the list of values. The list of values should be based on the departments name attribut…

ADF 11g Skinning: Three ways to change look and feel

On the JDeveloper ADF forum there are many questions on how to change the look and feel of components. In this post I'll explain three ways to do that.

Setting skin Selector property

For this we need to define a custom skin.
<?xml version="1.0" encoding="ISO-8859-1"?>
<skins xmlns="">

In the style sheet we will add an entry that will hide the columnheaders.
af|column::column-header-cell{display: none;}

This entry in the styleSheet will apply to ALL columns in your application.

Using and appending styleClasses

Now we create a StyleClass that is exactly the same as the style in the previo…

ADF 11g panelgroup: Tournament Layout

This is a short post on layout. With the quarter finals of the world cup 2010 coming up, it is time to show a simple layout example. A layout to show all teams and groups, competing in the world cup.

This layout is achieved by af:panelgrouplayout, af:panelbox, and af:forEach.
I read all the group data from a database table, and use the af:forEach to create a panelbox for each group. After that I use another af:forEach to add a line for every team in a group.

<af:panelGroupLayout id="pgl1" layout="horizontal"
<af:forEach var="group" items="#{bindings.ExistingGroups.rangeSet}">
<af:panelGroupLayout layout="vertical" id="pgl3">
<af:panelBox id="pb1"
showHeader="always" showDisclosure="false" >
<af:forEach items="#{bindings.GroupDraw.rangeSet}"

ADF Mobile Client: Article on OTN - Developing Applications for the BlackBerry

After a couple of months of hard work, my article on developing ADF applications for blackberry smartphones finally made it to OTN.

If you go to you cant' miss it. If it's gone by the time you read this, you can find the article right here.

ADF 11g popup and panelwindow: Open wikipedia in a modal popup.

This post was more or less inspired by the noteWindow example on
Oracles tag demo site. When hovering the highlighted text in this example the user gets extra information about the subject. I wanted to give the end user the opportunity to get even more information, for instance by invoking a wikipedia page about the subject. The catch here is that I wanted this information to be shown in a modal popup, and one that is not prohibited by popup blockers. Luckily ADF 11g provides javascript popups that can also be made modal, so the user has to close the popup before returning to the application.

This post describes how I used an in a to open the correct wikipedia in a modal popup.

Step 1: Create the plain text that invokes the noteWindow.

This is taken directly from the mentioned Oracle example.
<p style="margin-left:30px;width:500px;margin-right:30px;line-height:16px">
Vultures are scavenging birds, feeding mostly on the carcasses of dead animals.

ADF 11g Contextual Event Framework: An Example

Often a page or a region within a page needs information from somewhere else on the page or from a different region. While you can pass parameters to obtain that information, doing so makes sense only when the parameters are well known and the inputs are EL-accessible to the page. Parameters are also useful when a task flow may need to be restarted if the parameter value changes.

However, suppose you have a task flow with multiple page fragments that contain various interesting values that could be used as input on one of the pages in the flow. If you were to use parameters to pass the value, the task flow would need to surface output parameters for the union of each of the interesting values on each and every fragment. Instead, for each fragment that contains the needed information, you can define a contextual event that will be raised when the page is submitted. The page or fragment that requires the information can then subscribe to the various events and receive the information thr…

ADF 11g : Label Modifications and Persisting Resource Bundle Changes

In a comment on one of my posts on the AMIS technology blog I had a question on UIComponents. The question was if it is possible to modify prompts and labels of components programmatically. As a matter of fact this is possible. You can do this for the session only, or you can choose to persist these changes. In this post I first explain how to implement the "session only" functionality, and in the second part I explain how to use a persisted resource bundle with immediate refresh.

Application Setup

The application used in this post is based on the HR schema and the business components are created and not changed.

First of all you create a page that is used to hold components of which you want to change labels and prompts. Create two panelboxes next to each other. In the first one drop the employees collection and in the second one drop the child employees collection. Drop both as read only form. When browsing the first box, the second one will show the subordinate employees (if…