Goal of this example
- Vaadin 6.7.6
- Vaadin Eclipse plugin
Techniques shown in this example
- Vaadin Navigator Addon
- Custom components
- Page refresh
- Book of Vaadin : this is the complete guide to Vaadin
- Vaadin Sampler : this is a sample application the demonstrates all build in components and reskinning possibility of Vaadin
Structure of the example project
This example project uses Hinernate and H2 in memory database. The database is initialized from the test_data.sql file, all this is configured in the persistence.xml.
- Hibernate DAOs are in the org.exampledriven.vaadinexample.dao package
- Vaadin UI components are in org.exampledriven.vaadinexample.ui
Vaadin Form Eclipse pligin
After installing the Vaading Eclipse plugin from Eclipse Marketplace, we have the option to create new Vaadin Projects or Composites using the file / new / other / Vaadin menu option. When creating a new Comosite it will crete a new java file and open the visual editor that allows drag and drop adding visual components to a form :
(sometimes existing Vaadin components are opened as regular java files, in this case the file/open with/Vaading editor menu helps)
Integrating with spring
Both Vaadin and Spring was build around the concept of initializing a main servlet, that takes care of initializing the rest of the application. Luckily spring provides a way to not to have a servlet, just a listener.
By adding the above to web.xml spring can be initialized the usual way.
Vaadin provides a very easy way to create custom components, based on exising components. In the example ChildDetail is a custom components, it is composed of a number of input fields, buttons and the layout. The Vaadin form editor automatically detects components in the projects and adds them to the palette. Couldnt be easier…
There can be situations, when the website needs to synchronize it’s state with the backend. One option is that the server pushes messages to the client, the other and much easier solution is when the webpage refreshes itself. Vaadin provides a built in solution for the latter it is a visual component called progress indicator, and its usage is demonstrated in StockPriceForm.java in the example.
Vaadin Navigator Addon
MainForm.java demonstrates how to use it.