On Sep 11, 10:37 am, Thomas Broyer <[email protected]> wrote:
> On 11 sep, 16:12, davis <[email protected]> wrote:
>
> > Thanks Ian -- was banging my head against the wall, and this narrowed
> > it down.
>
> > How are people typically debugging the java GWT client code -- since
> > you can't breakpoint it -- I assume the only way is to compile it down
> > with pretty printing and use something like firebug?
>
> Are you implying you do not use the hosted mode ?! (or that in hosted
> mode you didn't have an exception prior to the NPE?)

I was using hosted mode -- but hosted mode would just show me an
unexpected view when it loaded, without any errors/exceptions, and I
had no indication why, which is why I compiled for the browser to
inspect further.  Debug did not used to work for me in eclipse for
client code, but after upgrading to the latest eclipse/plugin pair, it
is working, so perhaps I had a bogus setup before.

>
> > I separate the logic as much as possible with MVP and write straight
> > JUnit tests for presenter classes, but this isn't a silver bullet
> > against all possible pitfalls.
>
> > The problem was code that stores references to RootPanel div wrappers,
> > and later it tried to add these to VerticalPanel.  You obviously can't
> > add RootPanel to other panels.
>
> Why? They're finally just (special) AbsolutePanels...
>
> Actually, RootPanel.get(...) would be almost equivalent to a
> hypothetic AbsolutePanel.wrap(...), with the added benefit that
> RootPanels are cached (calling RootPanel.get(...) twice with the same
> ID gives you the very same RootPanel instance, provided the element
> returned by Document.get();getElementById(...) is the same)
>
> > This was a simple typo mistake, and
> > once corrected, the problem went away.  The bummer in all this is that
> > I didn't get any warning or error or exception, it just generated
> > javascript without my div elements.
>
> RootPanel.get(...) only returns 'null' when Document.get
> ().getElementById(...) itself returns null; which in your case would
> mean that you moved the RootPanel to a VerticalPanel that isn't (yet)
> attached to the DOM when you call RootPanel.get(...) for the second
> time.

Thanks, this totally makes sense now.

>
> This is obviously an error in your code that GWT can't really do
> anything against (provided moving RootPanels around is a supported use
> case).
>
> I'd suggest you open an issue about the fact that RootPanel shouldn't
> be allowed to be added to other widgets (would be trivial: override
> setParent() in RootPanel and throw an exception) and see what
> happens...

Ok, will do.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to