GWT, Gadgets and OpenSocial
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.
Topics: Google Gadgets, GWT, OpenSocial
Comments: 2 so far
Leave a comment
About Pathfinder
Follow the Blog
-
Get a monthly update on best practices for delivering successful software.
Subscribe via email
Subscribe via RSS
Categories
Topics
Archives
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
Blogroll
Recent
- Elements of Testing Style
- Aesthetics and Web Design
- Asterisk-Java Testing with Groovy
- 3 Misuses of Code Comments
- Fluently NHibernate
- Digging a Hole and Covering it with Leaves — The Software Development Version
- The Importance of User Experience - Do You Understand It in Your Bones?
- Writing Your Own Protocol With NSURLProtocol
- What’s In Your Dock: iPhone edition
- Feature Fatigue

[...] 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