googelybear
10 Sep 2009, 1:36 AM
Hi,
today I made a very nasty discovery: It seems to be impossible to remove a com.extjs.gxt.ui.client.widget.Composite from a RootPanel with RootPanel.clear().
What you get is this nice stacktrace:
2009-09-10 11:22:25,767 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException:
(TypeError): this.removeChild is not a function
fileName: jar:file:/opt/gwt-linux-1.7.0/gwt-user.jar!/com/google/gwt/dom/client/Node.java
lineNumber: 202
stack: ([object HTMLDivElement])@jar:file:/opt/gwt-linux-1.7.0/gwt-user.jar!/com/google/gwt/dom/client/Node.java:202
static void com.google.gwt.user.client.DOM.dispatchEvent(com.google.gwt.user.client.Event,com.google.gwt.user.client.Element,com.google.gwt.user.client.EventListener)([object Event],[object HTMLDivElement],[object gwt_nativewrapper_class])@:0
([object Event])@jar:file:/opt/gwt-linux-1.7.0/gwt-user.jar!/com/google/gwt/user/client/impl/DOMImplStandard.java:177
@:0
at com.google.gwt.dom.client.Node$.removeChild$(Native Method)
at com.google.gwt.user.client.DOM.removeChild(DOM.java:992)
at com.google.gwt.user.client.ui.ComplexPanel.remove(ComplexPanel.java:61)
at com.google.gwt.user.client.ui.AbsolutePanel.remove(AbsolutePanel.java:136)
at com.google.gwt.user.client.ui.WidgetCollection$WidgetIterator.remove(WidgetCollection.java:55)
at com.google.gwt.user.client.ui.Panel.clear(Panel.java:74)Debbugging this showed that the DOM implementation cannot find the parent of the composite (in this case the rootPanel) anymore: DOM.getParent(composite) returns null.
If I change the Composite into a LayoutContainer this works.
To reproduce try it with the following code:
public class CompositeCrasher extends com.extjs.gxt.ui.client.widget.Composite {
VerticalPanel panel;
public CompositeCrasher() {
panel = new VerticalPanel();
panel.setSize(300, 300);
panel.add(new Html("I crash"));
initComponent(panel);
}
}
public class Crasher implements EntryPoint {
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();
rootPanel.add(new CompositeCrasher());
rootPanel.clear();
}
}Is this a bug in gxt?
today I made a very nasty discovery: It seems to be impossible to remove a com.extjs.gxt.ui.client.widget.Composite from a RootPanel with RootPanel.clear().
What you get is this nice stacktrace:
2009-09-10 11:22:25,767 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException:
(TypeError): this.removeChild is not a function
fileName: jar:file:/opt/gwt-linux-1.7.0/gwt-user.jar!/com/google/gwt/dom/client/Node.java
lineNumber: 202
stack: ([object HTMLDivElement])@jar:file:/opt/gwt-linux-1.7.0/gwt-user.jar!/com/google/gwt/dom/client/Node.java:202
static void com.google.gwt.user.client.DOM.dispatchEvent(com.google.gwt.user.client.Event,com.google.gwt.user.client.Element,com.google.gwt.user.client.EventListener)([object Event],[object HTMLDivElement],[object gwt_nativewrapper_class])@:0
([object Event])@jar:file:/opt/gwt-linux-1.7.0/gwt-user.jar!/com/google/gwt/user/client/impl/DOMImplStandard.java:177
@:0
at com.google.gwt.dom.client.Node$.removeChild$(Native Method)
at com.google.gwt.user.client.DOM.removeChild(DOM.java:992)
at com.google.gwt.user.client.ui.ComplexPanel.remove(ComplexPanel.java:61)
at com.google.gwt.user.client.ui.AbsolutePanel.remove(AbsolutePanel.java:136)
at com.google.gwt.user.client.ui.WidgetCollection$WidgetIterator.remove(WidgetCollection.java:55)
at com.google.gwt.user.client.ui.Panel.clear(Panel.java:74)Debbugging this showed that the DOM implementation cannot find the parent of the composite (in this case the rootPanel) anymore: DOM.getParent(composite) returns null.
If I change the Composite into a LayoutContainer this works.
To reproduce try it with the following code:
public class CompositeCrasher extends com.extjs.gxt.ui.client.widget.Composite {
VerticalPanel panel;
public CompositeCrasher() {
panel = new VerticalPanel();
panel.setSize(300, 300);
panel.add(new Html("I crash"));
initComponent(panel);
}
}
public class Crasher implements EntryPoint {
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();
rootPanel.add(new CompositeCrasher());
rootPanel.clear();
}
}Is this a bug in gxt?