My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 1121: Regression: -- add(widget) in onLoad() throws IllegalStateException
4 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  jgw+personal@google.com
Closed:  Aug 2007
Type-Defect
Priority-High
Category-UI
Milestone-1_4_RC2


Sign in to add a comment
 
Reported by fredsa, May 30, 2007
Found in GWT Release:
1.4.10RC

Detailed description:
The following code works in 1.3.3, but throws an exception in 1.4.10 RC.

    public class Test implements EntryPoint {

      class TestPanel extends SimplePanel {

        protected void onLoad() {
          super.onLoad();
          add(new Label("label"));
        }
      }

      public void onModuleLoad() {
        RootPanel.get().add(new TestPanel()); //exception
      }
    }


The stack trace is:

    [ERROR] Unable to load module entry point class
com.allen_sauer.gwt.test.client.Test (see associated exception for details)
    java.lang.IllegalStateException: Should only call onAttach when the
widget is detached from the browser's document
        at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:89)
        at com.google.gwt.user.client.ui.Panel.onAttach (Panel.java:86)
        at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:216)
        at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:59)
        at
com.google.gwt.user.client.ui.ComplexPanel.insert(ComplexPanel.java:107)
        at com.google.gwt.user.client.ui.ComplexPanel.add
(ComplexPanel.java:70)
        at
com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:68)
        at com.allen_sauer.gwt.test.client.Test.onModuleLoad(Test.java:22)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)


Workaround if you have one:


Links to the relevant GWT Developer Forum posts:
http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/c51e7201ece461f3

Comment 1 by sandymac, May 30, 2007
This is another example of the inherit flaw in the onLoad() method. See comment 5 of
 issue 896  for another example:
http://code.google.com/p/google-web-toolkit/issues/detail?id=896#c5

More discussion of this at:
http://groups.google.com/group/Google-Web-Toolkit-Contributors/msg/5e89e9081a034598
Comment 2 by gwt.team.morrildl, Jun 06, 2007
There may not be much we can do for this before 1.4, but we can at least think about
it. :)
Labels: -Priority-Medium Priority-High Category-UI Milestone-1_4_RC2
Comment 3 by gwt.team.jgw, Jun 06, 2007
(No comment was entered for this change.)
Owner: gwt.team.jgw
Comment 4 by gwt.team.jgw, Jun 12, 2007
(No comment was entered for this change.)
Status: Accepted
Comment 5 by gwt.team.jgw, Jun 27, 2007
(No comment was entered for this change.)
Status: Started
Comment 6 by gwt.team.jgw, Jul 10, 2007
Committed fix as r1229.
Comment 7 by gwt.team.jgw, Jul 10, 2007
(No comment was entered for this change.)
Status: FixedNotReleased
Comment 8 by gwt.team.scottb, Aug 03, 2007
Committed a general overhaul as r1288.  See this discussion thread:

http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/1e90fa326df6dad/
Comment 9 by gwt.team.scottb, Aug 20, 2007
1.4 RC2 now released.
Status: Fixed
Comment 10 by sumitcha...@google.com, Apr 28, 2008
 
Owner: jgw
Sign in to add a comment