Thursday, August 4, 2011

ADF Dialog Framework and ADF Task Flow Re-Initialization

This post is targeted for ADF beginners, I was discussing today in the office with developers who are just starting with ADF. Its always interesting to see new developers perspective, how they understand framework and what questions they ask. One of the questions I got was about how to reset shuttle component rendered inside ADF dialog framework. By default, ADF task flow rendered inside dialog framework is set to share Data Controls with calling ADF task flow - this preserves statefull state and keeps selected shuttle values. The question was - how we can re-initialize ADF task flow, each time when dialog windows is being opened. We should set ADF task flow rendered inside dialog to be isolated and not to share Data Control with calling task flow - this will force re-initialization of the dialog. We also should explain to new developers to be careful and not to overuse this setting, because it can break transactional logic, use more application module connections than expected, etc. General rule - use isolated scope, when you really need to use it and it doesn't conflict with application logic.

Download sample application - ShuttleAccessApp_v2.zip.

This sample contains landing ADF task flow, implemented as ADF region with fragment. It calls ADF dialog framework to render ADF task flow with pages:


Dialog page is opened, shuttle component is rendered - user selects several items:


Now if we close and then reopen same dialog, shuttle component will keep previously selected values. Depending on use case, may be its what you need, but sometimes you would need just the opposite - each time dialog is opened, it should be re-initialized.

Open ADF task flow, which implements dialog element:


Go to Behavior section, Transaction group and uncheck "Share data controls with calling task flow" - this will make ADF task flow to run in isolated mode:


Run application again, select values from shuttle component:


Close/open dialog window - shuttle will be re-initialized:


4 comments:

Mahesh Upadhyay said...

Hello Andrejus,

I need to add commandLink in NavigationModel and on click on commandLink, I want to Invoke a popup.

Can you please let me know how it can be achived? I can invoke popup from the commandLink on the JSF page using ShowPopupBehaviour. I have added CommandLink on NavigationModel as component

Thanks,
Mahesh

Sumeet said...

Thanks Andrejus,
It was very useful.

Harsha said...

Hello Andrejus,
How can i programatically change a taskflow behaviour to isolated

Andrej Baranovskij said...

Hi,

This can be done with proxy TF.

Regards,
Andrejus