PDA

View Full Version : [FIXED] Beta4 - Show method on Dialog object throws exception



drunningw
5 Jun 2008, 7:53 AM
Hello,

In the process of upgrading from beta3 to beta4, I ran into a bug when the show method is called on the Dialog class. To verify with a simple case, I created a new GWT module and tried to replicate the bug using only the Dialog example from the Ext GWT Explorer examples. I successfully replicated the bug. See the sample code below.

The show method of the simple Dialog object is called when the "Simple" button's SelectionListener componentSelected method is called. When the show method is called the following exception is thrown:

[ERROR] Uncaught exception escaped
java.lang.AssertionError: Method must be called before the component is rendered
at com.extjs.gxt.ui.client.widget.Component.assertPreRender(Component.java:1063)
at com.extjs.gxt.ui.client.widget.ContentPanel.setFooter(ContentPanel.java:541)
at com.extjs.gxt.ui.client.widget.ContentPanel.onRender(ContentPanel.java:766)
at com.extjs.gxt.ui.client.widget.Window.onRender(Window.java:764)
at com.extjs.gxt.ui.client.widget.Dialog.onRender(Dialog.java:218)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:736)
at com.extjs.gxt.ui.client.widget.Component.onAttach(Component.java:1131)
at com.extjs.gxt.ui.client.widget.Container.onAttach(Container.java:307)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:231)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:119)

Any ideas on how to fix this? It is a show stopper for our upgrade since we do utilize the Dialog Class quite a bit.


Thanks,
-Danny

Sample Code:

public class Play extends LayoutContainer implements EntryPoint {

public void onModuleLoad() {
RootPanel.get().add(this);
}

@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
final Dialog simple = new Dialog();
simple.setHeading("Dialog Test");
simple.setButtons(Dialog.YESNO);
simple.addText("some stuff");
simple.setScrollMode(Scroll.AUTO);
simple.setHideOnButtonClick(true);

final Dialog complex = new Dialog();
complex.setBodyBorder(false);
complex.setInsetBorder(false);
complex.setButtons(Dialog.OK);
complex.setIconStyle("icon-app-side");
complex.setHeading("BorderLayout Dialog");
complex.setWidth(400);
complex.setHeight(225);
complex.setHideOnButtonClick(true);

BorderLayout layout = new BorderLayout();
complex.setLayout(layout);

// west
ContentPanel panel = new ContentPanel();
panel.setHeading("West");
BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 150, 100, 250);
data.setMargins(new Margins(0, 5, 0, 0));
data.setSplit(true);
data.setCollapsible(true);
data.setFloatable(true);
panel.setData(data);
complex.add(panel);

// center
panel = new ContentPanel();
panel.setHeading("West");
data = new BorderLayoutData(LayoutRegion.CENTER);
panel.setData(data);
complex.add(panel);

ButtonBar buttons = new ButtonBar();

buttons.add(new Button("Simple", new SelectionListener() {
public void componentSelected(ComponentEvent ce) {
simple.show();
}
}));

buttons.add(new Button("Layout", new SelectionListener() {
public void componentSelected(ComponentEvent ce) {
complex.show();
}
}));

add(buttons);
setLayout(new FlowLayout(4));
layout();
}

}

darrellmeyer
5 Jun 2008, 8:23 AM
See this post http://extjs.com/forum/showthread.php?t=37631