How to implement contextual events between parent page and region?

   Contextual events are necessary when need to communicate between separate regions or between parent page and region in ADF application. Here I'll describe one approach to implement this. It is a little improvement of classic approach, because of event handling java interface is created and event consumer is implementing it. It is convenient, when need to separate data control implementation from specific event logic processing. In this sample description I'll focus on event creation steps having all other necessary objects already created. Sample application can be downloaded here. ADF version

   So lets say we have a parent page (parent.jspx with parentPageDef.xml) and region (region.jspx with regionPageDef.xml and in it, which needs to consume an event published by parent.

1. In parent.jspx create command button which will initiate an event. Then in property pallet find "Contextual Events" and add one with name "MyEvent".

2. Create java interface "MyEventHandler" for classes which will handle events:

3. Create java class "MyEventReceiver" to receive events:

4. Generate data control for "MyEventReceiver":

 5. Create with custom event handler:

 6. Add previously created data control binding to regionPageDef.xml:

7. Finally create event mapping in parentPadeDef.xml:
 Open event mapper:

Provide event details:

8. Done! Test it! :) Implemented sample application can be downloaded here.