8 Replies Latest reply: Sep 14, 2012 7:22 AM by 906144 RSS

    How to pass parameter to inline popup when mouse over

    User501417-Oracle
      Hi,

      Here is my requirement:
      I have a table. When mouse over the column (Request Uid) in each row in the table, it will launch the inline popup (using showPopupBehavior) and execute a query to show the details of the Request for the mouseover RequestUid in the popup. I put the codes to execute the query when mouse over in popupFetchListener method. Here is the code snipplet of the jspx page and the popupFetchListener method:

      jspx:_

      <af:table.....>
      .....
      <af:column sortProperty="RequestUid" sortable="true"
      headerText="#{bindings.ItasTasksHomeVO1.hints.RequestUid.label}"
      id="c4">
      <af:outputText value="#{row.RequestUid}" id="ot10">
      <af:showPopupBehavior triggerType="mouseOver" popupId="::p1"/>
      <af:convertNumber groupingUsed="false"
      pattern="#{bindings.ItasTasksHomeVO1.hints.RequestUid.format}"/>
      </af:outputText>
      </af:column>
      .....
      </af:table>

      ...
      <af:popup binding="#{backingBeanScope.backing_myTasksBean.p1}"
      id="p1"
      popupFetchListener="#{backingBeanScope.backing_myTasksBean.getPopupFetchListener}"
      contentDelivery="lazyUncached">
      ...

      </af:popup>


      popupFetchListener method_


      public void getPopupFetchListener(PopupFetchEvent fetchEvent) {

      ItasAppModuleImpl am =
      (ItasAppModuleImpl)ADFUtils.getApplicationModuleForDataControl("ItasAppModuleDataControl");
      ItasRequestHeadersHomeVOImpl requestHeadersHomeVO =
      (ItasRequestHeadersHomeVOImpl)am.findViewObject(ITAS_REQUEST_HEADERS_HOME_VO);

      requestHeadersHomeVO.setWhereClause("request_uid= *+132408+* ");
      requestHeadersHomeVO.executeQuery();
      }

      As you can see, I am hardcoding "request_uid=132408", but I would like "132408" to be replaced by the RequestUid value passed into the inline popup when mouse over.

      Any comments are greatly appreciated.

      Thanks,
      -Mina
        • 1. Re: How to pass parameter to inline popup when mouse over
          Puthanampatti
          In the popupfetchlistener, you can try this:

          BigDecimal requestId =
          JSFUtils.resolveExpression("#{row.RequestUid}");
            public static Object resolveExpression(String expression) {
              FacesContext ctx = FacesContext.getCurrentInstance();
              Application app = ctx.getApplication();
              ExpressionFactory elFactory = app.getExpressionFactory();
              ELContext elContext = ctx.getELContext();
              ValueExpression valueExp = elFactory.createValueExpression(elContext,expression,Object.class);
              return valueExp.getValue(elContext);
            }
          I am not sure though.

          or you have to get the value using some other event and use page flow scope

          requestContext.getPageFlowScope().put("bindaVariableName",request_uid);
          requestContext.getPageFlowScope().get("bindaVariableName");

          Edited by: Puthanampatti on Nov 2, 2009 8:38 PM
          • 2. Re: How to pass parameter to inline popup when mouse over
            Frank Nimphius-Oracle
            Hi,

              <af:popup ... launcherVar="source" eventContext="launcher">
                ...
              </af:popup>
            on the af:outputText component, yet clientComponent = true and add
            <af:outputText ...>
               <af:clientAttribute name="whatevername" value="#{someELaccessibleValue}">
            </af:outputText>
            The add the following code to the popup

              <af:popup ... launcherVar="source" eventContext="launcher">
                ...
               <af:setPropertyListener from="#{source.attributes.whatevername}"
                         to="#{requestScope.whatevername}" type="popupFetch"/>
              </af:popup>
            If requestScope doesn't work, try a larger scope

            Your listener code can now get the dynamic value from Java

            Frank
            • 3. Re: How to pass parameter to inline popup when mouse over
              User501417-Oracle
              Frank,

              Thanks for your suggestion. I tried implementing according to your suggested ways, but I got null when getting the session variable. Here is my code snipplet:

              jspx:_

              <af:table.....>
              .....
              <af:column sortProperty="RequestUid" sortable="true"
              headerText="#{bindings.ItasTasksHomeVO1.hints.RequestUid.label}"
              id="c4">
              <af:outputText value="#{row.RequestUid}" id="ot10">
              *<af:clientAttribute name="TaskRequestUid"*
              *value="#{row.RequestUid}"/>*
              <af:showPopupBehavior triggerType="mouseOver" popupId="::p1"/>
              <af:convertNumber groupingUsed="false"
              pattern="#{bindings.ItasTasksHomeVO1.hints.RequestUid.format}"/>
              </af:outputText>
              </af:column>
              ....
              </af:table>
              ....

              <af:popup binding="#{backing_myTasksBean.p1}" id="p1"
              popupFetchListener="#{backing_myTasksBean.getPopupFetchListener}"
              contentDelivery="lazyUncached" *launcherVar="source"*
              *eventContext="launcher"* >
              *<af:setPropertyListener from="#{source.attributes.TaskRequestUid}"*
              *to="#{sessionScope.TaskRequestUid}"*
              *type="popupFetch"/>*.....
              </af:popup>

              *_popupFetcherListener method:_*

              public void getPopupFetchListener(PopupFetchEvent fetchEvent) {

              .....

              *Object TaskRequestUid = JSFUtils.getFromSession("TaskRequestUid");*
              *LOGGER.info("TaskRequestUid : " + TaskRequestUid);* ....

              }

              *_JSFUtils:_*
              public static Object getFromSession(String key) {
              FacesContext ctx = getFacesContext();
              Map sessionState = ctx.getExternalContext().getSessionMap();
              return sessionState.get(key);
              }


              The log result is:
              TaskRequestUid : null


              Any idea what could go wrong in my codes?

              Thanks.
              -Mina
              • 4. Re: How to pass parameter to inline popup when mouse over
                User501417-Oracle
                Frank,

                I saw your recent example on :
                http://www.oracle.com/technology/products/jdev/tips/fnimphius/valuestopopup/ValuesToPopup.html

                If I access the pass in parameter in the popup in the EL expression in the jspx as in your example, it works for me too:

                <af:popup ...>
                <af:setPropertyListener ..."/>
                <af:panelFormLayout binding="#{backing_myTasksBean.pfl1}"
                id="pfl1">
                <af:panelLabelAndMessage label="MinaPhoneNumber" id="plam33">
                <af:outputText value= *"#{sessionScope.TaskRequestUid}"*
                id="ot43"/>
                </af:panelLabelAndMessage>
                </af:setPropertyListener>
                </af:popup>


                However, I am not able to get the pass in parameter from the session variable programmatically in the popupFetchListener method as described on my code snipplet above.

                I wonder is it because popupFetchListener is executed before setPropertyListener, so the pass in parameter has not been set in the session variable when executing the popupFetchListener method?

                Any more ideas are appreciated.

                Thanks.
                -Mina
                • 5. Re: How to pass parameter to inline popup when mouse over
                  Frank Nimphius-Oracle
                  Hi,

                  actually I don't know if the setPropertyListener is executed first. However, I would think it does because the popup starts fetching when it is getting launched. You can verify this by using a command button on the parent page (set partialSubmit=true) that has a setPropertyListener and that you press before hovering over the table cell. This way the session attribute is set before you launch the dialog. If this still is not accessible then it seems that the access to the session attribute is what we need to have a closer look at. If it works then, then obviously the setPropertyListener executes after the fetch listener and we need to think about an alternative

                  Frank
                  • 6. Re: How to pass parameter to inline popup when mouse over
                    User501417-Oracle
                    Frank,

                    I had tried your suggested way of testing and confirmed that popupFetchListener is executed before setPropertyListener, so the pass in parameter has not been set in the session variable when executing the popupFetchListener method.

                    Another way of testing is for the first mouse over on the first row in the table, I saw
                    The log result is:
                    TaskRequestUid : null

                    but when mouse over the second row, I saw
                    The log result is:
                    TaskRequestUid : xxx1 (where xxx1 is the RequestUid of the first row)

                    and along the same line when mouse over the third row, I saw
                    The log result is:
                    TaskRequestUid : xxx2 (where xxx2 is the RequestUid of the second row)

                    This is how I confirmed that setPropertyListener with type="popupFetch" is called after popupFetchListener.

                    So is there any alternative way of achiveing my requirement?

                    Thanks.
                    -Mina
                    • 7. Re: How to pass parameter to inline popup when mouse over
                      User501417-Oracle
                      Frank,

                      I found the solution. In the popupFetch Listener method:

                      Number TaskRequestUid =
                      (Number)EL.get("#{source.attributes.TaskRequestUid}");

                      to get the passin parameter instead of

                      <af:setPropertyListener from="#{source.attributes.TaskRequestUid}"
                      to="#{sessionScope.TaskRequestUid}"
                      type="popupFetch"/>

                      Thanks so much for all your suggestions and ideas. It helps!

                      Thanks.
                      -Mina
                      • 8. Re: How to pass parameter to inline popup when mouse over
                        906144
                        What is 'EL' in the last reply??