PDA

View Full Version : Extending TabItem and rendering



dontbugme
25 Jul 2010, 5:41 PM
Hello, I have looked through all the threads and still can't seem to figure out what my problem is. I have a class MyTabItem that extends TabItem. In my MainPanel, I have a TabPanel to which I want to add MyTabItem's. My code looks something like this :



MainPanel.createTab() {
MyTabItem tab = new MyTabItem();
mTabPanel.add(tab);
mTabPanel.setSelection(tab);
}

MyTabItem() {
super("newTab");
generateUI();
}


Now the problem is, when I try to call MainPanel.createTab() a first time, everything gets created nicely, but the second time I call it, the new tab is created and selected, but the inside of my new tab is empty. I checked and the constructor as well as onRender() is called in both cases. Am I not implementing a specific method or am I forgetting to call something?

Thanks

EDIT: Further testing is telling me that the UI might be the cause, so I'll provide some more information on what I think is the cause.



MyTabItem.generateUI() {
mContentPanel = new ContentPanel(new VBoxLayout());
// Add buttons and the such to the content panel
this.add(mContentPanel);
this.layout();
}


Feel free to comment on design as well, first time GWT/GXT user here and not much UI design experience elsewhere either...