Topic
12 replies Latest Post - ‏2013-01-18T00:42:29Z by SystemAdmin
SystemAdmin
SystemAdmin
2606 Posts
ACCEPTED ANSWER

Pinned topic JSF diagrammer: multiple diagrams in a single session? In a single page?

‏2010-08-25T21:37:15Z |
We have a JViews JSF diagrammer application (ie, browser-based, not Swing based).

As shown in the 'jsf-diagrammer-editing' sample that's provided by ILOG, we create our diagram in a JSF page using the jvdf:diagrammerView tag. That results in an IlvDiagrammer object being created for our app, "behind the scenes", by ILOG libraries. That IlvDiagrammer object is attached, again by ILOG libaries, to a servlet session.

Is it possible to create multiple JViews diagrams within a single browser session? In some sense, what we're looking for is to have the IlvDiagrammer object (created by ILOG libaries) attached to a page scope, instead of a session-scope. However, that doesn't quite cover the entire issue because we might also, in the future, want to have multiple diagrams in a single AJAX page.

Basically, our page is AJAX based, so both [1] ILOG built-in server-side graph request handlers and [2] our custom AJAX query handlers will all need to know which page and diagram are "in scope" per query to the server. Knowing just the session is not enough for server-side code to get the proper graph.

If anyone could give pointers on how to get multiple diagrams into a single session, or even into a single page, that would be much appreciated.
Updated on 2013-01-18T00:42:29Z at 2013-01-18T00:42:29Z by SystemAdmin
  • LokiLuo
    LokiLuo
    20 Posts
    ACCEPTED ANSWER

    Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

    ‏2010-08-26T01:46:43Z  in response to SystemAdmin
    You can create multiple diagrammer instances in the back bean.
    For example:
    <jvdf:diagrammerView id="diagrammer1" diagrammer="#{editingBean.diagrammer1}" ... />
    <jvdf:diagrammerView id="diagrammer2" diagrammer="#{editingBean.diagrammer2}" ... />
    Then in the session will create two diagrammer instances.
    Does this your wants?
    • SystemAdmin
      SystemAdmin
      2606 Posts
      ACCEPTED ANSWER

      Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

      ‏2010-08-26T07:17:07Z  in response to LokiLuo
      We have a few problems which seem very similar, and we were wishfully thinking they might all be solved in one "swoop". The above proposed solution may solve one of our problems.

      However, it seems our main problem is still not yet solved. To make the main problem more concrete, here are two scenarios:

      Scenario 1:

      • Step 1.1: User uses Internet Explorer to browse to 'http://localhost:8080/jsf-diagrammer-editing/' and user sees "Graph A" (the first graph ever served from a brand new IlvDiagrammer object). Using AJAX buttons in the IE window, user makes changes to "Graph A", so that user is now looking at "Graph B".

      • Step 1.2: While above "session" of IE is still running, the same user now uses FireFox to browse to the same url 'http://localhost:8080/jsf-diagrammer-editing/'.

      Question: will FireFox show "Graph A" or "Graph B"? Answer: from actually running this experiment, we see that FireFox does actually show "Graph A".

      • Step 1.3: Now FireFox user can make a different sequence of changes to "Graph A" than was made in IE session above, so producing "Graph C".

      Question: if user goes back to IE and presses the Refresh button, will user see "Graph B" or "Graph C"? Answer: from actually running this experiment, we see that IE does actually show "Graph B".

      What does above experiment tell us? That the concurrently running IE and FireFox each have their own session and the one server that is serving up the "page" at url 'http://localhost:8080/jsf-diagrammer-editing/' is maintaining TWO IlvDiagrammer objects - one for the session in IE and one for the session in FireFox.

      The above is "great" for us. It's exactly what we want.
      Scenario 2:

      • Step 2.0: Restart server (so no pre-existing sessions and no pre-existing IlvDiagrammer objects).

      • Step 2.1: User uses Internet Explorer to browse to 'http://localhost:8080/jsf-diagrammer-editing/' and user sees "Graph A". Using AJAX buttons in the IE window, user makes changes to "Graph A", so that user is now looking at "Graph B".

      • Step 2.2: On the same machine, the same user opens up a brand new IE window while the IE window showing "Graph B" from Step 2.1 is still open. In the new IE window the user again browses to 'http://localhost:8080/jsf-diagrammer-editing/'.

      Question: will the new IE window from step 2.2 show "Graph A" or "Graph B"? Answer: from actually running this experiment, we see that the new IE window does actually show "Graph B".

      Uh-oh. That's not good for us. We really wanted the new IE window to behave like the FireFox window in Scenario 1. That is, show "Graph A" - from a brand new IlvDiagrammer object. Instead, the two different IE windows are now sharing one single IlvDiagrammer object. So, any changes the user makes to the graph in one IE window will end up affecting what the user sees, eventually, after say a refresh, in the other IE window.
      To summarize, in Scenario 1, the IE window and the FireFox window each get their own unique IlvDiagrammer object (great!). However, in Scenario 2, the two IE windows each share the same IlvDiagrammer object (not great!).

      So, what we really want to know is, can we somehow force two different windows of IE that are each running on the same machine for the same user at the same time, to use two different IlvDiagrammer objects, as would happen if that same user instead had one IE window open and one FireFox window open on same machine at same time?

      I understand that there are four scope objects in servlets:

      • Web Context – javax.servlet.ServletContext
      • Session – javax.servlet.http.HttpSession
      • Request – javax.servlet.HttpServletRequest
      • Page – javax.servlet.jsp.PageContext

      It seems that we want to put a distinct IlvDiagrammer object into each "Page" - not into each "Session".

      However, 'http://localhost:8080/jsf-diagrammer-editing/' is a JSF application, with a faces-config.xml file, in which we can a specify <managed-bean-scope> with four possible values:

      • “application”
      • “session”
      • “request”
      • “none”

      Conspicuously absent from above choices for <managed-bean-scope> is "page"(!).

      What to do?
      • LokiLuo
        LokiLuo
        20 Posts
        ACCEPTED ANSWER

        Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

        ‏2010-08-26T08:37:28Z  in response to SystemAdmin
        We have one solution to solve your problem, it is a bit complex to explain it here, but you can call IBM support to ask for it.
        You can refer to the attachment file.
        Updated on 2010-08-26T08:37:28Z at 2010-08-26T08:37:28Z by LokiLuo
        • SystemAdmin
          SystemAdmin
          2606 Posts
          ACCEPTED ANSWER

          Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

          ‏2010-09-02T15:34:15Z  in response to LokiLuo
          Thank you very much for your response and sample solution. After spending some time looking at the sample, it looks like it will solve our problem. (Unfortunately, I have to put finishing exploring this possible solution aside for a while, so I won't be able to confirm definitely whether it solves our problem until then.)
          • SystemAdmin
            SystemAdmin
            2606 Posts
            ACCEPTED ANSWER

            Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

            ‏2010-12-10T19:20:07Z  in response to SystemAdmin
            (I know this is now an "old" thread. I'm not sure I should open a new thread for my new, but very related, question…)

            I'm running into a new problem with the 'browser-tab.zip' sample provided above. That sample uses a jvf:view tag and the following attribute in that jvf:view tag:

            view="#{tabBean.tabViewer.managerView}"

            However, our app uses a jvdf:diagrammerView tag, not a jvf:view tag. From looking at the docs for the jvdf:diagrammerView tag, it seems jvdf:diagrammerView does not have a 'view' attribute (nor do I see any attribute in jvdf:diagrammerView that looks like it could take the place of 'view').

            That 'view' attribute of jvf:view seems central to the solution for having multiple views(!).

            So, my main new question is: can the technique used in the above 'browser-tab.zip' sample be modified for use with jvdf:diagrammerView instead of with jvf:view, or am I going to be forced to change from using jvdf:diagrammerView to jvf:view?

            As a "side" question, I don't see any way for me to "take over" creation of the SDMView in the java code on the server. I do see the over-ridable function:

            IlvFacesDiagrammerServletSupport.getSDMView(HttpServletRequest)

            but it seems that if I create and return my own IlvSDMView object in that function then our app stops working (I get a blank graph). It seems that the "real" IlvSDMView object actually used by ILOG framework is created by the ILOG framework BEFORE 'getSDMView()' is called, and it seems I have no way of taking over the creation of the IlvSDMView object that is really used by ILOG framework. The reason I thought I might need to take over creation of IlvSDMView is so that I could have one for each of the multiple graphs we want to show in our app at the same time.

            So, my secondary question is: is it possible for our app to take over, from the ILOG framework, the creation of the IlvSDMView objects?
            • eabe
              eabe
              13 Posts
              ACCEPTED ANSWER

              Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

              ‏2010-12-11T02:42:23Z  in response to SystemAdmin
              Hello Bob321,

              It seems that what you are looking for is a way to support multiple browser tabs with JViews, which implies associating a view component such as jvdf:diagrammerView with a specific browser page in the session.

              To answer your main question, the idea behind the sample provided by LokiLuo can also be applied to Diagrammer and any other JViews JSF view component, the equivalent of the view attribute in jvf:view would be the diagrammer attribute in jvdf:diagrammerView.

              And concerning your side question, it is actually related to your main question: When you bind the diagrammer attribute to a bean you are able to control the instantiation of a IlvDiagrammer object, and from that you can define the IlvSDMView that goes with it.

              Please have a look at the attached file, it extends the one from LokiLuo to JViews Diagrammer and should work fine with JViews 8.7 (previous versions may require some small modifications).

              I hope it will prove helpful to you.

              Regards,
              eabe
              • SystemAdmin
                SystemAdmin
                2606 Posts
                ACCEPTED ANSWER

                Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

                ‏2010-12-14T20:10:47Z  in response to eabe
                Thank you for your response. Your new sample called 'multi-tab.zip' has helped us make some major steps forward. We now can have many different graphs within a single browser session (for now, each of our graphs appearing in its own different page/tab/window).

                However, we're still running into problems. For example, if user clicks on a node in the graph then an "action" is initiated. This action is handled using Java code on the server. Before we made the changes for "multi-tab" that action Java code worked fine. After we made the changes for "multi-tab" that action Java code stopped working.

                The first symptom of the problem was that the action-handling code on the server does not use the graph-specific DiagrammerBean, but instead generates a new DiagrammerBean instance (on the server) for every invocation of the Java action (running on the server). Somehow, we need the Java action-handler code to use "tabBean.tabViewer.diagrammerBean", and not some newly generated diagrammerBean.

                To try to fix above problem, I then noticed that our faces-config.xml file still had the following entry:

                <managed-bean>
                <description>A diagram component demo bean</description>
                <managed-bean-name>diagrammerBean</managed-bean-name>
                <managed-bean-class>service.MyDiagrammerBean</managed-bean-class>
                <managed-bean-scope>session</managed-bean-scope>
                </managed-bean>

                So, I figured we have to remove that entry because, I thought, we really don't want a 'diagrammerBean' to exist in 'session' scope anymore, because we're now getting our diagrammerBean using "tabBean.tabViewer.diagrammerBean". That is, 'tabBean' is a 'request' scoped bean from which we want ALL of our code, including action handler code , to extract ouf 'diagrammerBean'. So, I deleted the above <managed-bean>...diagrammerBean...</managed-bean> from our faces-config.xml.

                Unfortunately, that produces a different problem. Now we get the exception stack shown below. What that exception seems to be saying is that ILOG action handling infrastructure/framework code is trying to find 'diagrammerBean' but it can't. So, that produces a new question: how do I get ILOG framework action-handling code to find 'diagrammer' bean from tabBean.tabViewer.diagrammerBean, instead of trying to find 'diagrammer' bean as a 'session' scoped managed bean?

                SEVERE: Servlet.service() for servlet Controller threw exception
                javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'diagrammerBean' resolved to null
                at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:95)
                at ilog.views.diagrammer.faces.dhtml.servlet.IlvFacesDiagrammerActionRedirector.actionPerformed (Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.a(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.e(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.beforeDraw(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.b(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.a(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.generateImage(Unknown Source)
                at ilog.views.diagrammer.faces.dhtml.servlet.IlvFacesDiagrammerServletSupport.generateImage(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.e(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.a(Unknown Source)
                at ilog.views.servlet.IlvManagerServletSupport.handleRequest(Unknown Source)
                at ilog.views.sdm.servlet.IlvSDMServletSupport.handleRequest(Unknown Source)
                at ilog.views.diagrammer.servlet.IlvDiagrammerServletSupport.handleRequest(Unknown Source)
                at ilog.views.diagrammer.faces.dhtml.servlet.IlvFacesDiagrammerServletSupport.handleRequest(Unknown Source)
                at servlet.MyFacesDiagrammerServletSupport.handleRequest(MyFacesDiagrammerServletSupport.java:733)
                at ilog.views.sdm.servlet.IlvSDMServlet.doGet(Unknown Source)
                at ilog.views.diagrammer.faces.dhtml.servlet.IlvFacesDiagrammerServlet.service(Unknown Source)
                at servlet.MyServlet.service(MyServlet.java:60)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                at servlet.MyServlet.service(MyServlet.java:75)
                at ilog.views.faces.IlvFacesController.service(Unknown Source)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                at java.lang.Thread.run(Thread.java:619)
                Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'diagrammerBean' resolved to null
                at org.apache.el.parser.AstValue.getTarget(AstValue.java:46)
                at org.apache.el.parser.AstValue.invoke(AstValue.java:127)
                at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                ... 34 more
                • SystemAdmin
                  SystemAdmin
                  2606 Posts
                  ACCEPTED ANSWER

                  Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

                  ‏2010-12-14T21:41:42Z  in response to SystemAdmin
                  Let me add some info that may help clarify the latest issue/problem:

                  Now that we want to use "tabBean.tabViewer.diagrammerBean" to "get" the diagrammerBean on the server, it seems to me that EVERY request to the server has to include the "tabID" (ie, graph identifier) as part of the request. In all the requests to the server that work in our application, that ID is now passed as a parameter in the request url, something like this:

                  http://localhost:8080/myApp...?... tabID=123 ...

                  If I run the sample provided in 'multi-tab.zip' and if I use Firebug to look at the url that's generated in response to me clicking on a node in browserTab04.jsp then I see this url (generated by ILOG client-side):

                  http://localhost:8080/MultiTab/_contr?request=lightselect&bbox=41.99247%2C10.37587487355551%2C527.3643186352539%2C307.62918587056475&width=600&height=350&layer=Links%2CNodes&facesData=demo.servlet.DiagrammerServlet&facesService=forward&facesComponentId=diagrammer&componentWidth=600&componentHeight=350& mainForm:tabId=0eb21ca1-0f1c-4b7b-b60f-c866cc2b8d40 &infoProviderMB=%23%7BselectBean.propertyAccessor%7D&selectionType=selectOne&x=67&y=67&mouseUp=false

                  Note the presence of the 'tabID' in above url. I don't understand how/why/where/when that tabID got added to the url by ILOG client-side code.

                  Now, it seems to me, in our application we have to have that 'tabID' present in the url that is generated by ILOG to invoke an action on the server. So, I wrote some code to add that tabID into the url that ILOG uses to invoke the action, resulting in this url when user clicks node in our graph:

                  http://localhost:8080/myApp/_contr;jsessionid=5AE0F84DDCE25EC04E3497107F169317?request=image&layer=Links%2CNodes&bbox=-175.41067614583332%2C20%2C403.90729166666665%2C399.46875&format=PNG&again=Tue%2C%2014%20Dec%202010%2020%3A49%3A14%20GMT%20421&facesData=servlet.MyServlet&facesService=forward&facesComponentId=diagrammer&componentWidth=910&componentHeight=900&action=jsfAction%28%23%7BdiagrammerBean.doYourThing%7D%2Centity3%29&changeVBox=false& mainForm:tabID=c6fa2948-1c71-4217-9b9e-9f471a4d7358 &bgcolor=0xffffff

                  It looks to me like Java ILOG framework running on the server is not using that tabID to look up diagrammerBean. That's not too surprising since I don't expect java ILOG framework know about tabID. But, somehow, it seems to me, we need to make java ILOG framework use tabID and "tabBean.tabViewer.diagrammerBean" when the ILOG framework tries to find diagrammerBean while executing the server-side action.

                  Any help on how to accomplish that would be appreciated.
                  • SystemAdmin
                    SystemAdmin
                    2606 Posts
                    ACCEPTED ANSWER

                    Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

                    ‏2010-12-14T21:59:55Z  in response to SystemAdmin
                    I think I can summarize my last 2 posts like this:

                    It seems that the server-side ILOG function

                    ilog.views.diagrammer.faces.dhtml.servlet.IlvFacesDiagrammerActionRedirector. actionPerformed (...)

                    is trying to invoke a method on an instance of diagrammerBean.

                    The problem is that the ILOG actionPerformed function is not "getting hold of" the proper instance of diagrammerBean. That function must, somehow, be made to use the "tabId" passed in the url to find the proper instance of diagrammerBean.

                    How do we make that happen?
                    • eabe
                      eabe
                      13 Posts
                      ACCEPTED ANSWER

                      Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

                      ‏2010-12-15T22:30:03Z  in response to SystemAdmin
                      Hello again,

                      I am glad that the sample helped in a way. I hope I will be able to give you answers to your questions, but please keep in mind that JSF was not designed to support multiple browser tabs - thus the extra effort to make it happen. You are encouraged to contact your IBM Support representative and request this feature in a future release ;-)

                      It might be better for us if you could describe your requirements based on the 'multi-tab.zip' so I (and others) will be able to better understand the problems and (hopefully) solutions - that is the whole intention of the forum, if you need to address specific requirements then I believe IBM Support might be the appropriate channel.

                      On a previous post you wrote:

                      To try to fix above problem, I then noticed that our faces-config.xml file still had the following entry:

                      <managed-bean>
                      <description>A diagram component demo bean</description>
                      <managed-bean-name>diagrammerBean</managed-bean-name>
                      <managed-bean-class>service.MyDiagrammerBean</managed-bean-class>
                      <managed-bean-scope>session</managed-bean-scope>
                      </managed-bean>

                      I am not exactly sure what your "MyDiagrammerBean" does... I'll try to respond based on the "multi-tab.zip" sample, where a "diagrammerBean" is declared as a "request" bean, and not as a "session" bean.

                      This bean is bound to the JSF component, as illustrated in "browserTab04.jsp":
                      
                      <jvdf:diagrammerView id=
                      "diagrammer" style=
                      "width:600;height:350" : diagrammer=
                      "#{diagrammerBean.tabViewer.diagrammer}" :
                      


                      In this case, the "#{diagrammerBean.tabViewer.diagrammer}" binding will return an instance of "IlvDiagrammer" that is retrieved from the session using the "mainForm:tabId" as follows:

                      1. The "DiagrammerBean" is instantiated on every request ("request" bean)
                      2. The constructor will get the "mainForm:tabId" from the request and use it to retrieve the "DiagrammerTabBean" from the session (one instance for every tab/page/window). If none exists a new "DiagrammerTabBean" is created.
                      3. Method "DiagrammerBean.getTabViewer()" accesses the "DiagrammerTabBean" (retrieved by the constructor) which has a reference to the "IlvDiagrammer"

                      Concerning the "mainForm:tabId" (or "tabId"), it is essential for this solution, it defines the client identifier that is used to store specific data in the session because each page/tab/window shares the same session id. The client stores this data in an "inputHidden" tag, if you look back to "browserTab04.jsp":

                      
                      <h:inputHidden id=
                      "tabId" value=
                      "#{diagrammerBean.tabViewer.tabViewerId}"></h:inputHidden>
                      


                      Note that it is also bound to the "DiagrammerBean" bean, which is instantiated at every request. When the JSP page is being rendered for the first time, the "DiagrammerBean" will be instantiated and the constructor will create a new "tabId" and store it in the session. Additionally, the client will get and store this identifier in the "inputHidden" tag.

                      Since it is an input tag inside a "h:form", its value will always be included on JSF requests (form submission), so that's why you spotted it. But this is not enough, because JViews also sends requests to its servlets outside the JSF live-cycle (thus, the "tabId" is not automatically included in the request). To address that, you need to check the "script.js" file:

                      
                      
                      
                      if (typeof(IlvView) != 
                      'undefined') 
                      { IlvView.prototype.realInit = IlvView.prototype.init; IlvView.prototype.init = function() 
                      { var tabId = document.getElementById(
                      'mainForm:tabId').value; this.setAdditionalParameters(
                      "mainForm:tabId", tabId); this.realInit(); 
                      }; 
                      }
                      


                      This script is included by the "browserTab04.jsp" and what it does is override the "IlvView.prototype.init" JavaScript function to always add the "tabId" as an additional parameter of the "IlvView". This is a bit advanced, you may need to check the documentation but basically the "IlvView" JavaScript object corresponds to the Diagrammer view, and adding the "tabId" as an additional parameter means that the JViews requests to its servlets will include the "tabId".

                      With that, the two scenarios are covered: JSF requests will carry the "tabId" automatically because of the "inputHidden" tag inside the "form", and JViews requests will also carry the "tabId" automatically because the "script.js" is adding it as an additional parameter.

                      So in theory you shouldn't need to code anything to have the "tabId" in all requests if you are following the sample. That may be different if you have Ajax requests or if you add multiple forms in your JSP page - in these cases you will need some extra tricks to ensure that the "tabId" is on every request.

                      Now, concerning the server actions, your stack trace indicates that the server action request is routed to your custom servlet "MyFacesDiagrammerServletSupport", which should be a subclass of "IlvFacesDiagrammerServletSupport". I am not sure what it does, but a custom servlet support is really needed :-)

                      Back to the sample, the "diagrammerView" declaration in "browserTab04.jsp" specifies a custom servlet for the Diagrammer component, and this is probably what you already have:

                      
                      <jvdf:diagrammerView id=
                      "diagrammer" style=
                      "width:600;height:350" : servlet=
                      "demo.servlet.DiagrammerServlet" :
                      


                      Looking at the "DiagrammerServlet" implementation, it just defines an inline servlet support that overrides the "getSDMView()" method as follows:

                      1. Use the static method "DiagrammerBean.getTabIdentdiferFromRequest()" to extract the "tabId" from the request
                      2. Using the "tabId", it invokes the static method "DiagrammerBean.getTabViewerFromContext(id)" to get the "DiagrammerTabBean"
                      3. From "DiagrammerTabBean", the "IlvSDMView" is returned

                      This will ensure that the whole servlet processing (including the action handler) accesses the right "IlvDiagrammer" for the current tab/page/window. Server actions should work fine since they usually involve manipulating data in the "IlvDiagrammer", but your specific server action may require some extra logic.

                      In any case, you can use the static methods described above if your action needs to store/retrieve context data on the session using the "tabId".

                      I hope this will help you move further...

                      Cheers,
                      eabe
                      • SystemAdmin
                        SystemAdmin
                        2606 Posts
                        ACCEPTED ANSWER

                        Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

                        ‏2010-12-17T17:21:15Z  in response to eabe
                        Thank you very much for your detailed response.

                        It looks like I finally have multiple diagrams per session (that is, the "same" JSF form simultaneously appearing in different tabs/pages/windows of a single session) working.

                        Woohoo! :-)
  • SystemAdmin
    SystemAdmin
    2606 Posts
    ACCEPTED ANSWER

    Re: JSF diagrammer: multiple diagrams in a single session? In a single page?

    ‏2013-01-18T00:42:29Z  in response to SystemAdmin
    I am running into similar issues.

    I am trying to display two diagrams on the same page that are backed by the same bean. The bean is defined as pageFlowScope (ADF). The bean will generate different content based on some parameter. Somehow the page can only show one diagram, but the other is always blank - not generated.

    Is it possible for a single page to show multiple diagrams?

    Here's how I defined the content (the controlling parameter is #{pageFlowScope.workspaceId}):
    <h:panelGrid border="0" columns="1" styleClass="psheet" id="pg2">
    <h:outputText value="#{pageFlowScope.workspaceId}"/>
    <jvtf:networkView id="workspaceOne" context="#{defContext}" width="800" height="180"
    interactorId="select"
    binding="#{pageFlowScope.MyBean.networkView}"
    imageFormat="PNG" resizable="true"
    servlet="MyServlet"
    waitingImage="images/waiting.gif">
    </jvtf:networkView>
    </h:panelGrid>
    <h:panelGrid border="0" columns="1" styleClass="psheet" id="pg3">
    <h:outputText value="#{pageFlowScope.workspaceId}"/>
    <jvtf:networkView id="workspaceTwo" context="#{defContext}" width="800" height="180"
    interactorId="select"
    binding="#{pageFlowScope.MyBean.networkView}"
    imageFormat="PNG" resizable="true"
    servlet="MyServlet"
    waitingImage="images/waiting.gif">
    </jvtf:networkView>
    </h:panelGrid>