5 Replies Latest reply on Feb 11, 2012 4:51 PM by Steven Davelaar-Oracle

    Open dynamic tab programmatically (jhsDynTabContext)

      We use JHeadstart in our application. Dynamic tabs are enabled by using jhsDynTabContext bean (class oracle.jheadstart.view.dyntab.DynTabContext.java).
      I'm trying to open a dynamic tab programmatically and I need to call DynTabContext.getCurrentInstance() to get tab context to open a new tab, but the method returns null value. How come?
      I went to see the code and it tries to get it via expressions "#{viewScope.jhsDynTabContext}" or "#{pageFlowScope.jhsDynTabContext}". Where and how do I set these? Or what is the most common procedure in opening dynamic tabs programmatically?
      Regards, Marko
        • 1. Re: Open dynamic tab programmatically (jhsDynTabContext)
          Stephen J.
          I think, looking at Steven D.'s post (open new dynamic tab from bean that you need to pass the current tabContext as a parameter.
          • 2. Re: Open dynamic tab programmatically (jhsDynTabContext)
            Hm, how do I do that?
            Where is the place to get tabContext (which is not null) and pass it as a bounded task flow parameter? Master page (UIShell.jspx )?
            I hope I'm being clear :P
            • 3. Re: Open dynamic tab programmatically (jhsDynTabContext)
              Steven Davelaar-Oracle
              the expression #{pageFlowScope.jhsDynTabContext} returns the tabContext when evaluated in the context of the unbounded taskflow.

              If you need to pass it to a group-generated taskflow, then define a group parameter named jhsDynTabContext with value #{pageFlowScope.jhsDynTabContext}, this will make the same expression return the tabContext within this task flow.

              Steven Davelaar,
              JHeadstart Team.
              1 person found this helpful
              • 4. Re: Open dynamic tab programmatically (jhsDynTabContext)
                Hi Steven.
                I did as you told, but every expression #{pageFlowScope.jhsDynTabContext} still returns no value. I get non null only with #{viewScope.jhsDynTabContext} in UIShell.jspx, everywhere else in page fragments it's null again. I tried to pass it with #{viewScope.jhsDynTabContext} expression but it displays an error: "oracle.adf.controller.ControllerException: ADFC-12006: The scope of the referenced object '#{viewScope.jhsDynTabContext}' is shorter than the referring object 'jhsDynTabContext'."
                Am I missing something? Please help :)

                Regards, Marko
                • 5. Re: Open dynamic tab programmatically (jhsDynTabContext)
                  Steven Davelaar-Oracle

                  My fault, the jhsDynTabContext is indeed stored in viewScope.
                  However, an alternative approach might be much simpler to implement.
                  JHeadstart supports opening a dynamic tab from within another dynamic tab using an item with display type groupLink, and the "Show Linked Group In" set to "New Dynamic Tab".

                  I don't know exactly your use case but if it really has to be done programatically, then you can apply the same technique as we do with the group link:
                  - set the name of the taskflow that should be opened in the new tab on the jhsDynTabLauncher managed bean (defined in the TF template)
                  - pass the jhsDynTabLauncher to the parentContext
                  - use action outcome "LaunchTab", this triggers a parent action (also defined in the TF template) picked up in the unbounded taskflow that launches the new tab using the jhsDynTabLauncher now available in the parentContext.

                  Steven Davelaar,
                  JHeadstart team.