This post is about reusable ADF region and its usage from ADF Dialog Framework. If we have ADF Task Flow with fragments and want to use Dialog Framework, we need to create intermediate ADF Task Flow with pages and include our reusable region there - this will allow to load ADF Dialog from the fragment (dialog is always running in ADF page). I will describe in this post how to pass data from/to ADF region included into ADF Dialog to the calling fragment.
There is main ADF Task Flow in the sample - empls-flow (download sample application
ReusableDialogRegionApp.zip):
This task flow is configured to call intermediate ADF Task Flow with wrapper page. We are passing and getting parameters to/from the dialog:
Dialog is opened from the button in the main employees fragment:
Button is configured to open dialog:
There is dialog listener defined for this button, it receives return value. Alternatively we can get return value from the dialog return parameter directly:
Intermediate ADF task flow (which actually implements ADF dialog), contains a page and return activity. This page is only a wrapper, it includes reusable ADF region:
Intermediate ADF task flow with wrapper page defines input and output parameters:
Wrapper page contains Close button, this button sets return value, it retrieves return value from the bindings. Because Data Control is shared between reusable ADF region and intermediate ADF task flow with wrapper page, we can access bindings from ADF region and return it from the wrapper page. You can see that this page includes our reusable ADF region:
Here is binding definition for the attribute in the page definition for wrapper page:
And the last bit - ADF reusable region, JSF fragment view:
Bindings for ADF reusable region, you can see where CountryId attribute value is set. We are getting the same value in dialog wrapper page through shared Data Control:
I should mention one important thing - intermediate ADF dialog task flow is configured to run in isolated scope. This is important and allows to reset reusable ADF region in the dialog always to its initial state on opening:
Countries region is loaded and DepartmentId value is passed into:
Selected value is returned back:
The same reusable region is opened from another fragment - region state is reset, user can select value and return it: