Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Update Table Problem in Tabsheet
Hello,
we are thinking about using Vaadin for a Enterprise solution. We've build the main application skeleton
and are testing the usability for our project.
The main application contains a menubar, which lays tabs on a tabsheet when a menu item is selected.
The listener of the menubar calls the lazy getters to get the components which are shown on the tabsheet.
That means if a component has been initialized yet, the application will re-use it.
This works fine, because when a user clicks twice or more on a menuitem the selected component is just shown once, as it has to be.
The tabs are closable and here comes the problem:
If the user closes the tab and reopen it, the data is shown as it was. In our case its a table with information from database.
I've implemented the TabSheet.CloseHandler to manipulate the component, so that it is initialized again (due to the lazy getter) to show correct data
from database. But it doesn't.
Ive tried different ways:
@Override
public void onTabClose(TabSheet tabsheet, Component tabContent) {
//get the tab and try to get rid of the components
Tab currenttab = tabsheet.getTab(tabContent);
tabsheet.removeTab(currenttab);
//remove the component
tabsheet.removeComponent(tabContent);
//set the component to null, so the lazy getter will initialize the component again
tabContent = null;
}
Lazy getter looks like this:
private Component getComponent(){
if(this.component == null){
component = new Component();
}
return this.component;
}
The thing is we'd like to avoid that a user opens a menu item (or the component which is behind the item) several times,
so that there could be a lot of tabs open in the same time.
Thanks in advance
Frederik
The data for the table is coming from the underlying Container-instance. Do you recreate that also?