grails (11) vaadin (11) meteor (6) elasticsearch (3) java (2) centos (1) cloudbees (1) google analytics (1) gradle (1) heroku (1) javascript (1) jdbc (1) jug (1) logback (1) logging (1) mac os (1) mongodb (1) mongolab (1) mysql (1) twitter (1) ubuntu (1)

Wednesday, October 3, 2012

Grails and Vaadin 7 beta - first version of the plugin

It is finally out. The first working version of Grails plugin for Vaadin 7.

Vaadin 7 differers from Vaadin 6 a lot and therefore there is no backward compatibility beween the plugins for 6th and 7th version. Actually, the plugin for Vaadin 7 is made almost from scratch. Many things have been simplified and plugin is just handling the connection between Grails and Vaadin. For example dynamic methods getBean and i18n are not injected anymore. 

One thing I have noticed after playing with Grails 2.2.0 and Vaadin 7 - it is fast (actually in two ways). First, I have made localized application with access to database via ORM (Hibernate) and Spring (Services), displaying list of users in a good looking table in just 5 minutes (sometimes, in other frameworks, I don't even setup the project in that short time). Second, it is really responsive user interface. I think the guys in Vaadin did amazing job with the 7th version. 

Let's have a look how to install the latest version and try it out. Setup Grails console before you start or you can just make it in your favorite IDE. 
  1. Create new project and run it.
    grails create-app bookstore
    cd bookstrore
    grails run-app
  2. You can stop the application now. It was just to verify that you have successfully created the project. Download and install the plugin
    grails install-plugin /path/to/plugin/grails-vaadin-1.7.0-beta2.zip
  3. And run the application
    grails run-app
Quite simple, right? You might be wondering... what about access to database or localization. There is a new class Grails and that one is meant to be used when you need to get the access to the services or i18n. Few examples follows.

Let's create a service class in Grails. It just returns all the users from the database.
class UserService {
   List<User> listUsers() {
      return User.list()
   }
}
Now get the service and call the method.
List<User> users = Grails.get(UserService).listUsers()

Or just create new Label and pass there localized string. 
String text = Grails.i18n("key.to.localization.from.i18n")
Label label = new Label(text)

If you find an issue, please report it in Jira or preferably in Github

5 comments:

  1. Fantastic effort! I'm really happy that you have decided to continue with the effort of developing the Vaadin plugin for Grails. By the looks of it, good things are happing as well! Keep it up!

    ReplyDelete
  2. Hi! I am evaluating RICH technologies where Grails is a prerequisite. Vaadin plugin for grails is one of the options.
    I have zillions of questions and the first one is: is this the right place to discuss in details this plugin?
    or is there a specific section in the Vaadin site?

    ReplyDelete
  3. Hi Fabio, I have used Vaadin 7 together with Grails 2.2.0-RC2 on a project which is just about to go to the production. It works nice, but you really need to consider many things before choosing Vaadin and Grails.

    I might answer some of the questions you have got.

    Please ask on stackoverflow and don't forgot to add tags:
    http://stackoverflow.com/questions/tagged/grails
    http://stackoverflow.com/questions/tagged/vaadin
    I am following them and I will try to help.

    ReplyDelete
    Replies
    1. Done, thanks. I started with a generic one...

      Delete
  4. Fabio, there is also new kind of central page for Vaadin on Grails: http://vaadinongrails.com

    ReplyDelete