GWT 1.6 and GXT

53 views
Skip to first unread message

Paul Grenyer

unread,
Apr 11, 2009, 10:21:26 AM4/11/09
to Google-We...@googlegroups.com
Hi All

I'm trying to use GWT with GWT 1.6. I've kind of got it working, but
I'm not sure exactly where the "js" folder (that holds all the Java
script) should go.

Any pointers? This is driving me crazy.

--
Thanks
Paul

Paul Grenyer
e: paul.g...@gmail.com
w: http://www.marauder-consulting.co.uk
b: paulgrenyer.blogspot.com

Vitali Lovich

unread,
Apr 11, 2009, 3:51:13 PM4/11/09
to Google-We...@googlegroups.com
Isn't there a single jar that has it all packaged up?  I don't think you need to worry about any of that.

Paul Grenyer

unread,
Apr 11, 2009, 4:16:20 PM4/11/09
to Google-We...@googlegroups.com
Yeah, there's a jar with the Java stuff in, but I think you still need the Java script at runtime, but I'd love to be wrong. Any pointers?

Sent from my BlackBerry® wireless device


From: Vitali Lovich
Date: Sat, 11 Apr 2009 15:51:13 -0400
To: <Google-We...@googlegroups.com>
Subject: Re: GWT 1.6 and GXT

Alexandros Papadakis

unread,
Apr 11, 2009, 4:20:25 PM4/11/09
to Google-We...@googlegroups.com
You are wrong. There is no .js file. This is true for (at least) all
versions since 1.2.xx. There is some jsni code though...
Their demos might have used some js code.

BUT I don't think GXT 1.2.xx is compatible with 1.6. GXT 2.0 (expected
in April 14th) will be compatible with 1.6..

Alex

Vitali Lovich

unread,
Apr 11, 2009, 4:21:04 PM4/11/09
to Google-We...@googlegroups.com
I'm pretty sure that the jar also has all your javascript resources (there should be a public directory or something).

Paul Grenyer

unread,
Apr 11, 2009, 4:35:17 PM4/11/09
to Google-We...@googlegroups.com
Ok, well I must be doing something weird then. I have gxt working with gwt 1.6, but the js gets overwritten everytime I build. Ill start by checking the gxt version when I get home.

Sent from my BlackBerry® wireless device

-----Original Message-----
From: Alexandros Papadakis <alp...@gmail.com>

Date: Sat, 11 Apr 2009 23:20:25

Vitali Lovich

unread,
Apr 11, 2009, 4:35:44 PM4/11/09
to Google-We...@googlegroups.com
I've never had problems including 1.5 code in my 1.6 (actually trunk) project.  It seems stupid on the part of the GXT developers not to include the js files.  The easiest way is to just run your app & it should show up in the Jetty log if it's trying to access resources that aren't there - then it's simply a matter of putting those files there.

Vitali Lovich

unread,
Apr 11, 2009, 4:37:57 PM4/11/09
to Google-We...@googlegroups.com
What do you mean by every time you build?  Do you mean compile using the GWT compiler?  Then I think it might be that you're putting your js files in the wrong spot.

Paul Grenyer

unread,
Apr 11, 2009, 4:50:01 PM4/11/09
to Google-We...@googlegroups.com
Yes! So what's the right spot in the 1.6 project structure!

Sent from my BlackBerry® wireless device


From: Vitali Lovich
Date: Sat, 11 Apr 2009 16:37:57 -0400

Vitali Lovich

unread,
Apr 11, 2009, 5:34:28 PM4/11/09
to Google-We...@googlegroups.com
i'm not 100% sure - hence the reason I suggested to use the Jetty logs to find out where it expects them to be (you should see something like a "404 - resource name" message in the log.

Paul Grenyer

unread,
Apr 12, 2009, 4:56:18 AM4/12/09
to Google-We...@googlegroups.com
Hi

I'm having a slightly more successful morning than evening.

My WAR structure in my 1.6 project looks like this now:

js
tracker
WEB-INF
index.jsp
Tracker.css
Tracker.html

As you can see my application is called Tracker. I originally had the
js directory, which holds the JavaScript from gwtext.jar and
gwtextux.jar, in the tracker directory, which meant it got overwritten
every time I built.

I modified Tracker.gwt.xml to look like this:

...
<entry-point class='uk.co.marauder.tracker.client.Tracker'/>
<stylesheet src="/js/ext/resources/css/ext-all.css" />
<script src="/js/ext/adapter/ext/ext-base.js" />
<script src="/js/ext/ext-all.js" />
...

And in hosted mode it all works fine. (PeterF, I wonder if this is the
same problem you have?).

I can't help thinking that there should be a way to use GXT without
having to unpack and separately include the JavaScript. I tried
putting the jars in a few different places in the WAR structure, but
to no avail. Any suggestions?

Anyway, it works in hosted mode,but I get a blank screen in firefox
when running on TomCat and the same message as PeterF
($wnd.Ext.StatusBar is null or not an object) from Internet Explorer.

Any thoughts?

Paul Grenyer

unread,
Apr 12, 2009, 1:41:37 PM4/12/09
to Google-We...@googlegroups.com
HI All

We've been talking cross purposes and it's my fault for not being
clear from the outset. I've been talking about:

http://gwt-ext.com/

and I think the rest of you (except PeteF) have been talkign about:

http://extjs.com/products/gxt/

So I'll give gxt a go and see if that still gives me the widgets I'm after.

Nick

unread,
Apr 12, 2009, 2:29:22 PM4/12/09
to Google Web Toolkit
I think I know your problem. In 1.6, if you include links in your
static html file, you need to prepend the name of your project. If you
look in the WAR file structure and open the folder with your project
name, "tracker" in your case, you will see the css file in the
structure.

For example:
<stylesheet src="/js/ext/resources/css/ext-all.css" />

becomes

<stylesheet src="tracker/js/ext/resources/css/ext-all.css" />

I believe this will fix your problem in either project (GWT-Ext or
GXT).

(also, I hit reply-to-author before, this time I'm posting it to the
Group.)

-Nick

On Apr 12, 12:41 pm, Paul Grenyer <paul.gren...@gmail.com> wrote:
> HI All
>
> We've been talking cross purposes and it's my fault for not being
> clear from the outset. I've been talking about:
>
> http://gwt-ext.com/
>
> and I think the rest of you (except PeteF) have been talkign about:
>
> http://extjs.com/products/gxt/
>
> So I'll give gxt a go and see if that still gives me the widgets I'm after.
>
> --
> Thanks
> Paul
>
> Paul Grenyer
> e: paul.gren...@gmail.com

Paul Grenyer

unread,
Apr 12, 2009, 2:33:24 PM4/12/09
to Google-We...@googlegroups.com
Hi

> For example:
> <stylesheet src="/js/ext/resources/css/ext-all.css" />
>
> becomes
>
> <stylesheet src="tracker/js/ext/resources/css/ext-all.css" />

Thanks, but I already tried that. The app name actually prepended for you.

--
Thanks
Paul

Paul Grenyer
e: paul.g...@gmail.com

Paul Grenyer

unread,
Apr 12, 2009, 2:53:03 PM4/12/09
to Google-We...@googlegroups.com
Hi

> Anyway, it works in hosted mode,but I get a blank screen in firefox
> when running on TomCat and the same message as PeterF
> ($wnd.Ext.StatusBar is null or not an object) from Internet Explorer.

Right, I've now got the real GXT (http://extjs.com/products/gxt/)
working with GWT 1.6, TomCat and Firefox. My easier and there are
still some nice widgets.

What's the connection between gxt-gwt and gxt?

Alexandros Papadakis

unread,
Apr 12, 2009, 3:28:45 PM4/12/09
to Google-We...@googlegroups.com
GXT 1.2.3 is not 100% compatible with GWT 1.6... You should wait for 2.0...

Paul Grenyer

unread,
Apr 13, 2009, 5:27:14 AM4/13/09
to Google-We...@googlegroups.com
Hi All

Sorry to keep perpetuating this, but I didn't like the widgets in GXT
as much as GWT-EXT, so I'm back on with GWT-GXT.

I've:

1. created a GWT 1.6 project with the plugin.
2. Added gwtext.jar to war/web-inf/lib and to my project dependancies
3. Added the following to my .gwt.xml file:

<inherits name='com.gwtext.GwtExt' />
...
<script src="js/GwtExt.js" />

4. Modified my entry point to show a simple dialogbox:

MessageBox.confirm("Confirm", "Are you sure you want to do that?", new
MessageBox.ConfirmCallback()
{
public void execute(String btnID)
{
System.out.println("Button Click : " + Format.format("You
clicked the {0} button", btnID));
}
});

When I run the app in hosted mode (even following a compile),
everything loads ok but I get the following erro when I click the
button that should show the dialog box:

[ERROR] Uncaught exception escaped
java.lang.ExceptionInInitializerError: null
at com.gwtext.client.widgets.MessageBox.<clinit>(MessageBox.java:67)
at com.masterplan.client.MasterPlan$1MyHandler.onClick(MasterPlan.java:95)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:52)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:90)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
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 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:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)
Caused by: com.google.gwt.core.client.JavaScriptException:
(TypeError): '$wnd.Ext' is null or not an object
number: -2146823281
description: '$wnd.Ext' is null or not an object
at com.gwtext.client.core.Ext.setBlankImageUrl(Native Method)
at com.gwtext.client.core.JsObject.<clinit>(JsObject.java:37)
at com.gwtext.client.widgets.MessageBox.<clinit>(MessageBox.java:67)
at com.masterplan.client.MasterPlan$1MyHandler.onClick(MasterPlan.java:95)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:52)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:90)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)

Any idea what I'm doing wrong? Have I missed something in my
configuration somewhere?

Nick

unread,
Apr 13, 2009, 11:03:05 AM4/13/09
to Google Web Toolkit
I was able to get a MessageBox to pop-up. I put the following in my
*.gwt.xml file:

<module...
<inherits...User/>
<inherits name='com.gwtext.GwtExt' />
...
<entry-point...
<stylesheet src="/js/ext-2.0.2/resources/css/ext-all.css" />
<script src="/js/ext-2.0.2/adapter/ext/ext-base.js" />
<script src="/js/ext-2.0.2/ext-all.js" />
...

I added a "js" folder under the WAR folder. In that folder, I copied
the entire contents of EXT zip file.
Of course, I put the gwtext.jar in the war/WEB-INF/lib folder and
added it to my build path.

I then used the same code you did and got a message box pop-up,
including the verification text.

It's interesting to note that I was unable to make this work by
putting the javascript and css declarations inside the static HTML
file as seems to be the standard in 1.6.

-Nick
> e: paul.gren...@gmail.com

Paul Grenyer

unread,
Apr 13, 2009, 11:03:53 AM4/13/09
to Google-We...@googlegroups.com
Hi

I've done some more playing and simplified my code:

> 1. created a GWT 1.6 project with the plugin.
> 2. Added gwtext.jar to war/web-inf/lib and to my project dependancies
> 3. Added the following to my .gwt.xml file:
>
> <inherits name='com.gwtext.GwtExt' />
> ...
> <script src="js/GwtExt.js" />
>
> 4. Modified my entry point to show a simple dialogbox:

public class Metallica implements EntryPoint
{

public void onModuleLoad()
{
Panel mainPanel = new Panel();

mainPanel.setTitle("Hello World!");
mainPanel.setHeight(300);
mainPanel.setWidth(500);

RootPanel.get().add(mainPanel);

}
}

I now get the same problem as Payam (even in hosted mode):

[ERROR] Unable to load module entry point class
com.metallica.client.Metallica (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (TypeError):
'$wnd.Ext.StatusBar' is null or not an object
number: -2146823281
description: '$wnd.Ext.StatusBar' is null or not an object
at com.gwtext.client.widgets.Component.checkExtVer(Native Method)
at com.gwtext.client.widgets.Component.<clinit>(Component.java:108)
at com.metallica.client.Metallica.onModuleLoad(Metallica.java:15)

Someone must have GWT-EXT working with GWT 1.6?

Paul Grenyer

unread,
Apr 13, 2009, 11:33:31 AM4/13/09
to Google-We...@googlegroups.com
Hi Nick

> I was able to get a MessageBox to pop-up. I put the following in my
> *.gwt.xml file:
>
> <module...
> <inherits...User/>
> <inherits name='com.gwtext.GwtExt' />
> ...
> <entry-point...
> <stylesheet src="/js/ext-2.0.2/resources/css/ext-all.css" />
> <script src="/js/ext-2.0.2/adapter/ext/ext-base.js" />
> <script src="/js/ext-2.0.2/ext-all.js" />
> ...
>
> I added a "js" folder under the WAR folder. In that folder, I copied
> the entire contents of EXT zip file.
> Of course, I put the gwtext.jar in the war/WEB-INF/lib folder and
> added it to my build path.

This was almost the final piece of the puzzle! When I did the above it
worked in hosted mode, but not when deployed to TomCat. I was able to
get it working, however, with a minor modification:

<stylesheet src="../js/ext-2.0.2/resources/css/ext-all.css" />
<script src="../js/ext-2.0.2/adapter/ext/ext-base.js" />
<script src="../js/ext-2.0.2/ext-all.js" />

I suspect the the "root" directory (i.e. that accessed by starting the
url with /) for a TomCat app is different to Jetty/hosted mode. So,
adding ../ to the start of the url makes it relative to the rest of
the GWT JavaScript (in my case the masterplan directory) for the
application.

Anyway, it seems to be working perfectly now, I just need to try a
more complex example and blog it.

Thanks Nick! If I ever get the chance I'll happily buy you a beer.

(Now I just need to work out why Hibernate is giving rows from a table
twice and I'll have had a very successful weekend!).

--
Thanks
Paul

Paul Grenyer
e: paul.g...@gmail.com

Paul Grenyer

unread,
Apr 13, 2009, 1:17:05 PM4/13/09
to Google-We...@googlegroups.com
Hi All

> Anyway, it seems to be working perfectly now, I just need to try a
> more complex example and blog it.

My "more complex" example worked first time and my blog entry is here:
http://paulgrenyer.blogspot.com/2009/04/setting-up-gwt-ext-for-gwt-16-with.html

Nick Powers

unread,
Apr 13, 2009, 2:52:56 PM4/13/09
to Google-We...@googlegroups.com
Not a problem, I just happen to be messing around with the same thing this week.

Rvanlaak

unread,
Apr 15, 2009, 8:23:54 AM4/15/09
to Google Web Toolkit
I think I'm permanently going to switch to GXT after i've read the
following blog:
http://www.sambastream.com/blogs/agiannone/26-01-09/rich-internet-applications-and-web-20-gwt-ext-gxt-and-smartgwt
He makes some very good points!

I've been messing around with the layouts in GXT1.2.3 (with GWT1.6),
and found out that they aren't completely compatible. Besides that I
really want to use the new Google Eclipse Plugin, just because it's
awesome. GXT2 should have been released yesterday, but i haven't found
anything about it.

Paul Grenyer

unread,
Apr 15, 2009, 8:35:49 AM4/15/09
to Google-We...@googlegroups.com
Hi

> I think I'm permanently going to switch to GXT after i've read the
> following blog:
> http://www.sambastream.com/blogs/agiannone/26-01-09/rich-internet-applications-and-web-20-gwt-ext-gxt-and-smartgwt
> He makes some very good points!
>

Thanks! Very enlightening!

Reply all
Reply to author
Forward
0 new messages