10 Replies Latest reply on May 16, 2012 6:43 AM by Sudipto Desmukh

    Open dynamic tab from remote page

      I have a question. We use JDeveloper

      We are using dynamicTabShell template for dynamic tabs managment in our application. Everything works as it should if page is using dnymicTabShell template. But...
      I would like to have a Home.jspx that would load when client logs in. Home should be a special page without dynamic tabs support. I would like to have quick links on Home.jspx that would open certain page and bounded task flow with page fragments in application. How can I achieve that? Do I have to enable URL invoke property? Problem is, we implemented custom security that checks if client has proper permissions before task flow is launched through _launchActivity* method in launcher.java. URL invokation would make security more complex.

      In fewer words: Is there's a way of opening certain tab in application from page that does not use dynamicTabShell template? Or do I have to enable URL invoke property on bounded task flows with page fragments? How can I then check permissions if task flow is reachable through URL.

      I hope I'm being clear.
      Regards, Marko
        • 1. Re: Open dynamic tab from remote page
          Oh and meanwhile I read that you cannot URL invoke bounded task flow that use page fragments. So my question still stands :)
          • 2. Re: Open dynamic tab from remote page
            • 3. Re: Open dynamic tab from remote page
              Frank Nimphius-Oracle

              your question isn't clear to be honest as the use case is not clear.

              Use Case #1:

              Have a home.jspx page that navigates to a page using the dynamic tab shell and launch a specific task flow in a tab

              Use case #2:

              Have a home.jspx page that navigates to a page not using the dynamic tab shell template and open a task flow in a region

              Your question is not clear on which use case you are after. For Use case #1, pass a request parameter (e.g. attribute in requestScope) with the page request. On the page (that has the tabShell template) have a phae listener defined that i) after restore view accesses the request parameter and writes it to pageFlowScope ii) beforeRenderResponse reads the parameter from pageFlowScope and invokes the tabContext API to launch the task flow requested by the home.jspx page in a tab.

              For use case #2 the scebario is similar but different. Here - because you don't use the tab shell template - you launch the task flow in a dynamic region. Again, you pass a request parameter and use a phase listener. However, you then access the managed bean (viewScope) controlling the dynamic region to set the task flow to display

              use case 2': You want to work with a staticregion on the page you navigate to but want to show a specific view within the task flow. In this case you also pass a parameter with the request but use a router activity as the first activity in the task flow. The router then reads the paremeter and determine sthe view to navigate to.

              So now you have all three possible variations and use cases that should get you going

              • 4. Re: Open dynamic tab from remote page
                Use Case #1 would be my case. Home.jspx does not use dynamic tabs and it contains quick links which would open pages with bounded task flow (with page fragments) that do use dynamic tabs.

                So if I understand you correctly I would have to transfer parameter (task flow id to open?) to opening page and beforePhase method would read that page parameter and launch specific activity in Launcher.java by calling launchActivity()? But the problem is TabContext is null if I launchActivity() from beforePhase method.

                What am I missing?
                Oh, and thank you for your answer ;)
                • 5. Re: Open dynamic tab from remote page
                  Please? Any help?

                  I get this error when trying to run _launchActivity in overriden beforePhase()

                  java.lang.NullPointerException: UIComponent is null
                       at org.apache.myfaces.trinidad.component.UIXComponent.addPartialTarget(UIXComponent.java:751)
                       at org.apache.myfaces.trinidadinternal.context.RequestContextImpl.addPartialTarget(RequestContextImpl.java:539)
                       at oracle.adfinternal.view.faces.context.AdfFacesContextImpl.addPartialTarget(AdfFacesContextImpl.java:661)
                       at oracle.ui.pattern.dynamicShell.TabContext._refreshTabContent(TabContext.java:504)
                       at oracle.ui.pattern.dynamicShell.TabContext.setSelectedTabIndex(TabContext.java:339)
                       at oracle.ui.pattern.dynamicShell.TabContext.addTab(TabContext.java:210)
                       at oracle.ui.pattern.dynamicShell.TabContext.addOrSelectTab(TabContext.java:167)
                       at oracle.ui.pattern.dynamicShell.TabContext.addOrSelectTab(TabContext.java:144)
                       at beans.Launcher._launchActivity(Launcher.java:158)
                  • 6. Re: Open dynamic tab from remote page
                    Sudipto Desmukh
                    Check posts from Frank in this thread on why NPE occurs in beforePhase -
                    bP exception
                    • 7. Re: Open dynamic tab from remote page
                      I execute _launchActivity() in prepare render phase in beforePhase method as Frank told me but I still get the same error

                      public void beforePhase(PagePhaseEvent pagePhaseEvent) {
                      if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
                      • 8. Re: Open dynamic tab from remote page
                        Anybody understands what is going on? I'm pretty desperate :(
                        • 9. Re: Open dynamic tab from remote page
                          OK, is there no other way of opening a bounded task flow with page fragments in a page (which is using dynamicTabShell template) from other page that is not using dynamicTabShell template?
                          Maybe calling _launchActivity in beforePhase is completely wrong approach, because "java.lang.NullPointerException: UIComponent is null" is returned.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                          • 10. Re: Open dynamic tab from remote page
                            Sudipto Desmukh
                            Download the example here and have a read to see what you are missing -