Export to GitHub

google-web-toolkit - issue #5156

IE8 only shows center panel of DockLayoutPanel


Posted on Jul 24, 2010 by Grumpy Lion

Found in GWT Release (e.g. 1.5.3, 1.6 RC): 2.0.4

Encountered on OS / Browser (e.g. WinXP, IE6-7, FF3): WinXP, IE8

Detailed description (please be as specific as possible): Only center panel of DockLayoutPanel is displayed in this context: I have a "Welcome Screen" which is made by hand from the entry point. On the other side, I have Widget named Main which uses the Singleton pattern: this Widget encapsulates the application funcionality and there should be only one instance in the application. This Widget is a composite over a DockLayoutPanel, which has north, west and center panels. The unit used to define the size of these panels is EM.

Shortest code snippet which demonstrates issue (please indicate where actual result differs from expected result): //BugTest.java package com.bugtest.clearadd.client;

import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.user.client.ui.RootPanel;

public class BugTest implements EntryPoint {

@Override
public void onModuleLoad() {
    Button prefetchButton = new Button("Prefetch!");
    prefetchButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            //Invoke the function but do nothing (prefetch).
            Main.getInstance();

            PopupPanel popupPanel = new PopupPanel(true);
            popupPanel.setWidget(new Label("Prefetching finished!"));
            popupPanel.center();
        }
    });

    Button switchButton = new Button("Switch!");
    switchButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            //Here I use the result of the function
            Main result = Main.getInstance();
            RootPanel.get().clear();
            RootLayoutPanel.get().add(result);
            //If this gets executed before the Prefecth
            //button is clicked, everything is fine.
            //If the Prefetch button is clicked before this,
            //only the center panel is showed.
        }
    });

    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(new Label("Bug test!"));
    flowPanel.add(prefetchButton);
    flowPanel.add(switchButton);

    RootPanel.get().add(flowPanel);
}

}

//Main.java package com.bugtest.clearadd.client;

import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.ui.DockLayoutPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.ResizeComposite;

public class Main extends ResizeComposite {

private static Main instance = null;

public static Main getInstance() {
    if (instance == null) {
        instance = new Main();
    }
    return instance;
}

private Main() {
    DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.EM);
    dockLayoutPanel.addNorth(new Label("North!"), 7);
    dockLayoutPanel.addWest(new Label("West!"), 15);
    dockLayoutPanel.add(new Label("Center! :D"));
    initWidget(dockLayoutPanel);
}

}

Workaround if you have one: Use PX instead of EM for DockLayoutPanel sizes.

Links to relevant GWT Developer Forum posts:

Comment #1

Posted on Jul 30, 2010 by Grumpy Hippo

I've got the same problem. I noticed that this only happens when switching the contents of the RootLayoutPanel.

We have 2 widgets to display (exclusively) in the RootLayoutPanel: one is a HTMLPanel and the other a DockLayoutPanel.

When displaying the HTMLPanel and then switching to the DockLayoutPanel, we get the broken display with only the part visible. Looking at the DOM, we can see that height is set to 0px on the div.

When displaying the DockLayoutPanel first, it renders correctly.

We tried adding calls to forceLayout() but it doesn't help. We only get this behaviour in IE7 and IE8.

Our switching code:

// New Widget is either an instance of HTMLPanel or DockLayoutPanel private void reveal(Widget newWidget) { if(currentWidget != null) { RootLayoutPanel.get().remove(currentWidget); } currentWidget = newWidget; RootLayoutPanel.get().add(currentWidget); }

Comment #2

Posted on Aug 2, 2010 by Grumpy Hippo

Attached is the simplest expression of the issue we're having with the DockLayoutPanel on IE8.

It's a simple EntryPoint that creates 2 panels a Dock and an HTMLPanel. Switching, from the HTMLPanel to the Dock will reproduce the issue: only the center portion of the DockLayoutPanel is visible.

Attachments

Comment #3

Posted on Aug 2, 2010 by Grumpy Lion

I've tried your example, and changing from EM to PX seems to work there too. The problem must be related with that.

Comment #4

Posted on Aug 3, 2010 by Grumpy Hippo

Yep. So what we know is: * units need to be EM * happens when a DockLayoutPanel is added to LayoutPanel dynamically (calling remove/clear, then add)

Comment #5

Posted on Mar 25, 2011 by Grumpy Lion

Comment deleted

Comment #6

Posted on Mar 25, 2011 by Quick Elephant

I still have the problem with version 2.2. I simply use DockPanel with @SuppressWarnings("deprecation").

Comment #7

Posted on Aug 30, 2011 by Quick Wombat

Same issue still on ie8 GWT 2.3. Works on Compatibilty Mode(ie7)

Comment #8

Posted on Jun 3, 2013 by Massive Cat

(No comment was entered for this change.)

Status: AssumedStale