Recently I was trying to use "jMaki" for some demo application. I found it quite simple and useful. For those who are not aware of "jMaki", here's a brief description about the project "jMaki"
"jMaki is an opensource project in java.net. It is a framework that provides a standard way for designing or creating reusable AJAX-enabled widgets and the services needed to back those widgets. The framework includes a simple widget API that you can use to create new widgets or wrap existing widgets from widget libraries such as those from Dojo, Yahoo UI Widgets, Google, Abobe Spry, or Scriptaculous."
The current version of jMaki has some widgets which are wrapper of ajax libraries like Google Map, Yahoo Geocoder, Dojo clock and Dojo editor etc. You can use those widgets in your web application easily using jmaki api. There is a Netbeans plugin for jmaki available on java.net. This plugin can be used for automatic code generation by doing just drag and drop of widgets.
If you want to try jmaki quickly then try this plugin.
Before adding any widgets to your jsp page, you have to add a taglib declaration at the top of your jsp. Here's the code for the taglib declaration
<%@ taglib prefix="a" uri="http://java.sun.com/jmaki" %>
Here's the sample code to show a yahoo calendar in your jsp. Just add this below line in your jsp and you will be able to see a yahoo calendar in your jsp page.
For flickr Search add
topic:'flickrSearch',
columns:3,
count:9
}"
service="xhp"/>
Event handling is the best thing I like most in jmaki. jmaki provides api for handling events between multiple different widgets. It follows the subscriber/publisher model to handle events. And the best part is it's totally a client side api and the eventing works totally in client side through java script. So it's fast and doesn't have any serverside dependency. So if you have multiple widgets in a page and if you want to make those widgets to interact with each other without any code dependency, then you can make a widget to publish an event so that all subscribed widgets can listen that event and acts appropriately. Let me explain how it actually works.
A widget can publish an event just by using publish() in jmaki javascript api. Usually widget publishes to a topic with a particular name. The widgetA can publish a event by adding the following code
jmaki.publish("topicA", response.someobject);
where topicA is the topic name.
Now all other interested widgets can subscribe to this topicA to listen the event. This can be done by the following code
jmaki.subscribe("topicA", listener);
where "listener" is a javascript function which is called whenever a widget A publishes an event on topicA.
So if you have three widgets in a jsp page let's say widgetA, widgetB, widgetC. And widgetB and widgetC work depending on the state of the widgetA. Then widgetA can publishes a event whenever it's state changed and widgetB,widgetC can listen that events and works appropriately.
I also tried to use these jmaki widgets in portlet environment inside portlets. It worked after a few customization steps. Also the eventing things worked between multiple portlets where each portlet contains a different widget.
I will post the steps to use jmaki in portlet enviroment in a separate blog soon.
Here's the link for jmaki home page



Posted by Michael on February 15, 2007 at 02:02 AM IST #
Posted by Michael on February 15, 2007 at 03:39 AM IST #