Announcement

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

    Smart GWT hiding GWT widget

    Hey,

    I am pretty lost trying to find good examples of smartGwt. Can anyone help me figure out whats wrong with this code. This is normal GWT code that works (in onModuleLoad())
    Code:
            VerticalPanel main = new VerticalPanel();;
            main.setSize("100%","100%");
            HTMLPanel htmlPanel = new HTMLPanel("<div id=\"vpChart1\" align=\"center\">WHERE AM I?</div>");
            htmlPanel.setWidth("800");
            htmlPanel.setHeight("800");
            main.add(htmlPanel);
            RootPanel.get().add(main);
    This smart GWT seems to hide my HTMLPanel:
    Code:
     HLayout main = new HLayout();
            main.setSize("100%","100%");
            HTMLPanel htmlPanel = new HTMLPanel("<div id=\"vpChart1\" align=\"center\">WHERE AM I?</div>");
            htmlPanel.setWidth("800");
            htmlPanel.setHeight("800");
            main.addMember(htmlPanel);
            RootPanel.get().add(main);
    Anyone any idea's???
    Thanks,
    John

    #2
    maybe something related to z-indexes. I have prety much the same kind of issues

    Comment


      #3
      I'll look into it but you could use SmartGWT's HTMLFlow calling htmlFlow.setContents(<html>).

      Sanjiv

      Comment


        #4
        Thanks for the replies. HtmlPane worked fine. Thanks!

        Comment


          #5
          Hi, I have a similar behaviour too.

          I have a vanilla DecoratedTabPanel and in a tab, I want to add a ListGrid.

          Doing this results in a screen only displaying the ListGrid, that is too small btw, in the upper left corner of the screen, the rest of the screen being gray.

          I saw the "GWT integration" item the showcase that demonstrate embedding a gwt component in a smartgwt component.
          I'm wondering if the contrary is possible ? and or means extra code ?

          I'm new to both gwt and smartgwt, this has a cold shower effect on my high expectations, based on the impressive showcase.

          I'll look at HTMLFLow but my point is that I want my app to be mostly GWT based and not SmartGWT-based (it's all about the what-contains-what and the corresponding dependency)

          I'm using v1.0b1 with GWT 1.5.3
          The ListGrid is in an HorizontalPanel contained in a VerticalPanel (used in the DecoratedTabPanel).

          Thanks.

          Jerome
          Last edited by jbat; 13 Feb 2009, 06:38.

          Comment


            #6
            See this post for general expectations on interoperability and this post (and surrounding thread) for details on how to get SmartGWT widgets to fill space inside GWT widgets and why a special approach is necessary.

            Comment


              #7
              Thanks

              @Administrator:
              Thanks for pointing those clear and honest answers.

              Hope the GWT team will provide the necessary hooks in a near future.
              Maybe, all SGWT users should vote somewhere for this as a gwt new feature.

              FTM, I'll have to find a way to get screen height/width and then compute+resize. Hate to have to mix some JS in the source.
              But, first, I must succeed to get all the components displayed.

              Comment


                #8
                new issue

                Hi, I submitted a new issue to the GWT team

                http://code.google.com/p/google-web-toolkit/issues/detail?id=3366

                HIH

                Comment


                  #9
                  @jbat: it won't require JS, just some Java sizing code attached to the page level resize event handler. You might ask some of the posters in those other threads for samples of working code.

                  Comment


                    #10
                    EDIT: I think the problem was that I was calling .draw() _and_ RootPanel.get().add(). If I do one or the other, GWT controls interact fine.

                    I'm not sure why, but I had a problem displaying GWT on some tabs inside and HLayout.

                    In the entry point, I added the hlayout the standard way:
                    Code:
                    RootPanel.get().add()
                    I took the example from the showcase, which works, and through trial and error when moving my code to the showcase example, I found that if I remove the RootPanel.get().add() from the entry point everything started working fine.

                    I'm not sure exactly how the smartGWT gets added to the root panel in .draw(), or how it's different from RootPanel.get().add(), but it is working for me now.

                    (This is all hosted mode.)

                    I'm wondering what exactly is going on, and whether the way I got it to work is the correct way to do it.
                    Last edited by ml; 22 Sep 2009, 06:44.

                    Comment


                      #11
                      The preferred why to render SmartGWT components is to call draw() on the outtermost Canvas / widget after all the other configuration / child widgets are added. This is most efficient as all the widget creation and attaching to DOM occurs lazily and will result in the most consistent rendering.

                      RootPanel.get().add() causes the SmartGWT components to be rendered so you should never call draw() and RootPanel.get().add(). Where possible, use component.draw().

                      Comment


                        #12
                        It's probably a bit late to answer, but my understanding is that when you call .draw() all the window is cleared and replaced by the component upon which .draw() method is called.
                        If you call RootPanel.get("some-id").add(someWidget) then the widget is added to the HTML document (embedded in the tag identified by the id provided). But if you call the RootPanel.get().add(someWidget) then a new div is created at the end of your HTML document and your widget is added there.
                        Please correct me if I'm wrong.

                        Comment

                        Working...
                        X