Monday, May 10, 2010

Vaadin

Vaadin is a rather attractive JEE web application framework, where the client and server components are integrated into a single paradigm. To achieve that,
  • It uses GWT to present skeletal widgets on the client
  • Each client widget has a corresponding server widget component
  • It uses its own client-server communication channel rather than GWT RPC to connect the client and server   parts of a UI component.
  • The server component injects further presentation density into its corresponding client GWT widget skeletal by sending UIDL messages through that channel.
  • UIDL is in JSON, but with origins in XML.

It is a brilliant architecture which gives the server total management of the framework, hence freeing the programmer from having to set-up RPC communications. Entry point classes are defined by extending the Application class. The programmer merely defines classes (must implement Serializable) and instantiates objects just as in any non-webapp Java application.

Whenever a client class refers to an object or class defined in a class running on the server, vice versa, Vaadin takes care of that communication for you. The transparency between client and server resources is so seamless to the programmer that it tends to blur my karma from being conscious of whether I am working on the client or server code.

However, to extend a Vaadin component, you would not only need to construct its GWT skeletal widget but also the server side component. Therefore, you could not simply any old how take a GWT widget and deploy it within the Vaadin framework. However, within a web app, you could certainly mix and mesh Vaadin with pure GWT entry points by URLing each other.

I think Google should buy this company and integrate it with the rest of GWT and present it as GWT 3.0.

Running the Vaadin Samples
Download the latest Vaadin pack and unpack it.
Look for the vaadin-examples project in the unpacked directory and import it into Eclipse.
When the project is imported into Eclipse, look for the launch file vaadin-examples.launch. Run that launch file (by double-clicking on it, obviously).

You could also run it on the command line without importing the project into Eclipse.
Run either the file start.sh (for linux/unix) or start.bat (for Windows).

You will notice that the source files in vaadin-examples are placed within the war folder in WebContent/WEB-INF/src, because the pages of the samples allow you to view the code of the respective sample - and if the http server is to display source code, the source code has to be placed within the war structure.


Modifications required on the launcher
You might notice that examples from Vaadin tend to be hard-coded to run on http port 8888. That makes you mad because you will not be able to run more than one Vaadin example simultaneously on the same machine.

There is a class file  com.vaadin.launcher.DevelopmentServerLauncher. The programmers have created all the handles for the http port to be specified. The programmer has even written the line to read the port number that would be supplied as input argument to the Main class, but the programmer has somehow forgotten to apply that port number.

First test if Vaadin has rectified the file to read the port number. At Eclipse's Launch Configuration window, modify the Java Application launch for vaadin-examples. Find an unused port on your system. Let us say the unused port you found is 8200,  Add the the following argument at the Arguments tab
--httpPort=8200
Then, run the launch for vaadin-examples again (presuming you have stopped it in the first place). If the console output still says http port 8888 is used, they have not rectified it yet.

Here is the patched version of DevelopmentServerLauncher, that would apply the port number read as input argument:

If you wish to run the samples outside of Eclipse on the command line, you have to define an env variable (in unix/linux - a shell variable exported to system env)
VAADIN_PARAMETERS=--httpPort=8200

Voila Viola! (A former colleague had a slight habit of saying this - perhaps, his girlfriend's name was Viola.)

10 comments:

  1. Now open the set Tutu Helper App up APK in your Smartphone open Check this Website the APK and click setup switch. Tutu application will Tutu Helper VIP App certainly be directly mounted right.

    ReplyDelete
  2. If you have a bigger house or very tough allwomenstalk.com/ water, the WaterBoss may not be a good Title selection for you. When utilizing this Fleck Water Softener Reviews & Guide softener, you'll discover that the LCD as well as Fleck Water Softener programmable choices make this a wonderful Best Fleck Water Softener conditioner that's reduced maintenance.

    ReplyDelete
  3. If you have a history of illness that is difficult to recover, maybe our next article will help you to recover

    Walatra Berry Jus
    Walatra sehat mata

    ReplyDelete