Monday, December 30, 2013

ADF Dynamic ADF BC - Loading Multiple Instances (Nr. 100 in 2013)

This is Nr. 100 post in 2013 !

We learned how to build dynamic ADF BC passivation/activation safe in the previous post - ADF Dynamic ADF BC - Surviving Passivation/Activation Events. There is one more trick to learn - how to reload and open UI with dynamic ADF multiple times. This is useful when dynamic ADF form can  be opened from multiple menu items, passing parameter and re-drawing dynamic ADF UI.

This is implemented in the sample - Custom method from Application Module class constructs View Definition, each time when form is loaded from the menu - this method is invoked with parameter and new View Definition is created:

For the test purposes, we set Hire Date to be displayed only when parameter is not NULL:

Before creating new View Object instance, we should check if our dynamic View Object instance already exists. If yes - we should remove it first and only then create new one (otherwise there will be error about existing View Object instance with the same name):

This is mainly all about loading multiple instances. Now I will describe several improvements in UI part. ADF 12c supports declarative component tag, this simplifies complex ADF UI rendering. Sample application ADF UI form renders different kind UI components from iterator using ADF UI dynamic component tag:

We are referencing attributeModel from iterator and accessing Page Definition bindings:

Dynamic form in ADF 12c is created simply by drag and drop and selecting dynamic option - fairly simple and stable.

Sample application is based on Multi Task Flow Binding, described in my previous post for ADF 12c - Smooth Migration from ADF 11g R1/R2 Apps to ADF 12c. I'm loading ADF Task Flow with dynamic ADF UI, passing additional parameter for the second menu option (Hire Date will be displayed):

ADF Task Flow with dynamic ADF UI is closed and loaded from the menu dynamically, controlled by Multi Task Flow binding:

You can try to open first or second menu option, this will load the same ADF Task Flow, but reinitialise dynamic ADF BC with different parameter - dynamic ADF UI will be displayed accordingly:


Phai Vu said...

love you ^^. nice your post.
I have a question:
If i want Create a form for Insert with 2 step to complete Insert, so how can i do this?
For example. Fisrt steps: Users only enter field UserID and Email. Then click Next to Second Steps: Users continue enter Fields (Password, Phone number, on).
That's my question. Pls help me

Andrejus Baranovskis said...

Such functionality is provided by ADF out of the box, user data from first step will be stored in cache.


Maroof Ahmad said...

Congratulation Andrejus.

I have benefited from your research in ADF which is real time help in our projects, planning.

Thanks for this and keep it up.


Andrejus Baranovskis said...

Thanks for great feedback Maroof !


Phai Vv said...

Can you make a small demo for that :D. Thank you.

Andrejus Baranovskis said...

Yes, I will post it in the next blog post.


Phai Vv said...

Wonderful, i waiting for it every day ^.^ Thank for this and keep it up