12 August, 2011

ADF View Object

View object may have several instances at application module.
So I will explain confusion about that instances in this post.
Let's take example to illustrate confusion by example.
I will create view object Departments and create instance for it named DepartmentInstance

I will create ApplModuleImpl class and add PrintFirstRow method to it
Then add previous method to client interface at application module

First Case
I will create page with two tabs(Form, Tabular) that use same view object instance.
The first tab shows view object data in Form Layout.
The second tab shows View Object data in tabular layout.


Note that the two tabs (Form,Tabular) use the same view object instance.
Now We run the page and test the data
1-After opening the page click on the PrintFirstRow button
2-Click on Tabular Form tab and filter DepartmentName by M%
3-click on Form Layout tab you will find that navigation of view object changed to DepartmentId 20 and If you click PrintFirstRow button it will return 20

AT previous example we noticed that anywhere in your pages if you use the same view object instance, they share the same data.

Second Case
In that example I will use different instance of same view object.
I will create another instance of Departments View object named by DepartmentsInstance2

I will create new page mainPage2 and in Form Layout tab I will use DepartmentInstance and in Layout Tabular I will use DepartmentInstance2.
Now We will run the page and test the data.
1-After opening the page click on the PrintFirstRow button
2-Click on Tabular Form tab and filter DepartmentName by M%
3-click on Form Layout tab you will find that navigation of view object changed to DepartmentId 20 and If you click PrintFirstRow button it will return 10 in spite of first row is department 20 in tabular form that because they use different instance of view object.


AT previous example we noticed that anywhere in your pages if you use the different view object instance, they doesn't share the same data.
You can download the sample application from ViewObject.rar

Thanks
Mahmoud A. El-Sayed

1 comment:

  1. wοnԁerful pointѕ altogether, yοu sіmplу гeceived a logo
    new rеadеr. What ωould you гecοmmеnd about
    youг put uρ that yоu just madе a feω
    days аgо? Any suгe?

    My weblog; ünlü oyunları

    ReplyDelete

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...