I'm looking at Vaadin plugin in Grails at the moment and this is what I'm trying to implement:
I have an UI
class and two View
classes
The UI code has a navigator in it:
class MyUI extends UI {
@Override
protected void init(VaadinRequest vaadinRequest) {
Navigator navigator = new Navigator(this, this)
navigator.addView(MainView.NAME, new MainView())
navigator.addView(CountView.NAME, CountView.class)
}
}
In the MainView there is a Button
and I want the user to be redirected to CountView
after the button is clicked. I added the Button.ClickListener()
, but I can't get hold of the Navigator
instance in the View
to navigate to the desired page.
I'd be grateful if you could provide me an example of this.
You can say
getUI().getNavigator().navigateTo("foobar");
or
UI.getCurrent().getNavigator().navigateTo("foobar");