Tuesday, June 12th, 2007

jMaki Extension for Google Gears

Category: Gears, Java, jMaki, Library

<>p>Greg Murray has posted his jMaki Extension for Google Gears.

He details the steps required to create an extension for jMaki, and then showed an example of mapping the save button for the Dojo Editor and Dojo Inline Edit components which publish to the topic “*onSave”.

javascript
< view plain text >
  1. jmaki.addGlueListener("*onSave", function(args) {
  2.     // publish to the google gears
  3.     jmaki.publish("/google/gears/execute",
  4.     { query : 'insert into jmaki values (?, ?)',
  5.       args : [args.value, new Date()],
  6.      callback : function() {
  7.          jmaki.log("Saved " + args.value);
  8.      }
  9.     });
  10. });

The returned value is assigned to the global variable window.editorData which you can then assign to your widget. For a Editor you can assign a JavaScript variable as the value using a client side value binding which starts with an ‘@{‘ and contains the package and variable name and ends with an ‘}’. For this window.editorData the client side value binding is @{window.editorData}. With a JSP / JSF widget the tag in a JSP page would look like the following:

javascript
< view plain text >
  1. <a :widget name="dojo.editor" value="@{window.editorData}" />

Posted by Dion Almaer at 5:44 am
4 Comments

++++-
4.1 rating from 21 votes

4 Comments »

Comments feed TrackBack URI

Whats the point. If you’re using Java anyway, why not directly use GWT?

Comment by Kishor Gurtu — June 12, 2007

After seeing the extremely poor and hacky J2EE blueprints code, I will not touch any code / library written by this author.

Comment by Sanjiv Jivan — June 12, 2007

That’s not fair Kishor and Sanjiv; jMaki makes it possible to use best-of-breed features from the various Ajax toolkits that are available, in a fairly straightforward way. Also, GWT is good for certain things, but it is fairly low-level in it’s features, and does not have the full set of widgets that one might want to pull in through YUI, Dojo, etc. Also, what does the J2EE blueprints code have to do with Greg Murray?

Comment by Brad Neuberg — June 12, 2007

I was a member of the BluePrints team and I am proud of a lot of the work we did on Petstore 1.0, Adventure Builder, and Petstore 2.0. We were able to shape the early programming model for J2EE and we were very early to show how to use Ajax + Java. It is true there were bugs in code we wrote but to make generalizations in such as this is not fair.

jMaki is a realization that all good code does not originate from a single project or individual. The focus is to enable clientside technologies like YUI, Dojo, and Google Gears to be used together with JavaScript binding them together.

Also jMaki is not just a Java play, it works with PHP, EJS (using Phobos), and Ruby.

Comment by Greg Murray — June 13, 2007

Leave a comment

You must be logged in to post a comment.