WaveConnector for GWT: Local Testing and Turnkey Gadget Development
Hello everybody, today I announce my first open source publication :D I’m excited so please leave comments and let me know what you think or if you run into problems :)
Introducing WaveConnector for GWT 0.0.1
WaveConnector allows you to develop Google Wave gadgets and to test them locally in hosted mode! Head over to the project site at Google Code for more info.
The turnkey archive that is provided on the project site has everything you need to get started! It already contains the little project I made for the tutorial last week, so you can just downloaded the waveconnector-gwt-turnkey archive and start from there. There is no need to download anything else. Hit the jump for a really short How-To that’ll get you going in no time.
And now… a screenshot of our WaveListGadgetGWT running inside a hosted mode browser!
Update: Apparently the old gwt-gadgets gadget linker for GWT does not support power features such as code splitting and resource bundles. This is not acceptable. I am currently looking into whether its possible to use the xs linker instead. In that case the communication with the gadget js api would have to be reimplemented (or maybe taken from gwt-gadgets).
Really Short How-To
Make sure to have the latest Google Plugin for Eclipse installed.
- Download the turnkey archive (you don’t have to extract the zip)
- Select File -> Import
- Select “Existing Projects into Workspace” from the import dialogue
- Select “From archive file” and choose the turnkey archive you downloaded earlier
- Click Finish. You now have three projects in your workspace.
- GadgetTester is used to test your gadget in hosted mode
- YourWaveGadgetDeployment is the project that compiles to the actual wave gadget
- YourWaveGadget is the project that contains the GWT code for your gadget.
- To test the Gadget locally, run the GadgetTester. It will load YourWaveGadget in a hosted mode window
- To deploy, I suggest you just deploy YourWaveGadgetDeployment to the AppEngine. Otherwise you can compile it and upload the war/yourwavegadgetdeployment folder wherever you want.
- I have deployed the turnkey gadget to http://connected.latest.wavelistgadgetgwt.appspot.com/yourwavegadgetdeployment/com.thezukunft.wave.client.YourWaveGadgetDeployment.gadget.xml if you’re interested
Feel free to ask questions how all this works. Some might also be answered on the project page (including: “Why is this great?!”). I haven’t gotten around to really documenting things yet.
FAQ/Tips and Tricks and Random Notes
Taken from the project page.
- All code is released under the MIT License
- If your refactor stuff, make sure to adjust the module definitions. Eclipse doesn’t update them.
- The YourWaveGadgetDeployment project has AppEngine nature for easy deployment. This is not really required and you can remove the dependency.
- All events will run through the injected eventBus. Do not try to attach handlers to the Wave object. This is the core difference from the JS wave API.
- If you want to understand the dependency injection going on, note how the GinModules in the different projects inherit from one another.
- If you add classes to your main YourWaveGadget project that need to be injectable (like sub-widgets that need to be created by a provider), keep in mind to add them to GinModuleWaveGadget.java
- Use the Wave objects log function to log messages that are visible in the wave sandbox
- You can cut the compile time of your gadget (because you will still be deploying it often) by adding something like <set-property name=”user.agent” value=”safari” /> to your module xml. (replace safari with your browser)
- All gadgets make use of the DynamicHeight feature. If you want to adjust the Gadget’s height to fit the content fire a GadgetUpdateEvent on the eventBus.
That is all.
I just sort of pushed this out on my own, but really there were some other people have helped me.
- Most importantly, Hilbrand Bouwkamp and his superb cobogwave library for GWT on which WaveConnector immediately builds up on.
- Once again Alex Moffat over at Lombardi who first gave me the idea of creating Wave Gadgets in GWT.
- Everyone at Google for their superb tools ;)
I should probably document things and I’m also planning to add some features. Most importantly I want a UI to manage the simulated wave’s participants and perhaps even the option to switch the “perspective” of the gadget to that of another user (maybe even side-by-side).
So although it’s not 100% done, I felt this might be a great share for some people and I think that this is the closest we can currently get to comfortably developing wave gadgets in GWT. Also, now you can take any GWT application (restrictions on rpc calls and such apply ;)) and make it into a wave gadget.
Please leave a comment if you liked this and tell your GWT coding friends :) Developing for wave is really fun!