I have a TabLayoutPanel that is constantly having tabs added and removed. 
Most of the time, I remove the last tab or two, then add their 
replacements. 

Sometimes, I run into the issue where the deckPanel and tabBar components 
of the TabLayoutPanel get out of sync with each other. This happens if a 
Widget being added to the deckPanel errors out during its onLoad, for 
example, causing the TabLayoutPanel.insert method to drop execution before 
it can add the corresponding tab to tabBar. While exceptions can be caught 
and handled, this state (where deckPanel's size is one larger than 
tabBar's) is essentially unrecoverable and undetectable outside the class. 

Next time I try to remove the last tab, using 
TabLayoutPanel.getWidgetCount() - 1 as the index, I get an IndexOutOfBounds 
exception. I can't check for this condition (since deckPanel and tabBar are 
private and the latter doesn't offer any accessors), and even if I catch 
the IndexOutOfBounds exception and let it drop on the floor, I'm still left 
with a rogue Widget inside the deckPanel (which I still can't remove).

What would really help mitigate the issue is if the order of additions (in 
TabLayoutPanel.insert:736) was the same as order of removal (in 
TabLayoutPanel.remove:550), e.g. either:

deckPanel.insertProtected(child, beforeIndex);
tabs.add(beforeIndex, tab);
...
deckPanel.removeProtected(child);
tabBar.remove(index);

or 

tabs.add(beforeIndex, tab);
deckPanel.insertProtected(child, beforeIndex);
...
tabBar.remove(index);
deckPanel.removeProtected(child); 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to