Vaadin Tabsheet change Caption and Icon of Tab

Hello Guys,

we got an application with many Tabs …
I want to change the Caption and Icon of the Tabsheet when i pushing an button.

For that i thought i can use :

this.setCaption("Deaktiviert: "+this.benutzer.getBenutzerId()); this.setIcon(IcoMoon1.USER_TIMES); this.setStyleName("la-red-tab"); While debugging i see that the Object changed its Caption and Icon, but in the Browser no change appears.
So i looked for “Repaint” “Refresh” or something but no results.

I tryed to be clever and use “replaceComponent(this,this)” but then the Code was broken of no attached Fields :smiley:

Is there anyway to change the Caption and Icon of the Tabsheet?
Maybe bin it to an Datasource and Change the Datasource?
(Im confused cause in the
Demo
it works with Tab4)

I’m using 8.0.5 and this simple app works. Does it for you?

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@Theme("valo")
public class MyUI extends UI {

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();

        layout.addComponents(tabsheet());
        setContent(layout);
    }

    private Component tabsheet() {
        TabSheet tabsheet = new TabSheet();
        tabsheet.addTab(new Label("Test"), "Test");
        tabsheet.addTab(new Label("Test 2"), "Test 2");
        Button button = new Button("Change caption", e -> {
            tabsheet.getTab(1).setIcon(VaadinIcons.ABACUS);
            tabsheet.getTab(1).setCaption("Changed");
        });
        return new HorizontalLayout(tabsheet, button);
    }

    @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
    @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
    public static class MyUIServlet extends VaadinServlet {
    }
}