Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin Navigator

Amar Nadh
6 years ago Dec 14, 2015 10:02am
Olli Tietäväinen
6 years ago Dec 14, 2015 1:09pm

Hi,

The UI class has the methods setNavigator and getNavigator, which you can use to store and access your Navigator instance. You can get the current UI with the static UI.getCurrent() accessor.

Best regards,

Olli
 

Henri Kerola
6 years ago Dec 15, 2015 12:21am

The first argument in Navigator's constructor defines the UI for Navigator and Navigator registers itself for the UI by calling ui.setNavigator(this). So no need to call ui.setNavigator expiclitly.

Navigator can be accessed from UI by calling ui.getNavigator(), and components have getUI(), which means that when a component is attached to a UI, the following works:

myComponent.getUI().getNavigator().navigateTo("foo");

Or

UI.getCurrent().getNavigator().navigateTo("foo");

-Henri

Amar Nadh
6 years ago Dec 30, 2015 12:42pm