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
Sent from my BlackBerry® wireless device
Sent from my BlackBerry® wireless device
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?
We've been talking cross purposes and it's my fault for not being
clear from the outset. I've been talking about:
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.
> 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
> 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?
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?
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?
> 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
> 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
> 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!