Announcement

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

    setting overflow visible is throwing parentNode null error

    smartgwt 4.1 ... latest nightly build 6/3/14

    browser : IE, FF and chrome

    Setting setOverflow(Overflow.VISIBLE) is throwing a parentNode null error. Changing it to auto - setOverflow(Overflow.AUTO), does not throw the error. I am using overflow visible at a lot of other places but only this one place is throwing that error so not sure what exactly is causing this issue.

    It used to work fine with smartgwt 3.1. I recently upgraded to 4.1 and am seeing the error as below.

    18:15:35.122:WARN:Log:element parentNode null

    com.smartgwt.client.core.JsObject$SGWT_WARN: 18:15:35.122:WARN:Log:element parentNode null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.widgets.BaseWidget.setProperty(BaseWidget.java)
    at com.smartgwt.client.widgets.BaseWidget.setAttribute(BaseWidget.java:738)
    at com.smartgwt.client.widgets.Canvas.setOverflow(Canvas.java:3272)

    Could you please let me know what is causing this error.

    Thanks

    #2
    See FAQ: you should include a JavaScript stack trace with any JavaScript error, this will give us a chance at identifying the cause.

    Comment


      #3
      I have attached a part of the stack trace in debug level logging. Please let me know if you need any other info.
      Attached Files

      Comment


        #4
        Ah, this isn't actually a JavaScript error, just a warning being logged.

        This is a rare condition we don't know how to re-create - the last time we saw it was Mozilla 1.2. It should be a harmless warning, but if you find a way to reproduce it that you can isolate to a test case, let us know and we can look into whether it could have any side-effects.

        Comment


          #5
          I am trying to isolate it to a test case but no luck yet.

          In my case, I am setting the overflow to a HTMLPane. Due to the error/warning, the HTMLPane keeps loading again and again infinitely. This is a major issue in my application. I am trying to write a standalone test case which can reproduce this issue but if I don't succeed, do I need to downgrade back to 3.1?

          Comment


            #6
            We're not sure why you assume the warning is related to the reloading issue - it doesn't seem connected from what we can see.

            An issue that occurs on an upgrade could be a bug (which we can fix if you can make it reproducible for us) or could be a longstanding usage issue that is revealed by a new version of the framework.

            So keep trying for a test case.

            Comment


              #7
              If I don't set the overflow to visible or if I change it to auto, I don't get that warning any more and htmlpane does not keep reloading.

              The HTMLPane has a Frame added as its child. When the Frame is set to scrolling, the HTMLPane needs to be set to overflow visible and when the Frame is set to not scrolling, the HTMLPane overflow should be set to auto. That is why I need to set the overflow to visible for the pane.

              Comment


                #8
                To clarify, setting overflow:visible will not cause an HTMLPane to auto-size to content loaded *in a frame*, although in some browsers and some modes, it might have looked like some kind of auto-sizing was going on, because browsers can also have issues with clipping content correctly in iframes. This is the kind of possible longstanding usage issue we were referring to.

                As far as getting past your issue without isolating to a test case / possible bug, if setOverflow() isn't working, creating a new HTMLPane each time should work.

                Comment


                  #9
                  Here is the standalone test case which reproduces the issue. Setting overflow on the html pane causes its child frame to reload again and again. I tested the same code in 3.1 (IE, FF and chrome) and the issue did not happen there.

                  Code:
                  import com.google.gwt.core.client.EntryPoint;
                  import com.google.gwt.dom.client.FrameElement;
                  import com.google.gwt.event.dom.client.LoadEvent;
                  import com.google.gwt.event.dom.client.LoadHandler;
                  import com.google.gwt.user.client.ui.NamedFrame;
                  import com.smartgwt.client.types.Overflow;
                  import com.smartgwt.client.widgets.HTMLPane;
                  import com.smartgwt.client.widgets.Label;
                  import com.smartgwt.client.widgets.layout.VLayout;
                  
                  public class OverflowTest implements EntryPoint {
                  
                      private int loadCount = 0;
                      private Label countLabel;
                      private HTMLPane pane;
                      private NamedFrame frame;
                  
                      public void onModuleLoad() {
                  
                          VLayout wrapper = new VLayout();
                          wrapper.setPadding(10);
                          wrapper.setMembersMargin(10);
                          wrapper.setBorder("2px solid green");
                  
                          pane = new HTMLPane();
                          pane.setHeight(500);
                          pane.setWidth(500);
                          pane.setOverflow(Overflow.AUTO);
                          pane.setBorder("2px solid red");
                  
                          frame = new NamedFrame("frame");
                          frame.setUrl("http://www.smartclient.com/");
                          frame.setWidth("100%");
                          frame.setHeight("100%");
                          frame.addLoadHandler(new LoadHandler()
                          {
                              
                              @Override
                              public void onLoad(LoadEvent event)
                              {
                                  loadCount++;
                                  countLabel.setContents("Loaded " + loadCount + " times.");
                                  setOverflowVisible();
                                  setOverflowAuto();                
                              }
                          });
                  
                          countLabel = new Label("Loaded " + loadCount + " times.");
                          countLabel.setWrap(false);
                  
                          wrapper.addMember(countLabel);       
                          pane.addChild(frame);
                          wrapper.addMember(pane);     
                  
                          wrapper.draw();
                      }
                  
                      private void setOverflowVisible()
                      {
                          /*FrameElement frameElement = frame.getElement().cast();        
                          frameElement.setScrolling("auto");
                  
                          pane.redraw();
                          pane.adjustForContent(true);*/
                          pane.setOverflow(Overflow.VISIBLE);
                      }
                  
                      private void setOverflowAuto()
                      {
                          /*FrameElement frameElement = frame.getElement().cast();       
                          frameElement.setScrolling("no");
                          frameElement.setFrameBorder(0);
                          frameElement.setAttribute("border", "0");*/
                  
                          pane.setOverflow(Overflow.AUTO);
                      }
                  }
                  Hope this helps.

                  Thanks

                  Comment


                    #10
                    The problem is that setOverflow() needs to remove the iframe from the DOM and re-add it - this causes the browser to re-load the content (with no known workaround - see this). Since this fires the load event again, your code goes into an infinite reload loop.

                    The best solution is the one we previously proposed - create a new HTMLFlow each time.

                    Comment


                      #11
                      Creating a new HTMLPane each time won't work for me. Any reason why setOverflow did not reload the frame in 3.1 and reloading in 4.1?

                      Comment


                        #12
                        4.x now has to remove the content from the DOM to switch overflow modes, in some browsers and for some mode changes. This is because we were able to reduce the necessary number of DOM elements for most controls in 4.x, but due to a variety of browser bugs, different overflow modes like "visible" require more/different elements than other modes like "auto".

                        There doesn't really seem to be a way that creating an HTMLPane each time could not work - there are so few properties that apply to this class, it's trivial to re-create instead of re-use.

                        Comment


                          #13
                          We extend that class and have our own sub calss. There are a lot of other variables and listeners associated with the sub class. Re-creating it each time won't work for us.

                          Comment


                            #14
                            OK, then the simplest solution is to avoid going into an infinite loop when the iframe reloads - as we mentioned that's happening in your test case because you're toggling the overflow setting back and force every time content loads.

                            Comment


                              #15
                              The test case was written purposely like that to recreate the issue.

                              I will take a look at my code to see if I can avoid that situation from occurring. Thank you for looking into it.

                              Comment

                              Working...
                              X