Vaadin uses Maven – A tool for managing Java libraries and dependencies, building, packaging, task execution and so on. If you don’t want to use IDE you could generate basic application from Command-Line:
I personally use Eclipse IDE. There is a plugin that can help you get the skeleton of the project up and going.
Once you have the skeleton of your application you can enter your models in my tool and setup the Vaadin Generator.
The generator needs a place – a path on your computer where the code will be generated. For Vaadin this is the directory where the pom.xml file and src and target directories are located. If you are just getting started, the generator looks for the deepest directory inside the src folder. If you already have generated source code from the Generator and you have used the Java Packages that I have placed, the generator will load them from the file system. The generator looks for directories/java packages/ for the stuff that will be outputted:
- “model” folder/package for the domain models
- “dao” or “jdbc” for the data access layer
- “i18n” for the place where your translations and Messages util class will be/are located
- “ui” folder where your user interface Vaadin components are located.
If you have any suggestions for different names of the Java Packages, write me and I’ll add them as an options to look for.
Another thing that I started implementing is adding multiple Generators when you are entering a more high level one. Vaadin is a User Interface technology as well as Google Web Toolkit, JSP and many others. When you add new High-Level Generator and you haven’t entered the dependencies that it needs, the tool automatically adds the others Generators so the final generated code can compile and work.
This feature will be incrementally applied to all the generators as I document them in different articles and posts.
Once you have configured your Vaadin Generetor, you can add your domain models from the grids below. I will not describe them again because they are simple tables with some properties – they are screenshot in my previous post.
After you save everything and click Generate, you can refresh your Eclipse Project and you should see the newly generated stuff.
After that you’ll probably need to:
- Make the necessary changes to the database if needed (external to the IDE or the code)
- Include the required JDBC driver / connector (the popular ones can be added automatically from maven repositories)
- Edit your entry point class by adding the ListComponent:
layout.addComponents(name, button, new TestListComponent());
The result is a grid with paging functionality and an add or edit form: