Proper way to switch UI ?

I have two UIs (NavigationUI and FullScreenDisplayUI). They are defined through @SpringUI as mapped to /app and /display respectively. The navigation enables the user to pick amongst several full screen public information displays.

Is the only way to go from my interactive app to the full screen display the following kludge –

UI.getCurrent().getPage().setLocation("/display"); I’m looking for a way out of needing to know the URI mapping… I would have expected a “setUI()” of some sort

Jean,

The UI is the root component for an entire Vaadin application. Each UI is unaware of the existence of others. You could always use
Link
objects for navigation in your current architecture, and perhaps use
@SpringUI(“”)
instead of
@SpringUI(“/app”)
to move your
NavigationUI
class up in the URL hierarchy so that spring will map the servlet root to your navigation page.

However, I think the issue here is the architecture of your application. For a multi-view app, the Vaadin tool of choice is

Navigator

. The approach would be to have a single UI class that would be above the navigation screen and the public information displays. With that, you would use a
.navigateTo(“viewName”)
call from anywhere in the app. You would have to refactor your code a little, as you would need to move your UI init() methods into object constructors of new component classes that implement the
View
interface. I’m happy to explain in more detail if that’s an avenue you are interested in exploring.