TabSheet replacement


TabSheet is buggy in Vaadin 7 and Vaadin Ltd doesn’t seem committed to fixing them (I guess pro account users aren’t voting for TabSheet related bugs - I filed a serious regression ticket weeks ago but it hasn’t even been prioritized), so I was thinking about replacing it with an implementation based on standard components: simple buttons styled as tabs and with a clicklistener that replaces the view underneath (possibly using the Navigator).

Are there any drawbacks or caveats using that approach? If this would work fine then Vaadin doesn’t really need a dedicated TabSheet component.


Even if it is a regression bug, such problems don’t get fixed in 2 weeks while the Vaadin devs are working on 2 maintenance release, one major framework relaease and several major add-on releases. If you want something to get fixed quickly you can download the sources, fix it yourself and submit the patch. An open-source Framework can only work if there is a big community contributing to it.

Btw. i found a workaround for your problem with the Tabsheet and added it to the ticket:
You’re using the overriden attach method in your sample and since Vaadin 7 using the AttachListener is the recommended/better supported way. The documentations are just not up to date yet although they’re working on it.

Hi, I just closed the ticket as worksforme. The bug is in the provided sample code, not in Vaadin core. In addition, using attach or an attach listener to lazily construct TabSheet contents does not work because the children are attached eagerly on the server side. A SelectedTabChangeListener should do the trick, however.

Thanks for spotting the missing call to super.attach()! Since this is easy to forget, maybe template pattern would be better than having to override and call super?

Anyway, I wasn’t expecting a fix in two weeks… just found it strange that the ticket wasn’t even touched (assigned, prioritized, whatever).

We’ll try to be more responsive with regard to “regular” tickets as well - all tickets should deserve at least some sort of feedback. Currently we’re a bit swamped with prioritized tickets and getting 7.2 out, but as the size of the core team grows, hopefully we’ll be able to dedicate someone to take a look at all incoming tickets.

Yes, the template method pattern might be appropriate here. It’s not obviously so, though - because many classes along an inheritance hierarchy want to override the methods and add (instead of replace) logic, any class that expects someone to extend it in turn would need to override the hypothetical “doAttach”/“doDetach” template methods (and remember to call super), and only classes that are “final” (in practice if not in theory) could override the empty attach/detach methods called by doAttach/doDetach. The more complex API might not be worth it, especially given that we now have attach/detach listeners that users (as opposed to extenders) of Vaadin components should prefer.

About your original question: Yes, I strongly recommend using Link components and the Navigator to handle navigation between logically distinct views. TabSheet is not really meant for that purpose although it is often (mis)used like that.