Using Contextual Event in Oracle ADF (Region Communication)

Sharing is Caring

The contextual event, in simple terms, is a way to communicate between task flows. Sometimes we have task flow open in a region and have to get some values from that task flow. This scenario can be achieved by the contextual event.

Contextual Event has two parts-
  1. Publisher Event (Producer)- As button or any component that can raise the event 
  2. Handler Event (Customer)- that listens and process event published by the producer
This tutorial is based on example developed on default HR schema of Oracle DB 11g
I have created two application and called first one in the second application as a region.
  • Create the first application using Department table of HR schema and drag Department Name on page fragment, now create publisher event (follow steps) for Department Name.
  • Select Department Name field in structure window and go to property Inspector select ContextualEvent,
    click on green add icon and select event type and name for publisher event
 
  • Select field value from Iterator Binding
    contextual event
  • Here you are done with publisher event or producer create a jar of this application in order to use it in the second application.
  • Now start Second Application that will handle and process this event, create a page and put an output text and set its value from the managed bean

     

     

    • Now create an event handler class to process published event and to make it available to page binding level, we have to create DataControl for this class.

       
    • Right click on event class and Click on CreateDataControl.
    • Now add this method binding to the page so that it can be accessed from page binding
  • Now drag and drop task flow from jar library on the page as a region, by this published event will also be available to the page

  • Now go to page binding and goto ContextualEvents tab, click on subscribers tab and click on add icon this will open a popup window, click on search button, it will show available publisher event, now select event and goto handler search option and select function that you have previously added in page binding
  • Give consumer parameter name same as event handler function
 
Now Run your Application – Download ADF Sample Application

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

0 thoughts on “Using Contextual Event in Oracle ADF (Region Communication)”

Leave a Reply

Your email address will not be published. Required fields are marked *