My favorites | Sign in
Logo
                
Activity: Medium
Code license:
Apache License 2.0
Labels:
GWT, Spring, Springframework, IoC, Java
Feeds:
Project feeds

GWT-cs is a GWT module that allows developers to construct their GWT client side code using Spring IoC. It combines the powerful features of deferred binding and generator from GWT and inverse of control from Springframework, so that developers can define their application structures not only of their server code, but also of their client side GWT class beans.

One can enjoy the full support of the existing Srpingframework tool sets, such as Spring IDE Eclipse plugin in authoring the Spring bean configurtion files. GWT compiler will invoke the GWT-cs bean factory generator to generate the factory class(s) at compile time from the (Spring) configuration file(s), which will then be compiled by GWT compiler into javascript for runtime execution.

GWT-cs features a tiny archive file with only two classes and one interface. The current release (v0.11) supports a subset of the Spring IoC functions that are enough to let developers to build their GWT application structures. GWT-cs does not dictate how it is done, but leaves the door fully open for anybody to do it in his own way. Typically, a bean defined in Spring xml configuration file would be a GWT Composite class and one can define one or more beans to collaborately build a page.

How does it work

GWT-cs integrates the Spring BeanFactory API with the GWT generator. The first thing it does is to instruct GWT compiler to invoke the GWT-cs generator to generate BeanFactory source code for any interfaces that inherate from BeanFactory interface. The GWT-cs generator which extends GWT Generator uses the Spring API to load the BeanFactory configuration file(s) and generate the source code.

With only three java files in the module, everyone should be able to see how it works, once he/she goes through the code.

I started the generator class based on a forum post by riyaz.mansoor.

How to use it

Ths subsequent screen navigations should follow the collaboration patterns defined in the configuration.

What does it support

Not all the Spring IoC features are supported. I always follow the 80/20 rule. The current release has enough to support my own use cases.

If you need something that can't be done with the current release, send me a note at yxzhao100@gmail.com.

Usuage Example

Download the example war file and its source code jar file. Drop the war in your tomcat (or else) server webapps directory, start tomcat server and point your browser to http://yourserver:yourport/GWTcsTest to see the sample application.

This example implements a Petri net like flow structure. Every screen (a GWT Composite class) connects to other screens through Transitions as defined in the Spring bean configuration xml file.









Powered by Google Project Hosting