Announcement

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

    Portlet Move Behavior

    I am using portlets display some content with an HTMLFlow object. The HTMLFlow object loads a page and sets some content dynamically. Additionally it instantiates a browser plugin.

    I have three columns in my PortalLayout that are available for users to move portles around in. And I noticed that when a portlet "jumps" from one column to another it basically reloads the HTMLFlow object, effectively killing the state of it when it does so. For example, the plugin goes back to its original state and the form fields contain the hard coded values again. Additionally the plugin crashes (which I believe is an issue for the vendor to look in to).

    Is this a portlet concern, or something to do with the HTMLFlow? Is there a way that I can set the portlet or HTMLflow to not reload when moved across column boundaries?

    Code:
    portalLayout = new PortalLayout(3);
    .....
    
    IButton ibNew = new IButton("Add Viewer");
            ibNew.addClickHandler(new ClickHandler()
            {
                @Override
                public void onClick(ClickEvent clickEvent)
                {
                    /*VideoEntryForm videoEntryForm = new VideoEntryForm(EditAction.ADD);
                    videoEntryForm.show();
                    videoEntryForm.centerInPage();*/
                    idx ++;
                    PlayerPlugin playerPlugin = new PlayerPlugin(idx);
                    Portlet playerPortlet = new Portlet();
                    playerPortlet.setTitle("Stream: " + idx);
                    playerPortlet.addItem(playerPlugin);
                    portalLayout.addPortlet(playerPortlet);
                }
            });
    
    
    for(idx = 1; idx <= 1; idx++)
            {
                Portlet portlet = new Portlet();
                portlet.setTitle("Stream: " + idx);
                PlayerPlugin htmlFlow = new PlayerPlugin(idx);
                portlet.addItem(htmlFlow);
                portlet.setCanDragResize(true);
                portalLayout.addPortlet(portlet);
            }
    Thanks

    #2
    When the HTMLFlow is moved to a new container it is clear()d then draw()n again, meaning the DOM elements are re-created. If this will cause the plugin to drop state, you could:

    1) restore the state by tracking every time it changes, and applying the state via the DrawHandler on the HTMLFlow

    2) (trickier) reach into the DOM and unlink the DOM elements for the plugin, the re-link then after draw into the new HTML. Don't do this unless you have to, as this kind of thing causes browser crashes with some plugins.

    Comment


      #3
      Unfortunately this approach will not work due to the plugin. Usability suffers greatly from reinstantiating the plugin and trying to reason out how to restore its state.

      Do you have a recommendation on how to achieve this with another tool in the SmartGWT toolset?

      Specifically the attributes of the portlet setup that worked extremely well for this use-case was the sizing and arrangement.

      Thanks again,

      Comment


        #4
        These are the two natively possible approaches, so if you don't feel up to #2 (understandable) you could have our consulting team do it for you.

        Comment


          #5
          I faced similar kind of issue, I've got it fixed using the below custom implementation. I hope you also get it fixed using the same.

          Code:
          class CustomHTMLPane extends HTMLPane
              {
                  protected native void onInit()/*-{
                      this.@CustomHTMLPane::onInitialize()();
                      
                      // Handle redraw case
                      var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
                      self.redraw = function() {
                      }
                      
                  }-*/;
                  
                  protected void onInitialize()
                  {
                      super.onInit();
                  }
              }

          Comment

          Working...
          X