tabsheet caption randomly not displayed

Hi all,

I’m facing an issue with the tabsheet component.
For the view I’m creating I want to be able to choose and display one of the tab (and only this one) by clicking a Button.
It works almost fine except that sometimes the caption of the tab selected doesn’t show up.

This seems to occur when the view extends VerticalLayout but not when it extends HorizontalLayout.

Here is a little snippet to try it on :

        TabSheet tabsheet = new TabSheet();
        String[] letters = {"A", "B", "C", "D"};
        HashMap<String, Tab> tabMap = new HashMap<String, Tab>();
        
        for (String letter: letters){
            VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.addComponent(new Label(letter+1));
            verticalLayout.addComponent(new Label(letter+2));
            verticalLayout.addComponent(new Label(letter+3));
            
            tabsheet.addTab(verticalLayout);
            tabsheet.getTab(verticalLayout).setCaption("tab"+letter);
            
            tabMap.put("tab"+letter, tabsheet.getTab(verticalLayout));
        }
                       
        ClickListener clickListener = new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                // id of the button is the same as the tab's caption
                String tabName = event.getComponent().getId();

                for (Object key : tabMap.keySet()) {
                    Tab tab = (Tab) tabMap.get(key.toString());

                    if (key.toString().equals(tabName)) {
                        tab.setVisible(true);
                        tabsheet.setSelectedTab(tab.getComponent());
                    } else
                        tab.setVisible(false);
                }

            }
        };
        
        VerticalLayout vLayout = new VerticalLayout();
        for (String letter: letters) {
            Button btntab = new Button("show tab"+letter);
            btntab.setId("tab"+letter);
            btntab.addClickListener(clickListener);
            vLayout.addComponent(btntab);
        }
        
        addComponent(vLayout);
        addComponent(tabsheet);

vaadin version 7.3.5
tested with all web browsers

any idea will be appreciated.
thanks.
Matt

Anybody to help me ?

A bug ticket has been opened:
http://dev.vaadin.com/ticket/17333

I haven’t tried your code, but the first thing I’d check is whether the text in your Labels is taking all the available space, instead of the space required only for the text. You could try setSizeUndefined() on the labels to find out.

Hi Steve,
actulally the Labels are well displayed.
The problem is the visibility of the tab’s caption.