Search in sources :

Example 1 with ScreenClosedEvent

use of com.haulmont.cuba.gui.screen.event.ScreenClosedEvent in project cuba by cuba-platform.

the class WebScreens method remove.

@Override
public void remove(Screen screen) {
    checkNotNullArgument(screen);
    checkOpened(screen);
    WindowImplementation windowImpl = (WindowImplementation) screen.getWindow();
    if (windowImpl instanceof Disposable) {
        ((Disposable) windowImpl).dispose();
    }
    LaunchMode launchMode = windowImpl.getContext().getLaunchMode();
    if (launchMode instanceof OpenMode) {
        OpenMode openMode = (OpenMode) launchMode;
        switch(openMode) {
            case DIALOG:
                removeDialogWindow(screen);
                break;
            case NEW_TAB:
            case NEW_WINDOW:
                removeNewTabWindow(screen);
                break;
            case ROOT:
                removeRootWindow(screen);
                break;
            case THIS_TAB:
                removeThisTabWindow(screen);
                break;
            default:
                throw new UnsupportedOperationException("Unsupported OpenMode");
        }
    }
    fireEvent(screen, AfterDetachEvent.class, new AfterDetachEvent(screen));
    events.publish(new ScreenClosedEvent(screen));
    afterScreenRemove(screen);
}
Also used : Disposable(com.haulmont.cuba.gui.components.Component.Disposable) WindowImplementation(com.haulmont.cuba.gui.components.sys.WindowImplementation) ScreenClosedEvent(com.haulmont.cuba.gui.screen.event.ScreenClosedEvent)

Aggregations

Disposable (com.haulmont.cuba.gui.components.Component.Disposable)1 WindowImplementation (com.haulmont.cuba.gui.components.sys.WindowImplementation)1 ScreenClosedEvent (com.haulmont.cuba.gui.screen.event.ScreenClosedEvent)1