Time for action – using navigators
Let's pour some architectural sugar:
- Create a new Vaadin project. We are using navigator as project name.
- Implement a
view
for the Welcome page:public class Welcome extends VerticalLayout implements View { public Welcome() { addComponent(new Label("Welcome")); } @Override public void enter(ViewChangeEvent event) { Notification.show("Showing Welcome page"); } }
- Implement a view for the
Page1
class:public class Page1 extends VerticalLayout implements View { public Page1() { addComponent(new Label("Page 1")); } @Override public void enter(ViewChangeEvent event) { Notification.show("Showing page 1"); } }
- Use the previous
Page1
class to implement aPage2
class. Don't forget to change the label content and the notification ...
Get Vaadin 7 UI Design By Example Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.