Time for action – navigating programmatically

  1. Our website is ready to include some links on it. We will add links to Page 1 and Page 2 inside the Welcome page.
  2. We want to add links to the Welcome page, so we need to edit Welcome.java. First we need a navigator to navigate to the other pages (we will initialize this navigator instance later):
    public class Welcome extends VerticalLayout implements View {
    
      private Navigator navigator;
    
      // ...
    
    }
  3. We are adding buttons and a button without a click listener is like a heart without a beat (seems to be that writer is getting crazy again). So let's code a listener that calls our navigator:
    public class Welcome extends VerticalLayout implements View {
    
      // ...
    
      public Welcome() {
     ClickListener listener = new ClickListener() ...

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.