GWT Designer isDesignTime Not Working?

43 views
Skip to first unread message

davekor

unread,
Jul 24, 2011, 11:22:55 PM7/24/11
to Google Web Toolkit
Hi guys,

I have a custom widget which throws a NullPointerException when I
attempt to add it to a layout panel with GWT Designer. After some
digging, I realized its because my custom widget has some code that
tries to contact my server and this code should not be executed when
instantiated by GWT Designer. So I wrapped the code within an
isDesignTime check as described at this webpage:

http://code.google.com/webtoolkit/tools/gwtdesigner/features/gwt/enhanced_compilation.html

However, the code in question still gets executed when I add the
custom widget to a layout panel in the designer. What am I doing
wrong?

Eric Clayberg

unread,
Jul 25, 2011, 11:16:32 AM7/25/11
to google-we...@googlegroups.com
Unfortunately, that option no longer works in GWT 2.2 and above, so we are replacing it with an implementation of Beans.isDesignTime() in GWT 2.4.

The two options would be to use GWT 2.4 and Beans.isDesignTime() or a null check to prevent the NPE.

Dave Kor

unread,
Jul 25, 2011, 2:16:09 PM7/25/11
to google-we...@googlegroups.com
Thanks for the reply! I guess I'll make do for now with a temporary fix. The documentation should really be updated, I wasted half a day trying to figure out what I was wrong with my code. .

On Mon, Jul 25, 2011 at 11:16 PM, Eric Clayberg <clay...@google.com> wrote:
Unfortunately, that option no longer works in GWT 2.2 and above, so we are replacing it with an implementation of Beans.isDesignTime() in GWT 2.4.

The two options would be to use GWT 2.4 and Beans.isDesignTime() or a null check to prevent the NPE.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/IDSJ-rNbSBgJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Regards,
Dave Kor

Micah Caldwell

unread,
Aug 8, 2011, 11:35:28 AM8/8/11
to google-we...@googlegroups.com
I agree with Davekor that this should be added to the documentation.  Unlike him, I don't seem to learn as quickly and spent a day and a half on this bug before I finally managed to dig this post up.  To make matters worse, this problem appears to exist in the included examples.  I grabbed the gaerequest code from the expenses example and the included LoginWidget references a member variable (requests) and throws a NullPointerException with this error:
org.mvel2.PropertyAccessException: RootLayoutPanel.get().add(widget): null

Adding if (requests == null) return; fixes it, though I am not particularly happy with this since it will cause me much grief if at some point requests ends up being null at runtime.
Reply all
Reply to author
Forward
0 new messages