Google Web Toolkit integration in Nuxeo EP


Thu 03 July 2008 By atchertchian


The Nuxeo application extensively uses JSF facelets and Seam for its
rendering:


  • Seam provides a great bridge between Nuxeo services and JSF rendering, using contextual components;

  • The themes and layouts modules rely on facelets to build rendering based on contributions to extension points;

  • The url module relies on JSF phase listener and navigation handler pluggable behaviours to provide bookmarkable urls to documents.




Even though last versions of Seam offer a very clean integration with Richfaces/ajax4jsf JSF libraries, the Google Web Toolkit (http://code.google.com/webtoolkit/) looks like a good alternative when dealing with the more complex screens.



For instance, rendering a table of documents with pagination, sorting and
selection support is not straight-forward with JSF facelets.



While JSF goal to separate logic and rendering can be seen as too restrictive for a framework like Nuxeo EP, GWT makes it possible to keep this separation and not lose any expressivity because a GWT application is written in Java. Also, JSF has a quite steeper learning curve than GWT.



Integrating GWT with Nuxeo EP is an attempt to get the best of both worlds: keep JSF for its integration with Seam, third-party JSF libraries, easy deployment/override of xhtml pages as well as existing Nuxeo modules relying on it, and use GWT for some specific complex screens.



An addon has been written as a proof-of-concept. Documents are retrieved
from the Nuxeo application via a Seam component and information for their
rendering is serialized on the GWT client side to display them in a
paginated table.



Seam made life easier by providing a remoting service interacting with the
GWT service framework: from GWT rendering classes, it's possible to call a
standard Seam component that will implement server logic.



Some code has been added to restore the conversation when calling the Seam component, as we want to display the list of current folder children. The conversation id is retrieved on client side thanks to javascript code
parsing the url. It is passed alongside when calling the remote service.



Packaging was not a problem thanks to maven plugins that perform the GWT
compilation and make it possible to include them in the nuxeo.war folder at
deployment.



Integrating the GWT module within standard xhtml pages was easy: the
javascript simply needs to be included in the page as mere html code.



Here's a screenshot of rendered table:





What's next?


  • Support internationalization: GWT offers different promising internationalization procedures to achieve sharing of translation files *.properties with GWT modules.

  • Use GWT or GWT-ext libraries modules to customize some complex Nuxeo screens like users, access rights or workflow management.

  • Provide shared libraries that can be used by other rendering frameworks like Flex, mostly document model serialization.




For better understanding of these technologies, I strongly recommend the excellent article written by Rob Jellinghaus (Seam / JSF / GWT Integration: What, Why, and How: http://unrealities.com/seamgwt/article_0.2.html).



The addon code is at http://hg.nuxeo.org/addons/nuxeo-platform-gwt/. It
currently only works with the Nuxeo Seam 2 branch that should be merged in
the 5.2 branch shortly.


Category: Product & Development