cuba-platform/cuba

Screen caption is not updated in AfterShow when mainTabSheetMode is managed

Flaurite opened this issue · 0 comments

Environment

  • Platform version: 7.2
  • Client type: Web

Description of the bug or enhancement

RU forum discussion: topic;

Steps to reproduce

  1. Add to the web properties: cuba.web.mainTabSheetMode = MANAGED
  2. In any screen subscribe to AfterShowEvent:
@Subscribe
public void onAfterShow(AfterShowEvent event) {
    getWindow().setCaption("New Caption");
}

AR
Caption is no updated

Workaround:

@Subscribe
public void onAfterShow(AfterShowEvent event) {
    updateCaption();
}

protected void updateCaption() {
    com.vaadin.ui.Component parent = getWindow().unwrap(AbstractOrderedLayout.class);
    while (parent != null) {
        if (parent instanceof CubaManagedTabSheet.Tab) {
            ((CubaManagedTabSheet.Tab) parent).setCaption("New caption");
            break;
        }
        parent = parent.getParent();
    }
}