The postings on this site are the contributor's and don’t necessarily represent IBM’s positions, strategies or opinions.
June 10th, 2009 Alex Moffat Posted in GWT, Google Wave | 11 Comments »
I’ve found a couple of things to make the process of building a Google Wave Gadget with GWT easier. In my previous post on Building a Google Wave Gadget with GWT I used a script element in the GWT module.xml file to include the wave.js file and I created a NeedsRpc interface to generate the <Require feature=”rpc”/> element in the ModulePrefs. There are easier ways to accomplish both of these tasks using the Google API Libraries for Google Web Toolkit but they are not very well, if at all, documented.
To include the wave.js script it’s better to use the @Gadget.InjectContent annotation. This will add the content of one or more files to the top to of the Content element in the gadget xml file. I added @Gadget.InjectContent(files={”ModuleContent.txt”}) as an annotation to the HelloWorld class. ModuleContent.txt contains <script type=”text/javascript” src=”http://wave-api.appspot.com/public/wave.js”></script>. Adding the wave.js script in this way also solves the problem I was having with wave.isInWaveContainer() always returning false. It must have been the result of an initialization order issue.
A similar technique can be used for the ModulePrefs. Adding @Gadget.InjectModulePrefs(files = {”ModulePrefs.txt”}) as an annotation, also to the HelloWorld class will add the contents of ModulePrefs.txt into the ModulePrefs element. ModulePrefs.txt contains <Require feature=”rpc”/>. The final result is
@Gadget.ModulePrefs(title = "Hello Wave World")
@Gadget.InjectModulePrefs(files = {"ModulePrefs.txt"})
@Gadget.InjectContent(files = {"ModuleContent.txt"})
public class HelloWorld extends Gadget {
with no need for extra interfaces or dummy methods and the correct initialization behavior.
June 10th, 2009 at 9:38 pm
[...] element in the ModulePrefs. I now have a better solution for the script tag and Require element. See Wave Gadgets with GWT – Build improvements. This also solves the isInWaveContainer issue I mention [...]
June 30th, 2009 at 1:23 am
Hey Alex,
Ive successfully creates some gadgets using pure JS/HTML.
Moving to GWT has been a pain though.
I tried both the first method you described as well as the improved version. Everything goes fine until I try to run the gadget.
Using the Chrome JS console I found that it breaks during the browser specific JS load part. It complains about _args being undefined.
Have you experienced anything similar?
Peace
G
June 30th, 2009 at 9:52 am
I’ve not seen that problem. If you’ve not tried it I suggest compiling the GWT code with the detailed option so that it’s easier to see what’s going on if you have to debug the actual JavaScript. _args doesn’t sound like an GWT obfuscated JS name though, is it from some other code you’re including in the gadget.
June 30th, 2009 at 12:10 pm
Hey,
Thanks for the response.
I did switch it to detailed mode and found some strange results. Upon further investigation it seems you are most likely spot on.
I’ve got some new ideas that ill try out.
I suspect the gadget API as the culprit as omitting that has allowed a simple GWT to work in the wave.
Thanks again
G
June 30th, 2009 at 2:04 pm
Glad I could help, if only a little bit
Hope you get it working.
October 4th, 2009 at 6:21 am
Just found this site: http://wavegadgets.com. Looks like it’s under construction though but says it “Will offer a list of gadgets developed for use within Google Wave”. Interesting…
February 1st, 2010 at 11:27 am
This seems to be working with GWT 1.5 only. any ideas abt GWT 2.0?
thanks
February 1st, 2010 at 2:48 pm
Unfortunately not. I’ve not tried GWT 2.0 with Wave yet.
February 8th, 2010 at 11:49 am
Hello Again, I did get it working with GWT 1.5 only. Another question for you though
hae u tried using some third party widgets like GxT or GWT-incubator. I am not able to find out how to reference the CSS for the same. Any ideas?
Thanks
February 8th, 2010 at 12:13 pm
I’ve not tried anything outside of plain vanilla GWT, so, yet again unfortunately, I’m not going to be able to help. Sorry.
February 8th, 2010 at 1:55 pm
[...] http://development.lombardi.com/?p=845 [...]