After trying to create a small sample (I should did that before
posting), I found that the problem occurs when you call RootPanel.get
(“div1”)… and then RootPanel.get(“div2”)
Where div2 is an element that is inside div1.
So the sample will be:
Test1Module.java
package client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.*;
public class Test1Module implements EntryPoint
{
public void onModuleLoad()
{
RootPanel.get("div1").addStyleName("asdasd");
RootPanel.get("div2").addStyleName("asdasd");
}
}
Test1Module.html
<html>
<head>
<title>Test1Module Application</title>
<meta name="gwt:module" content="Test1Module">
<link rel="stylesheet" href="Test1Module.css">
</head>
<body>
<script language="javascript" src="Test1Module.nocache.js"></
script>
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:
0"></iframe>
<h1>Test1Module Application</h1>
<div id="div1">
<div id="div2">
</div>
</div>
</body>
</html>
The full Error msg:
[ERROR] Unable to load module entry point class client.Test1Module
(see associated exception for details)
java.lang.AssertionError: A widget that has an existing parent widget
may not be added to the detach list
at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose
(RootPanel.java:122)
at com.google.gwt.user.client.ui.RootPanel.get(RootPanel.java:197)
at client.Test1Module.onModuleLoad(Test1Module.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:326)
at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace
(BrowserWidget.java:345)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300
(BrowserWidgetIE6.java:37)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad
(BrowserWidgetIE6.java:77)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke
(BrowserWidgetIE6.java:161)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
(IDispatchImpl.java:194)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.method6
(BrowserWidgetIE6.java:42)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6
(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents
(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop
(HostedModeBase.java:556)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:403)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:
90)
I only tested it on IE7 using the HostedMode browser.
Thanks
On Mar 9, 12:36 pm, Joel Webber 𐑯(ټ)𐑥 <[email protected]> wrote:
> I did make some changes to RootPanell.get(id) recently, but I can't seem to
> reproduce the case you're describing. It also looks like the exception stack
> you posted may have been cut off. Could you post the full exception trace?
> Also, if you can post a code snippet that reproduces the problem, it would
> be very helpful. I just tried the following, which worked fine:
> In Hello.html:
>
> <div id='foo'></div>
>
> In Hello.java:
>
> RootPanel.get("foo").add(new Button("foo"));
>
> RootPanel.get("foo").add(new Button("bar"));
>
> It's not inconceivable that I inadvertently broke something that we weren't
> properly testing for, so your help in tracking this down would be greatly
> appreciated.
>
> Cheers,
> joel.
>
>
>
> On Sat, Mar 7, 2009 at 11:13 AM, aris <[email protected]> wrote:
>
> > Recompiling a project using the build #4955 from SVN throws a lot of
> > errors, every time I use the RootPanel.get(“id_element”)… I get the
> > next exception:
>
> > at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose
> > (RootPanel.java:122)
> > at com.google.gwt.user.client.ui.RootPanel.get(RootPanel.java:197)
>
> > The first time it happens is inside the onModuleLoad(), I get an
> > existing element inside the .html file using RootPanel.get(“flash1”)
> > and that throws the exception
> > (I checked that the id="flash" element really exists)
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---