Example usage for com.vaadin.ui TabSheet removeListener

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

Introduction

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

Prototype

@Override
    @Deprecated
    public void removeListener(Component.Listener listener) 

Source Link

Usage

From source file:org.openeos.services.ui.vaadin.internal.OpenWindowCommand.java

License:Apache License

@Override
public void menuSelected(MenuItem selectedItem) {
    if (windowComponent == null)
        windowComponent = windowFactory.createWindowComponent(window, application);
    final TabSheet tabSheet = application.getConcreteApplication().getMainTabSheet();
    tabSheet.addListener(new ComponentContainer.ComponentDetachListener() {

        private static final long serialVersionUID = 1L;

        @Override/* ww  w  .j  a  v  a 2 s .c o  m*/
        public void componentDetachedFromContainer(ComponentDetachEvent event) {
            if (event.getDetachedComponent() == windowComponent) {
                windowComponent = null;
                tabSheet.removeListener(this);
            }
        }
    });
    Tab tab = tabSheet.addTab(windowComponent, window.getName());
    tab.setClosable(true);
    tab.setDescription(window.getDescription());
    tabSheet.setSelectedTab(tab);
}