Search code examples
javaspringspring-bootviewvaadin8

What is Vaadin UI and how to navigate between UI's


First question: I am trying to create web app using Vaadin 8.3.1 but I am struggling to understand concept of the UI class. I was reading docs but still I can not somehow understand it. I thought that it is just a basic web page which is currently displayed but I am not sure about that definition. So my question is what exactly is UI, how can I navigate between UI's, when to use view and when to use UI ?

Second question: I was reading docs about navigation between views but I was not able to display anything. In UI all we have to do is to setContent and that is it. But what about Views ? How can I display something using views ?

Thanks for any help !


Solution

  • The basic concept of Vaadin is to create single page web applications. The UI class is the root of the dynamic web page, which has changing content, the views. So typical Vaadin application does not consist of multiple UI's, but single one. (It can have many, but I said typical)

    One UI can thus have many views. Usually in main UI you set root content, a main layout that consist of menu and content container (a layout) for Views. When Navigator is setup, it is given that content holder, and then based on navigation Navigator will be placing the views to content area. This is described in detail here:

    https://vaadin.com/docs/v8/framework/advanced/advanced-navigator.html

    Apparently you want to integrate Spring with Vaadin, and for this you need Vaadin Spring add-on. The documentation is here:

    https://vaadin.com/docs/v8/framework/advanced/advanced-spring.html

    To get most out of the documentation, you need example application, which you and inspect and play with. On Vaadin web page, there is full stack functional demo application, which demonstrates application architecture made with Vaadin + Spring.

    https://vaadin.com/start/v8-full-stack-spring