This discussion is archived
7 Replies Latest reply: Oct 15, 2012 7:27 AM by 952174 RSS

Access Iterator binding from a region

952174 Newbie
Currently Being Moderated
Hi,
Using JDEV 11.1.1.5.0

I've created a ADF Tree dynamically from a single table(Using recursive concept) in center region. User can select the required elements from ADF tree and then click on Command button. So far, I've achieved till this part.

The pending part is, two regions(Bottom & Right) need to refresh at a time with button click.
Now I need to display selected elements in bottom region. Also need to provide the selected nodes information to do some calculation in the right region at a time.

Following is the jspx code:

<f:view>
<af:document id="d1">
<af:form id="f1">
<af:panelSplitter id="ps1" orientation="vertical">
<f:facet name="first">
<af:panelGroupLayout id="pgl1">
<af:panelSplitter id="ps3">
<f:facet name="first">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
id="pgl4">
<af:panelFormLayout id="pfl1">
<af:region value="#{bindings.dynamicRegion1.regionModel}"
id="r1"/>
</af:panelFormLayout>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelGroupLayout id="pgl5">
<af:panelFormLayout id="pfl2">
<af:commandButton text="Update" id="cb1"/>
          <af:outputText value="Select Folders or Files" id="ot1"/>
<af:region value="#{bindings.dynamicRegion2.regionModel}"
id="r2"/>
</af:panelFormLayout>
</af:panelGroupLayout>
</f:facet>
</af:panelSplitter>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelGroupLayout id="pgl2">
<af:outputText value="Selected Files" id="ot1"/>
          <!-- Need to extract the selected nodes here.-->
</af:panelGroupLayout>
</f:facet>
</af:panelSplitter>
</af:form>
</af:document>
</f:view>

Some how, i could not able proceed further on this.

Can you provide hint on this usecase to proceed further.

Thanks,
Samba.
  • 1. Re: Access Iterator binding from a region
    Cvele_new_account Expert
    Currently Being Moderated
    http://andrejusb.blogspot.com/2011/02/adf-region-communication-region-refresh.html
    http://multikoop.blogspot.com/2011/11/adf-panel-tabbed-inter-region.html
  • 2. Re: Access Iterator binding from a region
    952174 Newbie
    Currently Being Moderated
    Hi,

    Thanks for your references.
    Here I've different requirement. I need to pass all the selected nodes information to the two regions (bottom & right) at a time with command button click. You are right, we can use contextual events or passing parameters if we want to send predefined values (like department id). In my case, i need to pass all the selected nodes information. Can you provide a hint to pass the selected nodes information to the two regions at a time. Yes, we can use contextual event by publish/subscribe process inorder to send information to more than one region. How can I pass the selected nodes information?


    -Samba
  • 3. Re: Access Iterator binding from a region
    Cvele_new_account Expert
    Currently Being Moderated
    I think this will help:

    http://one-size-doesnt-fit-all.blogspot.com/2010/08/jdev-11g-programmatic-contextual-events.html

    Pay attention to the PublisherBean.doAction(), along with ConsumerBean.handleEvent()

    P.S. I assume you have a way to get the selected nodes information somehow...
  • 4. Re: Access Iterator binding from a region
    952174 Newbie
    Currently Being Moderated
    Hi,

    It seems to be i can achieve the required functionality with programatic contextual event approach.

    I tried to develop the sample as per the instructions, but i am getting issue at "configure the ConsumerPage's bindings to subscribe to the PublisherBTF's event".

    Following is the instruction where iam facing issue.

    Selecting the Looking Glass button on the Event field allows us via the resulting Select Contextual Event dialog to select the event "publisherEvent" from the PublisherBTF. Note it's possible to select the event from both the embedded PublisherBTF within the region of the ConsumerPage, or the event from the ADF Library. As the BTF has already been configured in the ConsumerPage, use the former:

    Issue:
    I've only one option to select the event from 'ADF Library'. I don't have two options to select the required event.

    Following are the steps followed to get ADF Jar into Consumer Master Application.
    1. Go to Resource Palette
    2. New Connection -> File System
    3. Provided connection name (testFileSysConn) & directory path then test connection.
    4. Test connection is success.
    5. Then click on 'Ok'
    6. Right click on PublishBTF1.jar from Resource Palette->File System-> testFileSysConn
    7. Add to Project.

    I couldn't find any changes under Data Control section with the above steps. Please correct me , if Iam wrong.


    Also I found that, Publisher Dropdown is disabled in 'Subscribe to Contextual Event' popup window.

    Thanks,
    Samba.
  • 5. Re: Access Iterator binding from a region
    Cvele_new_account Expert
    Currently Being Moderated
    If you still have problems with this ...
    In fact, there is another task flow inter-region communication /sharing information between task flows/, "developed" by me :-)

    Take a look at:

    Re: A a new way for task flow region communication - what do you think ?
    Generating RegionNavigationEvent while stayin on the same View activity ?

    See how easy it is :-)
  • 6. Re: Access Iterator binding from a region
    952174 Newbie
    Currently Being Moderated
    Finally able to communicate between two regions with the help of programmatic contextual event approach. Now I need to iterate through the dynamic tree in my event controller and then display the selected documents in bottom region. Following is the code for source fragment in which first region contains dynamic tree and second region contains selected documents list.

    <f:facet name="first">
         <af:panelGroupLayout layout="scroll"
                                  xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                                  id="pgl4">
         <af:commandButton text="Update" id="cb1"
                                  actionListener="#{pageFlowScope.EventPublisherBean.doAction}"
                                  action="selected_documents"/>
         <af:region value="#{bindings.dynamicRegion1.regionModel}"
                        id="r2"/>
         </af:panelGroupLayout>
    </f:facet>

    <f:facet name="second">
         <af:panelLabelAndMessage label="Documents Selected" id="plam1">
         <af:panelGroupLayout id="pgl2">
         <af:region value="#{bindings.selecteddocs1.regionModel}" id="r3"/>
         </af:panelGroupLayout>
         </af:panelLabelAndMessage>
    </f:facet>

    Following is the sample handleEvent method. Here able to get the source region components information & able to set the values in target regions.

    public void handleEvent(Object payload){
    ActionEvent actionEvent = (ActionEvent)payload;
    UIComponent component = (UIComponent)actionEvent.getSource();

    UIComponent parent = (UIComponent)component.getParent();
    String parentId = parent.getId();
    System.out.println("PARENT ID:"+parentId);
    System.out.println("Component ID:"+component.getId());
    FacesContext context = FacesContext.getCurrentInstance();
    ELContext elContext = context.getELContext();
    Application app = context.getApplication();
    ExpressionFactory expFactory = app.getExpressionFactory();
    ValueExpression valueExp = expFactory.createValueExpression(elContext, "#{pageFlowScope.SubscriberBean}", Object.class);
    SubscriberBean bean = (SubscriberBean)valueExp.getValue(elContext) ;
    bean.setFName("YYYYY");
    AdfFacesContext adfContext = AdfFacesContext.getCurrentInstance();
    adfContext.addPartialTarget(bean.getFnameField());
    }

    can you give a hint to iterate through dynamic tree binding to get information of selected tree nodes?
    Once we got the selected nodes of tree, how can we print the results on to target region?

    Thanks,
    Samba

    Edited by: 949171 on Oct 14, 2012 12:12 AM
  • 7. Re: Access Iterator binding from a region
    952174 Newbie
    Currently Being Moderated
    Hi,

    Unable to access bindings of source fragment from Contextual Event controller or target fragment.

    But I can access components of source/target fragments from a Contextual Event controller.

    Please suggest to access tree nodes of source fragment from Event controller or target fragment.

    Thanks,
    Samba.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points