Re-add tab to tabsheet not work?

Hello,
I have an issue with remove and re-add Tab in Vaadin TabSheet:

  • I have a TabSheet, i want to to double-click on the layout to pop-out the Selected Tab as window, and when I close the window, the Tab will be pop-in the TabSheet. So here’s what i’ve done:

this.addListener(new LayoutClickListener() {

            public void layoutClick(LayoutClickEvent event) {
                if (event.getChildComponent() instanceof TabSheet) {
                    if (event.isDoubleClick()) {
                        // Get the selected tab content
                        selectedTab = (VerticalLayout) tabsheet.getSelectedTab();
                        selectedTabCaption = (tabsheet.getTab(selectedTab)).getCaption();
                        
                        tabsheet.removeTab(tabsheet.getTab(selectedTab));
                        
                        tabContent = new Window();
                        tabContent.addComponent(selectedTab);
                       
                        getWindow().addWindow(tabContent);
                        tabContent.addListener(new CloseListener() {

                            public void windowClose(CloseEvent e) {
                                // Re-add to tabsheet when closing window
                                tabsheet.addTab(selectedTab, selectedTabCaption, null).setClosable(true);
                                
                            }
                        });

                    }
                }
            }
        });

But the problem is - when the window open,the selected tab content appears correctly, but when I close the window, the re-added tab shows nothing.

What have I done wrong here? Many thanks!