Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Plugins Die When New Windows are Added

    SGWT Version 3.
    Firefox 7
    IE 8
    Chrome

    I have an application in which I use an HTMLFlow to expose a Flash chart nested within a Window object that is placed within a Tab. In this same application I also make use of a custom browser plugin developed with FireBreath. This plugin sits inside of an HTMLPane which sits in a Window which sits in a Tab as well.

    Both plugins die when a new window or tab is placed on the screen very similar to the problem that is described in this post: http://forums.smartclient.com/showthread.php?t=21257.

    Is there a way to prevent a redraw of the container and its plugin contents so that launching new Windows does not affect the user interface this way?

    #2
    Most likely, you are using colliding DOM IDs for the <object> tag, or colliding names for global JavaScript variables used in logic surrounding the plugin.

    Note that creating a new HTMLFlow would not cause a redraw of other HTMLFlows, but if you think this problem is somehow related to redraw, you can turn on the "redraws" log in the Developer Console. See also canvas.redrawOnResize.

    Comment


      #3
      In the case of the Flash plugin, there is one and only one active at any given time. This behavior is demonstrated even when no other plugins are present. The behavior is not isolated to adding other html flows. Any window that is added to the user interface causes the reload. Additionally, every object tag is given a dynamic name based on an id given to the plugin.

      Code:
      /**
           * constructor that takes a width and height and a player to create and size a new instance
           * @param inPlayerId
           * @param pluginWidth
           * @param pluginHeight
           */
          public PlayerPlugin(String inPlayerId,int pluginWidth, int pluginHeight)
          {
              super();
              playerId = inPlayerId;
      
              addResizedHandler(new ResizedHandler()
              {
                  @Override
                  public void onResized(ResizedEvent resizedEvent)
                  {
                      onResize(resizedEvent);
                  }
              });
      
              mainStack = new SectionStack();
              mainStack.setWidth100();
              mainStack.setHeight100();
      
              pluginLayout = new VLayout();
              pluginLayout.setWidth100();
              pluginLayout.setHeight100();
      
              playerHtml = new HTMLPane();
              playerHtml.setScrollbarSize(0);
              playerHtml.setWidth100();
              playerHtml.setHeight("95%");
              playerHtml.setContents("<object id=\"" + playerId + "\" type=\"application/x-gsviewer\" height=\"" + pluginHeight + "\" width=\"" + pluginWidth + "\">\n" +
                                             "            <param name=\"license\" value=\"c:/tmp/tungsten.lic\"/>\n" +
                                             "            <param name=\"buffers\" value=\"c:/tmp/buffers\"/>\n" +
                                             "            <param name=\"logging\" value=\"false\"/>\n" +
                                             "            <param name=\"rendermode\" value=\"directx\"/>\n" +
                                             "            <param name=\"onload\" value=\"pluginLoaded\"/>\n" +
                                             "</object>");
              playerHtml.setContentsType(ContentsType.FRAGMENT);
              pluginLayout.addMember(playerHtml);
      Last edited by ls3674; 30 Mar 2012, 10:35.

      Comment


        #4
        So back to the previous message - are you seeing a redraw? Have you tried setting redrawOnResize to false?

        Comment


          #5
          I checked the developer console. I can see the redraw()s entry on the "Results" tab. When I launch the window that contains the plugin, I see 29 redraws. When I launch a new, different window, I see a redraw count of 73. Is there more information provided about what is being redrawn?

          Additionally, I set the redrawOnResize(false) on the HTMLFlow object, and the result is still the same. I made an assumption that that is the component that you meant when you gave those instructions. Should that property be set on something else instead?

          Thanks,

          Comment


            #6
            You need to enable the "redraws" log category using the Logging Preferences menu. This will cause every redraw to be reported in the logs, so you can see whether that specific component (or some parent) is redrawing.

            You've got an unusually large number of redraws - this could be due to explicit redraw() calls in your code (usually this is not needed), or it could be due to autosizing problems where you aren't providing fixed sizes often enough and unnecessary resizes are taking place.

            Note also the "redrawTrace" log category, which can get you more information if you don't understand why a redraw is occurring.

            Comment


              #7
              Awesome advice. Taking a look at that log showed that the main application page itself was redrawing. I imagine this would cause every child it instantiated to redraw as well.

              A markForRedraw() was declared in code that added other modules to the Canvas.

              The redraw number went down drastically as well.

              Does that sound like the culprit to you as well?

              Thanks!

              Comment


                #8
                Yes, that definitely explains the large redraws numbers - did it solve the plugin issue? If not, you might have another, similar piece of code that isn't redrawing the whole screen but may be, say, redrawing an entire portlet. The same analysis technique should help to find it if so.

                Comment


                  #9
                  It absolutely solved that problem.

                  Thanks,

                  Comment

                  Working...
                  X