Question

We want to create a widget platform for a particular website.

I couldn't find any articles on doing this, but what I need right now is for someone to point me in the right direction.

What framework should we use? I am proficient with RoR, and okay with Java/.Net, but I don't know if doing this in rails is easy because I can't see how this will be like the usual web application.

A lot of widget platforms allow third party developers to use Javascript. How easy will this be, will we have to create a interpreter or something like that?

What kind of architecture should we follow? Do we store widgets in the database?

Was it helpful?

Solution

Give a look at Java Portlet specification. Protlets seems to be exactly what are you looking for. At least you should read technical overview. There are many portlet containers (frameworks) available.

If you really have to create everything from stratch, look at Android AppWidget framework. Android is an Google's open-source OS for mobile gadgets. They have complete separation between OS code (widget container) and Third-party code (Widget Providers) - it is really useful if you have to deal with untrusted user-provided code.

Motorola also provides its own Widget framework for mobiles, but it isn't open-source.

OTHER TIPS

What exactly are you trying to do?

Is your website new? or does it already exist in a certain enviroment?

I would suggest that you might construct your page from an xml template, and use some sort of custom sax parser to replace references to widgets with chunks of html on the server, you could use xslt, but I suspect it would be easier to invoke arbitrary code with the sax parser.

I like java, because that's my space, but I'm sure ruby and .net to creditable jobs of simple dom manipulations.

3rd party developers could provide the above-mentioned chunks of html, with included script-tags to provide whatever functionality they want.

I guess the questions I have are:

  • What do you mean by widget, and

  • What do you mean by "From Scratch"?

If by "from scratch" you mean you don't want to just skin previously existing widgets, I would start by picking a javascript framework that met your specs (jquery, dojo, aria, etc.) and then seeing if they can stretch as far as you can push them. (this is assuming you don't mind the widgets being open-source. Also that you can either make up for any lack of accessibility or don't see that as an issue.)

I would not rely on server-side for more than outputing the code, saving changes, and loading saved data for the widget. If you are already going to need ajax to pass interactions from the client to the server, why stall out the widget making the server pay attention to the other mechanics of the widget?

I would not use Java, but for the same reason NSherwin would. It's not my forte. But I also think that we are moving beyond the reliance on compilers and full-blown apps for getting things executed on the web. Java will have it's place for the foreseeable future, but we don't need to lean on it (or Flash, for that matter) when our browsers (and developers!) can do the work faster and with less overhead. (Not to mention that this could HELP accessibility and usability. Think mobile phones not needing a special app for viewing Facebook or Twitter!)

All of this changes a bit based on my first question: What do you mean by widget? If you mean an appointment calendar, or a photo frame, or countdown timer (God, I'm boring, sorry), then keep everything I said above in mind. Use php or RoR to generate the code, js via a good framework to make it tick, and ajax to either xml to MySQL to handle interactions beyond event handling.

But if what you want is a widget for visitors to play pac-man, or design their dream home floorplan, or something really math/graphics heavy, I would then bow out to those who know a lot more than I do about Java/Flash. I think the day is coming where I can bang a drum even in those cases, but getting something even close today is not worth the man-hours.

Here is something I am currently struggling with that may help refine your needs...

Let's imagine a widget like the Southwest Airlines Ding! desktop widget, but on the web. It will alert you the moment a good deal comes up. Time is of the essense because there are limited spots. Do you have the browser query the server every half-second to see if there is an update? Do you set up a DB that, on update, sends out a crontask to the server to run a script that updates an xml file that is much easier for the browser to check for filesize changes? And all of this so that the user can here a DING without having to hit refresh (which would probably produce a less-efficient version of the same strain on the server)?

I have a js script that queries the cookie for the active page every half-second so the user get's a warning when they are about to be kicked out. I'm sure there is some event listener that could maybe eliminate the need for looping, but is there an equivalent for when something happens on the server and the browser is just hanging out?

Just my thoughts on widgets and web-apps. Hope it was helpful.

You are looking for http://jswaf.googlecode.com/

I'm a co-author of that tool... But the version of it available online is way out of date.

I have a much better version available on my home computers, but unfortunately I can't access it for the next two months :(


If you want to write a framework of your own from scratch, even the version availbale online now will give you a pretty good idea of how to go about it.

Yea, you are right: to create a runtime widget, you need to use interpreters. Fortunately, youcan directly use the javascript interpreter available in the browser.

Its all in JSWAF's code.

Please do send in comments about JSWAF, especially if you find something goofy about it.

Cheers, jrh.

I've created own widget set for my projects not long ago. It was not bad. On the other hand it wasn't as good as ExtJS, so I moved finally to this widget set recently. For your purposes, please take a look at Ext-GWT widget library.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top