Example usage for com.vaadin.ui Layout markAsDirtyRecursive

List of usage examples for com.vaadin.ui Layout markAsDirtyRecursive

Introduction

In this page you can find the example usage for com.vaadin.ui Layout markAsDirtyRecursive.

Prototype

public void markAsDirtyRecursive();

Source Link

Document

Causes this connector and all connectors below it to be marked as dirty.

Usage

From source file:com.haulmont.cuba.web.WebWindowManager.java

License:Apache License

protected Component showWindowThisTab(final Window window, final String caption, final String description) {
    getDialogParams().reset();/*from   ww  w .ja va  2s  . c o m*/

    WebAppWorkArea workArea = getConfiguredWorkArea(createWorkAreaContext(window));

    Layout layout;
    if (workArea.getMode() == Mode.TABBED) {
        TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
        layout = (Layout) tabSheet.getSelectedTab();
    } else {
        layout = (Layout) workArea.getSingleWindowContainer().getComponent(0);
    }

    final WindowBreadCrumbs breadCrumbs = tabs.get(layout);
    if (breadCrumbs == null) {
        throw new IllegalStateException("BreadCrumbs not found");
    }

    final Window currentWindow = breadCrumbs.getCurrentWindow();

    Set<Map.Entry<Window, Integer>> set = windows.entrySet();
    boolean pushed = false;
    for (Map.Entry<Window, Integer> entry : set) {
        if (entry.getKey().equals(currentWindow)) {
            windows.remove(currentWindow);
            getStack(breadCrumbs).push(new Pair<>(entry.getKey(), entry.getValue()));
            pushed = true;
            break;
        }
    }
    if (!pushed) {
        getStack(breadCrumbs).push(new Pair<>(currentWindow, null));
    }

    removeFromWindowMap(currentWindow);
    layout.removeComponent(WebComponentsHelper.getComposition(currentWindow));

    final Component component = WebComponentsHelper.getComposition(window);
    component.setSizeFull();
    layout.addComponent(component);

    breadCrumbs.addWindow(window);

    if (workArea.getMode() == Mode.TABBED) {
        TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
        String tabId = tabSheet.getTab(layout);
        String formattedCaption = formatTabCaption(caption, description);
        tabSheet.setTabCaption(tabId, formattedCaption);
        String formattedDescription = formatTabDescription(caption, description);

        if (!Objects.equals(formattedCaption, formattedDescription)) {
            tabSheet.setTabDescription(tabId, formattedDescription);
        } else {
            tabSheet.setTabDescription(tabId, null);
        }

        tabSheet.setTabIcon(tabId, WebComponentsHelper.getIcon(window.getIcon()));

        ContentSwitchMode contentSwitchMode = ContentSwitchMode.valueOf(window.getContentSwitchMode().name());
        tabSheet.setContentSwitchMode(tabId, contentSwitchMode);
    } else {
        layout.markAsDirtyRecursive();
    }

    return layout;
}