[SOLVED] Triggering a contextual event programatically

Hi,
Is it possible to raise a contextual event from within a managed bean code, without transforming that bean into a data control and defining a methodAction?
Thanks,
~ Simon

Hi again,
I found it myself (thanks to decompilation), the required code is
BindingContainer.getEventDispatcher().queueEvent(EventProducer producer, Object payload);Well I still need to figure out the exact semantic of the value returned by EventProducer.getEventDefinitionsList(), but hopefully I'm going to find that soon.
Regards,
~ Simon

Similar Messages

  • Contextual event in reverse direction ( from child TF to parent view )

    Hi ,
    It seems all example of Contextual events talk about mirroring input value from Parent page to Child TF running in a region and there are numerous examples out there.
    What I wanted to accomplish was that an lov in a child TF triggers a contextual event and the parent TF takes the selected list of values. It needs to conduct a search based on these values and than mark the rows in a (tree)table.
    What has succeeded is almost all aspects of this. I can fire the event and receive it successfully. But the problem is the the backingBean class that I create via EL is not binded to my parent pages components. The treetable component returns null.
    My handler code (the handler code from the bean which you use to create the data control to listen to the cntxtual event) is almost 1:1 to as the code from the book "Oracle Fusion Developer Guide: Building Rich Internet Applications with Oracle ADF Business Components and Oracle ADF Faces", Chapter 6, page 210.
    public void receiveEvent(
    DCBindingContainerValueChangeEvent incomingPayload){
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    Application app = fctx.getApplication();
    ExpressionFactory exprFactory = app.getExpressionFactory();
    ValueExpression valExpr = exprFactory.createValueExpression(
    elctx,
    //reference the managed bean that holds the mirror value
    //property displayed in the input text field
    "#{backingBeanScope.ConsumerBackingBean}",
    Object.class);
    ConsumerBackingBean consumer = null;
    consumer = (ConsumerBackingBean)valExpr.getValue(elctx);
    //get the changed attribute value from the contextual event
    //payload
    String newValue = (String)incomingPayload.getNewValue();
    //set the new value to the backing bean property that is
    //referenced by the input text field in View 3
    consumer.setMirrorValue(newValue);
    AdfFacesContext adffacesContext = null;
    adffacesContext = AdfFacesContext.getCurrentInstance();
    //partially update the text field to display the new value
    adffacesContext.addPartialTarget(consumer.getMirrorTxt());
    The #{backingBeanScope.ConsumerBackingBean} evaluates in my case to fine. But every component I should see as binding in the bean is null.
    Since the handler is declared in the pageDef of this parent page Fragment, i assumed the last bit about it being able to get to the backing bean and hence to my components should also be possible.
    If I cant refresh my components than I dont see the use of the contextual frameworks for me.

    You should find this post useful: http://flexponential.com/2010/12/05/saving-scroll-position-between-views-in-a-mobile-flex- application/
    It demonstrates one way of saving and restoring data when pushing and popping a view.

  • Programmatic Contextual Events - binded components are null

    Dear ADF/Webcenter gurus,
    I am publishing and consuming a contextual event programatically in separate taskflows and managed beans.
    The wiring of consumer and publisher is established runtime via WebCenter composer (my taskflows are published as jar, but I think this does not regard the problem below).
    Problem is, in the consumer method of the bean, I cannot access any binded coponents.
    I suppose this is because when the bean receives the contextual event it doesn't know in which binding context the page is.
    For now, my solution is: create seperate bean for consuming the event, get the page bean by createValueExpression(#{beanName}); and call the desired beanName.method to go on.
    It works, but I want to be able to consume the event and acces binded components in the same bean.
    I have the same issue when programatically firing event (binded components == null).
    Waiting your ideas, Todor

    Thanks for the reply,
    I am currently using the 2nd mechanism for accessing the bean which contains the bindings of the page components (e.g panelTabbed).
    What I want is to do it in the same bean, without the need of resolving expressions (now I can resolve the expression ${beanName.panelTabbed}) - I think there should be a cleaner way.
    There's got to be a way to consume the contextual event in the same binding context!

  • Contextual Events between templates and fragments

    Hi there,
    I'm having some issues to use contextual events in the following scenario:
    I have an inputText and a button on a jsf template. The input text is associated with an attribute on a managed bean and the button triggers and action that returns the value of this property on the managed bean. Besides, it triggers a contextual event.
    I also have a fragment that should consume that event, and this fragment is placed on a jsf that inherits the template that triggers the event.
    Unfortunately, when I try to consume the event on my fragment I cannot see the producer on the event map window, and event if I create my event map manually, it doesn't work anyway.
    Does anybody have an example of it?
    Am I doing smth wrong here?
    Cheers,
    George

    Hi,
    does the template ave a pagedef file that exposes the binding that triggers the communication ?
    Frank

  • Triggering Validation in a Region Through a Contextual Event

    I am using JDeveloper 11.1.1.6.0.
    I am trying to find out how to trigger the built in validation that occurs normally when a "submit" action occurs, but have the submit action occur outside of a region, and the validation also occur in the region itself.
    I have a page that contains a dynamic region in it. I will refer to the containing page as the parent and the region as the child. The parent region and child region both have different business objects bound to them, though they are part of the same application module. The parent page contains a submit button that needs commit the user entered data in both the parent and child pages. This action must not proceed if there are any validation errors in the parent or the child. The validation should trigger on the parent page without any work from me because of how ADF handles the situation. The child page is notified of the submit action via contextual events. I currently have it where this event can trigger the "commit" action successfully, but I have no idea how to go about ensuring that it triggers a validation check as well.
    The overall flow that I think will happen in the final version is likely:
    1: submit button pressed.
    2: parent page validation is checked (if success, proceed)
    3: contextual event is fired
    4: contextual event is received by the child.
    5: the child triggers its own validation (if success, proceed, else stop)
    6: the child triggers a commit action
    7: the child sends a response contextual event (signalling that it was successful)
    8: the parent receives the response contextual event
    9: the parent performs a "commit" action.
    I do not know how to cause step 5 to occur, and I do not know if steps 7 through 9 are needed yet (I haven't tested to see if causing the commit in either the parent or the child ends up causing all modified entity objects to be committed). Any help would be greatly appreciated.
    Thank you

    Hi,
    you can access a command button on the page fragment and queue its action event. For this you access a managed bean (backingBean Scope) that contains a handler to the command button and queue the event (this then will perform validation as if the user clicked it. The command button can also be hidden on the fragment.
    Have a look here for how you can integrate the managed bean as the contextual event handler
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/regionpayloadcallbackpattern-1865094.pdf
    Frank

  • Contextual event on table not triggered

    Using Jdev PS4.
    Concider following example: http://www.yonaweb.be/ContextualEvent.zip
    (I know following example can be simplified by using master-detail relation in the data control but it's to illustrate the example)
    I have two taskflows: EmployeeTF and departmentTf.
    The idea is to trigger an event when I select a new record in the department table.
    This is the tree binding:
    <tree IterBinding="DepartmentsIterator" id="Departments">
          <nodeDefinition DefName="model.views.DepartmentsView" Name="Departments0">
            <AttrNames>
              <Item Value="DepartmentId"/>
              <Item Value="DepartmentName"/>
              <Item Value="ManagerId"/>
              <Item Value="LocationId"/>
            </AttrNames>
            <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
              <event name="changeTheDept"
                     customPayLoad="${bindings.DepartmentId.inputValue}"
                     eventType="Currency Change Event"/>
            </events>
          </nodeDefinition>
        </tree> I have created a custom java class to use as a data control to find out when the event is triggered. This is my code:
        public void handleEvent(Object payload){
            System.out.println("Event handler");
            System.out.println(payload);
        }When I select a record in the table, the event does not get fired.
    So as a test I added my own custom method to see if contextual events are working properly so I added this method to my DC:
        public void triggerEvent(){
            System.out.println("triggering event");
        }and added it on a commandLink to the DepartmentTF. I also added an event on it:
    <methodAction id="triggerEvent" RequiresUpdateModel="true"
                      Action="invokeMethod" MethodName="triggerEvent"
                      IsViewObjectMethod="false" DataControl="EmpBean"
                      InstanceName="EmpBean.dataProvider">
          <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
            <event name="triggerEvent"
                   customPayLoad="#{bindings.DepartmentId.inputValue}"/>
          </events>
        </methodAction>When I trigger this event, my event handler does get called on the employee taskflow.
    So, my question is:
    1) Is this normal behavior that the change row event is not triggered?
    2) if yes, how do I trigger it or what is the purpose of this event?
    Edited by: Yannick Ongena on May 28, 2012 9:03 PM

    I have a similar circumstance: I have a page with two regions, each region contains a table. The two tables share some information so when I update one of them
    I also want the change to be reflected in the other table. I tried to use contextual events to send an event that causes one of the tables to refresh (I do not pass any payload)
    but so far I have not had any success with making this work. I am wondering if the bug you mentioned here would also prevent such a setup to work? I am using Jdev 11g R1 11.1.1.6.2.

  • Programatic Contextual Event on Disclosure Listener - jdev 11.1.2.3

    Hello:
    I want to programatically fire a contextual event from a DisclosureListener(when a showDetailItem is disclosed in tabbed panel). When I detect the tab is opened I want to publish the Contextual Event.
    See code below
    It compiles ok, but the error I get is:
    oracle.jbo.uicli.binding.JUEventBinding cannot be cast to oracle.binding.ControlBinding
    What am I missing here???
    Thanks for the help...
    ===============================================================
    package com.xxx.dbmstr.sbe.view.beans;
    import com.xxx.ptnr.cc.uc1.common.JSFUtils;
    import javax.faces.event.ActionEvent;
    import javax.faces.event.ActionListener;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.binding.BindingContainer;
    import oracle.jbo.domain.Number;
    import oracle.jbo.uicli.binding.JUCtrlActionBinding;
    import oracle.jbo.uicli.binding.JUEventBinding;
    import org.apache.myfaces.trinidad.event.DisclosureEvent;
    public class DBMstrTabs {
    private String isOpen = "QA";
    public DBMstrTabs() {
    super();
    public void doCE(){
    SBEPayload p = (SBEPayload) JSFUtils.getManagedBeanValue("SBEPayloadBean");
    if (p == null){
    p = new SBEPayload();
    Number empKey = (Number)JSFUtils.resolveExpression("#{bindings.empKey_t.inputValue}");
    p.setEmpKey(empKey);
    JSFUtils.setManagedBeanValue("SBEPayloadBean", p);
    DCBindingContainer bc = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
    JUCtrlActionBinding actionBnd = (JUCtrlActionBinding) bc.getControlBinding("eventBinding");
    ((DCBindingContainer)bc).getEventDispatcher().queueEvent(actionBnd.getEventProducer(),p);
    ((DCBindingContainer)bc).getEventDispatcher().processContextualEvents();
    public void checkQA(DisclosureEvent disclosureEvent) {
    if (disclosureEvent.isExpanded()){
    setIsOpen("QA");
    doCE();
    public void checkSTANDARDS(DisclosureEvent disclosureEvent) {
    if (disclosureEvent.isExpanded()){
    setIsOpen("STANDARDS");
    doCE();
    }

    Here is a small work around that might help until an ideal solution is discovered. Since the CE ActionEvent can be easily created declaratively, you can fake an producer event by programatically queuing an ActionEvent on a button binding from the disclosurelistener.
    fragment code:
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <af:panelAccordion id="pa1">
        <af:showDetailItem text="showDetailItem 1" id="sdi1" disclosureListener="#{TesterBean.tabdisclosed}"/>
        <af:showDetailItem text="showDetailItem 2" id="sdi2"/>
      </af:panelAccordion>
      <af:commandButton text="commandButton 1" id="cb1" binding="#{TesterBean.buttonbinding}"
                        actionListener="#{bindings.eventBinding.listener.processAction}" visible="false"/>
    </ui:composition>Backing Bean code:
    public class TesterBean {
        private RichCommandButton buttonbinding;
        private String helloStr;
        public void tabdisclosed(DisclosureEvent disclosureEvent) {
            ActionEvent actionEvent = new ActionEvent(buttonbinding);
            actionEvent.queue();
        public String getHelloStr() {
            return helloStr; //invoked when the CE is fired
    ...pageDef code:
    <eventBinding id="eventBinding" Listener="javax.faces.event.ActionListener">
          <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
            <event name="buttonCE" customPayLoad="#{TesterBean.helloStr}" eventType="Action Event"/>
          </events>
        </eventBinding>
      </bindings>
      <events xmlns="http://xmlns.oracle.com/adfm/contextualEvent">
        <event name="buttonCE" customPayLoad="#{TesterBean.helloStr}" eventType="Action Event"/>
      </events>
    ...good luck

  • Programatically raise Contextual Event from a ClientEvent

    Hi,
    JDev v11.1.2.0.0.
    Earlier I had a event raised on the value change of my inputText component. But due to certain requirement, I had to discard the valueChange and had to do that same logic using clientListener and serverListener. But the problem now is, the contextual event is not getting raised and I'm looking for a way to raise the specific event on the ClientEvent method that is bound to the serverListener on my fragment.
    I've checked lot of blogs but most of it are talking about raising the event programatically on ValueChange or ActionEvent. Any thoughts? Appreciate any help on this. Thanks !
    Edited by: 119413 on Mar 14, 2013 10:29 AM

    Ok. Finally, I ended up invoking a hidden button click action in my client listener and raised the event from the ActionEvent bound to that button. Let me know if anyone could think of better options.. Thanks !
    Edited by: 119413 on Mar 15, 2013 10:40 AM
    Edited by: 119413 on Mar 15, 2013 10:41 AM

  • When we will go to triggering events programatically and when throgh tab?

    hi experts........
    i am new to work flow can any one tell me that when we will trgger events programatically and when we will trigger through by events tab, what is differnce between them?
    i searce in sdn/google but exactly i didnot get the answer?
    thanks in advance

    Sorry but forum is not for basic training, as you are asking "what are workflow events". Moreover, you should post (more elaborate questions) to workflow forum

  • Fork : triggering and terminating event ?

    Hi Experts,
    I am a begginer in  Workflow ..
    I just want to know how Fork can be used for paralled processing with triggering and  terminating event.
    It would be appreciated if provided with some scenarion in detailed steps.
    Thanks in advance.
    Ganesh..

    Mike,
    It would be HELPFUL for me if i get my problem solved as earlier so i can concentrate on other my commited topics..thats why expecting info., from the experts.
    Anyway , you  triggered me to read SAP help..thanks for the indirect motivation..
    Let me start reading the SAP help information!!!
    Thanks .
    Ganesh

  • How to publish contextual event from dynamic region

    Hi Experts, plz help.
    Scenario :
    I have a page , say Page A.
    I have two bounded task flows, say HeaderTF and LinesTF.
    HeaderTF is placed as a static Region in page A and LinesTF is a dynamic region in page A.
    LinesTF has a table with Amount Column.
    HeaderTF has a text field which shows the total of amount column.
    Requirement :
    when user adds new rows or changes existing rows or deletes any rows in LinesTF, total field in HeaderTF should be updated.
    On change of amount value in lines, I am calculating and updating the total attribute of header VO as all of them are sharing same DC.
    but the value is not reflecting becos partial triggers cannot be kept for total field.
    So I am using contextual events.
    I created a contextual events for amount field, delete button and table as well (In LinesTF).
    and I created handler method in AM which calculates total and dragged it as a text field in HeaderTF.
    Now when I am trying to subscribe from pagedef of pageA, i am able to find the handler which is created in HeaderTF but could not find any contextual events in event lov.
    Question :
    1. Is my approach correct?
    2. Cant we publish contextual events from dynamic regions?
    3. Is there any alternate way of achieving this?
    I did not try refreshing HeaderTF by passing input params because I dont want the entire region to be refreshed.

    Try creating the event mapping - please see "28.7.2 How to Create Contextual Events Manually" in Dev Guide http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_adv.htm#CACJBFGI

  • Programmatic Navigation invoked by Contextual Events

    Using JDeveloper 11.1.1.3.0
    I'm having trouble doing a programmatic navigation triggered by a contextual event in the case of layered bounded taskflows.
    My scenario has 2+ taskflows.
    TaskFlow 1: BoundedTF called Main-Task-Flow - This is the starting URL invoked to run.
    TaskFlow 2: BoundedTF called Dashboard-Task-Flow - This is the default activity in the Main-Task-Flow
    Both of these does not use page fragments.
    Dashboard-Task-Flow has a page, let's call this Dashboard.jspx which registers a contextEventMap. This map basically utilizes a NavigationHandler to navigate to a TaskFlowReturn activity.
    Return activity is registered in the Main-Task-Flow to navigate to different taskflows.
    I noticed, that only when i call this navigation case using contextEvent, i am getting an invalid view port. Which starts with these:
    <UNMATCHED_STATE_ON_STACK><v5hztfeem_0> v5hztfeem_15
    <RegistrationConfigurator><handleError> Server Exception during PPR, #1
    javax.servlet.ServletException: ADFC-14000: View port ID 'v5hztfeem_15' is invalid.
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    etc...
    Caused by: oracle.adf.controller.internal.InvalidViewPortIdException: ADFC-14000: View port ID 'v5hztfeem_15' is invalid.
         at oracle.adfinternal.controller.state.ControllerState.setCurrentViewPort(ControllerState.java:1245)
         at oracle.adfinternal.controller.ControllerContextImpl.setCurrentViewPort(ControllerContextImpl.java:133)
         at oracle.adfinternal.controller.ControllerContextImpl.setCurrentViewPort(ControllerContextImpl.java:52)
    etc....
    I've been trying to figure if it was coding wise, but i simply use the NavigationHandler being triggered by a button then it works.
    So i tried something else, i placed the Dashboard.jspx directly in Main-Task-Flow and this issue is gone. I tried debugging the currentView and it all prints correct that i'm in Dashboard.jspx.
    I wonder if i'm doing something wrong here. I tried searching for this exception and i barely find any information about it.

    Thanks for the reply,
    I am currently using the 2nd mechanism for accessing the bean which contains the bindings of the page components (e.g panelTabbed).
    What I want is to do it in the same bean, without the need of resolving expressions (now I can resolve the expression ${beanName.panelTabbed}) - I think there should be a cleaner way.
    There's got to be a way to consume the contextual event in the same binding context!

  • Calling a method on backing bean in response to contextual event

    Hi
    I am using Jdeveloper 11.1.1.6.0 and using ADF contextual events..
    I have a drop down list and i am rasiing a contextual event on changing the current selection. In response to that event i want to call a backing bean method with parameters.. But when i click on the subscriber section for the contextual event, i can see only some bindings of the page.. How can i call a method on backing bean as a subscriber..
    Thanks
    Raghu

    Hi,
    this article has a use case for the POJO approach: http://www.oracle.com/technetwork/issue-archive/2011/11-may/o31adf-352561.html
    Another is to define a method binding in the receiving PageDef file and configure it as explained here
    http://java.net/projects/smuenchadf/pages/ADFSamplesBindings/revisions/3#SMU164
    Frank

  • Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event STATE_CHG and (target) status READY- ERROR EVENT_RAISED - Error updating the process object

    Hi All
    I have set up a simple custom HCM process and Form regarding Infotype TO CREATE AND CHANGE POSITION. I have checked the process and form consistency and it seems fine. Now when I run the process from HRASR_DT it generates a process number but it also gives an error workflow could not start.I get following error (SWIA log - Step history)
    Executing flow work item - Transaction brackets of the workflow has been damaged
    Exception occurred - Error when starting work item 000000007031
    PROCESS_NODE - Error when processing node '0000000014' (ParForEach index 000000)
    CREATE - Error when creating a component of type 'Step'
    CREATE_WIM_HANDLE - Error when creating a work item
    CREATE_VIA_WFM - Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event CREATED and (target) status
    EVENT_RAISED - Error updating the process object
    Executing flow work item - Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event STATE_CHG and (target) status READY->ERROR
    EVENT_RAISED - Error updating the process object
    Executing flow work item - Transaction brackets of the workflow has been damaged
    Executing flow work item - Work item 000000007031: Object FLOWITEM method EXECUTE cannot be executed
    Executing flow work item - Error when processing node '0000000014' (ParForEach index 000000)
    Points to be noted:
    1) I have searched few SAP notes such as 1384961(Notes for 6.0.4) but our system is in higher level patch 6.0.5
    2) WF-BATCH have SAP_NEW and SAP_ALL authorization.
    Appreciate your valuable suggestions.
    Thanks
    Ragav

    Hi Ragav
    did you try to debug this? maybe something is missing in config of P&F?
    Since you are on 605, the following note would be there in your system....use it to debug:
    1422496 - Debugging background workflow tasks in HCM P&F
    This will help you find the root cause.
    regards,
    modak

  • Dynamic TaskFlow Gets Refreshed on Catching a Contextual Event

    Hi,
    I am using Contextual events in my application. I have 2 task flows in my parent page. One TF is raising an event and the other is catching it. As my catching TF is a dynamic TF, I have specified the event map in it only.
    Everything is working as intended only that my dynamic TF gets refreshed when it catches the event! I do not want that. I want to explicitly refresh any UI component that requires to be refreshed, not the whole TF.
    So is there any specific property of task flows that make it to refresh itself when ever it catches any contextual event?
    Also I have tried 'Refresh="ifNeeded"' and 'RefreshCondition="#{false}"' in my dynamic taskflow specification in the parent page but it does not make any difference.
    Regards,
    Rahul Saxena

    Rahul,
    there is no setting for this. If however the managed bean you setup for handling the dynamic region is in backing bean scope (or request scope) then chances are that the region is refreshed because the bean restes after the request (just assuming here). Yournot giving us much to chew on (no JDeveloper version, no implementation details etc. ) So its hard to provide further ideas. As a last resort, if you have a support contract, you can contact customer support with a test case
    Frank

Maybe you are looking for

  • Report parameters in MM/DD SSRS

    I have a requirement where there will be two report parameters like From(MM/DD) and To(MM/DD) that will be used to compare against a month and day fields. For example, I have month and day fields stored in a table like MM DD 01 24 05 29 When the user

  • SSRS Running Totals Custom Code

    I have a report in which I need to total a column with an expression and created simple code to have a running total.  When I run the report through report builder, the total only reflects the current page (it is 6 pages long) but if I export the rep

  • Show Photo Settings VS Emptying Trash?

    Am very confused about implications of emptying the trash in iMovie (6hd) ... I've done a movie which is really just photos with effects, motion, music. It SEEMS, as if it's no longer possible to display a preview of a motion photo (Ken Burns effect)

  • Slideshow Exports are not sharp but fuzzy

    Trying Slideshow in A3. Chose Export. Tried the Mobileme/Youtube setting. Uploaded to Youtube - the whole show, the images are like a low quality blurry. It looks the same if I open in iTuns or Quicktime. SO I tried HD 720. Only slightly better, but

  • IPC entries in the listener.ora

    My listener.ora looks like the following, LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521)) Can I remove the IPC entries in the listener.ora? Database version is 11.2.0.3