Reputation: 99
Does anybody knows how to resolve my issue. I have a TabSheet with 4 tabs. I need, when ever file is uploaded, to redirect the user to the second tab. My code:
//create tabsheet with 4 tabs
private void createTabs() {
TabSheet tabs = new TabSheet();
FirstTab firstTab = new FirstTab();
tabs.addTab(firstTab, "FirstTab");
SecondTab secondTab = new SecondTab();
tabs.addTab(secondTab, "SecondTab");
ThirdTab thirdTab = new ThirdTab();
tabs.addTab(thirdTab, "ThirdTab");
FourthTab fourthTab = new FourthTab();
tabs.addTab(fourthTab, "FourthTab");
vertLayout.addComponent(tabs);
}
//create upload button
private Button uploadButton() {
Button uploadFile = new Button("Upload");
UI.getCurrent().addWindow(new UploadFileWindow());
return uploadFile;
}
Thanks for support!
Upvotes: 0
Views: 72
Reputation: 4774
The Vaadin TabSheet component has a method to set the selected tab.
In your code (after the upload is done) just add:
tabs.setSelectedTab(fourthTab);
Here is the corresponding documentation.
Upvotes: 1