Book Image

Vaadin 7 Cookbook

Book Image

Vaadin 7 Cookbook

Overview of this book

Table of Contents (19 chapters)
Vaadin 7 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Binding tabs with a hard URL


If we have an application that works with bigger UI groups, it's nice to separate them with tabs. For example, we want to show different screens for our Contractors, Customers, Employees, and Help pages. The following screenshot shows the initial page of our application. We can see that the Home screen corresponds to the URL.

And if the user clicks on another tab, the URL has changed.

How to do it...

Carry out the following steps to create tabs bound with the URL:

  1. Create a project with the main UI class called, for example, Demo.

    public class Demo extends UI {…}
  2. We create a TabsURL class that extends TabSheet.

    public class TabsURL extends TabSheet{…}
  3. Now we create an array of UI group names.

    private static final String tabNames[] =
      {"Home", "Contractors", "Customers", "Employees", "Help"};
  4. We use these names for creating tabs. We insert the createTabs() method into our TabsURL class. Each tab contains a vertical layout with a big label according to the tab's name.

    private...