Example usage for com.vaadin.ui TabSheet removeAllComponents

List of usage examples for com.vaadin.ui TabSheet removeAllComponents

Introduction

In this page you can find the example usage for com.vaadin.ui TabSheet removeAllComponents.

Prototype

@Override
public void removeAllComponents() 

Source Link

Document

Removes all components from the container.

Usage

From source file:de.catma.ui.visualizer.VisualizationManagerView.java

License:Open Source License

/** 
 * Additional handling for charts because when closing a non active chart,
 * the active chart becomes empty. In addition to the standard behaviour this
 * method removes and reinserts all remaining {@link DistributionChartView}s.
 * /*  www  . ja v  a  2s.c om*/
 * @see de.catma.ui.tabbedview.TabbedView#onTabClose(com.vaadin.ui.TabSheet, com.vaadin.ui.Component)
 */
@Override
public void onTabClose(TabSheet tabsheet, Component tabContent) {
    Iterator<Component> compIter = tabsheet.getComponentIterator();
    HashSet<Component> contents = new HashSet<Component>();
    while (compIter.hasNext()) {
        contents.add(compIter.next());
    }
    boolean hasLeft = (tabsheet.getComponentCount() > 1);

    super.onTabClose(tabsheet, tabContent);

    if (hasLeft) {
        tabsheet.removeAllComponents();
        contents.remove(tabContent);

        for (Component c : contents) {
            addClosableTab((ClosableTab) c, c.toString());
        }

    }
}