GWT-Can all sub widgets under TabPanel be identical?

57 views Asked by At

I am creating a TabPanel with 2 sub widgets in it now. Basically the 2 sub widgets(getGrid1() and getGrid2()) are identical except some user input text validation difference when submitting.

TabPanel tabPanel = new TabPanel();

grid1 = getGrid1();
panel1 = new SimplePanel(grid1);

grid2 = getGrid2();
panel2 = new SimplePanel(grid2);

tabPanel.add(panel1, new HTML("Tab1"));

tabPanel.add(panel2, new HTML("Tab2"));

tabPanel.selectTab(0);

dialogBox.add(tabPanel);

Based on my code, those 2 tab name is visible, but there is no content in the 1st tab, the content in tab 2 is full visible. I also tried to add another sub widget which is also identical to other 2 widgets except some validation difference, only the 3rd widget content is visible.

Any idea of how to deal with it? What I want is having 3 identical widgets under TabPanel except some validation difference.

Thanks!

1

There are 1 answers

0
David Levesque On BEST ANSWER

My guess is that getGrid1() and getGrid2() both return the same instance. Just create different instances and it should work fine.