- Handling Empty Region - http://blogs.oracle.com/DavidGiammona/entry/how_are_empty_regions_implemen
- Including a Region within an af:popup - http://blogs.oracle.com/DavidGiammona/entry/how_do_i_include_a_region_with_1
So most of the code kind-of goes as what the blog does as well as what Fusion Dev Guide by F.Nimphius on launching a region within popup... or a popup with a region (forgot the topic title).
My project is setup to log on the following areas.
- Region task flow entry - just so we know that the task flow has started.
- On popup launch - this is the part that we handle the switch between an empty region to the actual region
- On popup close - as you probably already know, this is where i handle the switch to an empty region. Also this listener gets triggered on Cancel, Ok and Escape of the popup.
Anyway, i'll start posting codes.
As you can see, I'm directly using showPopupBehavior which means that the popup itself will be rendered directly at the same level as this page. So the popup and the view would pretty much have a handle on the scope which of course from the region, you shouldn't try to cross the scope. Later i'll explain more how I decided to handle the parameter passing without the use of contextualEvent.
This bean (viewScope) handles the dynamic region taskflowId. The switching of taskflowId to/from an empty region. Check for a response which I'll explain more.
|FormContent TaskFlow (pageFragment)|
This is the fragment as part of the task flow region that is used inside the af:popup. I have an actionListener which not only navigates for return but also configures the response.
This backing bean, as noted will look for the calling popup, search for the region that is directly contained with it (since this is the same region which will handle the regionNavigationEvent), and add an attribute to that component. Yes, there is a potential for this to blowup if the task flow is not used in a popup, but that is why the same utility to retrieve the popup will tell us if this taskflow is being rendered inside one.
Utility class to retrieve the parent popup.
So as you can see based on the code, the flow of the setup goes like this.
- Link is clicked which triggers ShowPopupBehavior
- Popup receives the event and launches which triggers the fetchListener
- FetchListener handles the configuring of the empty to taskflow to our actual taskflow region
- Region hits an OK or Cancel and triggers the appropriate ActionListener
- ActionListener looks for the parentPopup and from there, it retrieves the direct region below it.
- Configure the RichRegion for an extra attribute which in this case we called "Notification".
- Return is called by the taskFlow.
- Region in the calling page triggers RegionNavigationHandler.
- RegionNavigationHandler closes the popup and also check for the response from the taskflow.
- OnPopup close, the clientScript is triggered which calls our serverListener.
- ServerListener makes sure that the dynamic region is reset to an emptyTaskflow.