-
Get a monthly update on best practices for delivering successful software.
I've been developing with GWT, OpenSocial and Orkut, using the gwt-google-apis project on Google Code (specifically the gadgets subproject). It's a nice enough api that makes it relatively painless to build gadgets in GWT.
This is a bit different from Didier's gOpenSocial library, which was an early success at building OpenSocial gadgets with GWT. But the google gadget library isn't really quite ready for OpenSocial. I've skinned my knee here and there, so I thought I'd give others the benefit of my experience.
So, first thing, how the heck do I get GWT to generate the
line into my manifest?
Is it a parameter to the @ModulePrefs annotation? No. It's not. The way the GWT gadgets API deals with required features is by defining an interface that the Gadget class then implements.
package com.pathf.gwt.simplegadget.client.api; import com.google.gwt.gadgets.client.GadgetFeature.FeatureName; @FeatureName("opensocial-0.7") public interface OpenSocial { void initializeFeature(OpenSocialFeature feature); }
The feature itself extends com.google.gwt.gadgets.client.GadgetFeature and looks like this.
package com.pathf.gwt.simplegadget.client.api; import com.google.gwt.gadgets.client.GadgetFeature; public class OpenSocialFeature implements GadgetFeature { private OpenSocialFeature() { } }
The class declaration for my simple gadget then looks something like this:
@ModulePrefs(title = "SimpleGadget", author = "Me", author_email = "me@gmail.com", height = 300, description = "A simple gadget.") public class SimpleGadget extends Gadget implements OpenSocial {
There are some drawbacks to this particular approach, specifically that the version of OpenSocial is hardcoded into the interface. Future versions of the GWT gadgets API should probably approach this in a different way.
Anyhow, I hope I've saved some folks the trouble of figuring out how to write the OpenSocial requires into the manifest. I'll show how to overcome a few of the other stumbling blocks on the way to building a full featured OpenSocial gadget.
Related posts:
Topics: Google Gadgets, GWT, OpenSocial
[...] GWT, Gadgets and OpenSocial Dietrich shows how to get started developing OpenSocial gadgets with GWT. [...]
Pingback by Weekly GWT Links for 11/2/08 | GWT Site, Sunday, November 2, 2008 @ 10:43 pm
It’s not really unreasonable that the manifest version is tired to a particular Java interface type since newer versions of the API often introduce new methods, and sometimes break old ones.
Comment by Ray Cromwell, Monday, November 3, 2008 @ 2:17 am