Thursday, June 2, 2011

How to close a TaskFlow Popup Launched Using an af:Popup

Been awhile since I've posted something, so I decided to make a quick and easy hint in ADF.

TaskFlows can be launched as a Popup in a couple of ways in ADF. The most common, I think, is through a taskflow control-case with the following settings:

Then there is the obvious, region in a popup where we drop a fragment taskflow directly inside a popup. I'll show the two common case using a direct popup and a dialog.

The limitation of using it as a direct region though is that the close button is outside the controls of the taskflow, basically, the taskflow itself does not call the close unlike the use of an inline popup as described in the first example. So what happens if we just call the taskflow return from the taskflow? As described in F. Nimphius Fusion Dev Guide, the taskflow itself will close thus closing the binding itself. Here's an example.


And forevermore it will remain close unfortunately. Now, to get around this we're going to have the taskflow itself handle situations where it will close the popup without calling the return. To do this, we'll basically retrieve the parent'most component until it is a RichPopup and just call the popup.hide() from there on. So lets go back to coding.

For the fragment, we'll have the return button but this time, it will call an actionListener instead of the controlcase for the return.

Presto. Hope that helps.


  1. Thanks for the post , can you publish the sample app example as a download link.

  2. Your code works great and has solved my problem