O'Reilly logo

Vaadin 7 UI Design By Example Beginner's Guide by Alejandro Duarte

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accordions

If you know TabSheet, you already know Accordion. Really, they work exactly the same. To demonstrate this fact, let's take the code in the previous TabSheet example and change the corresponding identifiers to use Accordion instead of TabSheet.

Accordion accordion = new Accordion();
accordion.addTab(new Label("Label 1"), "Tabl 1");
accordion.addTab(new Label("Label 2")).setCaption("Tab 2");
Tab tab = accordion.addTab(new Label("Label 3"));
tab.setCaption("Tab 3");
tab.setClosable(true);

accordion
    .addSelectedTabChangeListener(new SelectedTabChangeListener() {
      public void selectedTabChange(
          SelectedTabChangeEvent event) {
        Notification.show("You are watching "
            + event.getTabSheet().getSelectedTab());
      }
    });

Everything works as expected. You ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required