Application With Navigator
Example code is available on github.com/vaadin-on-grails/spring-autowiring-navigator.
In this tutorial we will show how to initialize Navigator
and how to implement View
.
The first two steps are the same as for the previous 'Create Simple Application'.
Step 1
We need to say the plugin that we want to do annotation based URL mapping. Comment out mapping from VaadinConfig.groovy
to do that.
Step 2
Now we will create a dummy service ItemService
that we will autowire in Vaadin code.
Step 3
In this step we will do the following things:
Create new UI that extends
DefaulUI
Use
@VaadinUI
annotation to do URL mapping forMyUI
Call
super.init(r)
method that will initialize the navigator
After the point mentioned above are done, we can use Views
class to open a view. Continue to the next step to learn how views are registered using @VaadinUI
annotation.
Step 4
Before we use Views.enter(View)
method we need to tell the pluging where are the views and what is the URL path to them.
Add @VaadinUI
annotation to every view that should be accesible by Views.enter
method.
Step 5
Run the application grails run-app
and open http://localhost:8080/spring-autowiring-navigator in a browser.
Last updated