Pages

Wednesday, May 30, 2012

Understanding the JSF Immediate Attribute

A very nice blog on Immediate="true".

http://adfpractice-fedor.blogspot.in/2012/02/understanding-immediate-attribute.html

Friday, May 25, 2012

Implementation of SelectManyCheckBox component

The selectManyCheckbox component creates a component which allows the user to select many values from a series of checkboxes. SelectManyCheckBox.

It is quite similar to my earlier post on SelectManyListBox component. But here the use case, implementation is different.

Use-Case:
The association between two entities should be persisted in the third database entity.
Here the association means only UI association, don't get confused with ADF BC Association.

Say, there are three tables in an application, EMP, ROLES, EMP_ROLES. The EMP table is shown as a form layout allowing the user to navigate between the records, create a new record, & commit the changes. The SelectBooleanCheckBox is used to display all the ROLES with check Box like Manager, President etc. For an EMP record, the user can select as many roles as possible. 

When the user select any check box (i.e ROLE) for an EMP record,  an entry is made in the EMP_ROLES Table and vice versa. The EMP_ROLES table contains all the ROLES selected for an EMP record in the form of one to one mapping. And while navigating between the EMP records, the corresponding ROLES saved in the EMP_ROLES db table are displayed as selected.


UI:


Steps implemented are:
1. Create a Fusion Web Application.
2. Create all the required Business Components (EO, VO,VLink AM) for the above data model.
3. Don't forget to create a view link between EmpVO and EmpRolesVO, which will be used to display the check boxes as selected for an EMP record.
4. Drag and drop the EmpVO as a form layout with navigations.
5. Drag a SelectManyCheckBox UI Component and bind the value property of SelectManyCheckBox to a managed bean property, which evaluates the values to be displayed as selected for an EMP record as shown.

6. When any Role is selected/unselected on the UI, first it is saved in a pageFlowScope Variable, then it is processed in the commit method as shown:

7. When user navigates between the records, getSelectedRoles() method is called, which will fetch the ROLES for an EMP record and then display them as selected.

Sample Workspace:
Download the sample workspace from here.


Sunday, May 6, 2012

Use case of SelectManyListBox component

Oracle ADF is a powerful application framework for building next generation enterprise applications. This blog discusses one interesting use case scenario and solutions using ADF.

The selectManyListbox component creates a component which allows the user to select many values from a list of items. SelectManyListBox.

Use-Case:
The selected values of a SelectManyListBox component has to persist in the corresponding columns of a database table and the saved values should be shown as selected in SelectManyListBox for a particular record.

Say, the SelectManyListBox component displays the days of a week e.g. Monday, Tuesday, Wednesday, so on. For each value(Monday, Tuesday etc.) there is a corresponding column(Mon, Tue etc) in a db table. If the value Monday is selected, Y is inserted in the Mon column of db table, otherwise N is inserted and so on.

And when SelectManyListBox is displayed on the UI page, the days of the week are selected for the respective columns(Mon, Tue etc) having value equal to for a particular record. Moreover, on unselecting the values, N is persisted in the corresponding columns.

Data Model:


UI:


Steps implemented are:
1. Create a Fusion Web Application.
2. Create all the required Business Components (EO, VO, AM) for the above data model.
3. Drag and drop the VO as a form layout.
4. Drag a SelectManyListBox UI Component and bind it with a data source(static or dynamic) as shown below.


5. Bind the value property of SelectManyListBox to a managed bean property, which evaluates the values to be displayed as selected.


6. When any value is selected on the UI, it is saved as Y in the corresponding column and vice versa.


Sample Workspace:
Download the sample workspace from here.