Wednesday, April 18, 2007

GWT Gadgets, etc.

So I knew that I wanted to create the g3p gadget using the Google Web Toolkit (GWT), since we all know writing AJAX by hand can be a pain in the ass and this is almost exactly what GWT was created for. However, when I wrote my first Google gadget for the student gadget contest back in November, I did in fact first write it without the GWT, and then later started to rewrite it using the GWT. If you want to see what these look like, here is Version 1 and Version 2 (these are links to the XML files, you can try them out by adding them to your Personalized Google homepage).

Getting the GWT app to work as a gadget is not as easy as you might think, however, and I am still not sure what the best way to do it is. I also noticed that Google suggested making this easier as number 2 of their GSoC ideas. Somebody did in fact pick up this idea (here), and so I emailed him asking if he had any suggestions for the right way to do this in the meantime. I haven't heard back yet though, so I decided to take matters into my own hands.

The first problem I ran into was that I was trying to use the Google hosting SVN repo as my file server, which it turns out is a bad idea. So I checked out a copy of the project on my server. The next problem was that I had originally embedded the GWT XML inside the Gadget XML, but this was causing javascript domain security issues when the gwt.js file injects its iframes and they try to refer back to the parent. What I ended up having to do was put an iframe inside the Gadget module with the GWT project's HTML file as the source, though I am really not very happy with this solution. Nonetheless, I settled on the fact that this was probably going to be the way I have to do it for the g3p gadget. The main reason I don't like this is because I am not looking forward to having to pass the gadget preferences to the GWT app, but perhaps this is the best/only way to do it. Anyway, that's the story and I am glad I can at least start working on the gadget in GWT for now.

No comments: