I have a TabSheet with each tabs containing the components wrapped as per the below code. When I choose a different tab its content is not displayed, however, on browser refresh the corresponding tab’s content is displayed properly.
public class MyRoot extends Root {
@Override
protected void init(WrappedRequest request) {
createTabs();
}
private void createTabs() {
TabSheet t = new TabSheet();
t.setSizeFull();
t.addTab(getDummy("Content A"), "A");
t.addTab(getDummy("Content B"), "B");
t.addTab(getDummy("Content C"), "C");
setContent(t);
}
private AbstractComponent getDummy(String txt) {
Panel panel = new Panel();
VerticalLayout l1 = new VerticalLayout();
Panel panel2 = new Panel();
Label c = new Label(txt);
panel2.addComponent(c);
l1.addComponent(panel2);
panel.setContent(l1);
return panel;
}
}
But if I modify the getDummy method as below then it works fine.
private AbstractComponent getDummy(String txt) {
Panel panel = new Panel();
VerticalLayout l1 = new VerticalLayout();
Label c = new Label(txt);
l1.addComponent(c);
panel.setContent(l1);
return panel;
}
As I need the contents of VerticalLayout to be scrollable I think I will need panel2. Is there any way to deal with this issue?
Thanks!