Search in sources :

Example 81 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class ScreensImpl method getConfiguredWorkArea.

/**
 * @return workarea instance of the root screen
 * @throws IllegalStateException if there is no root screen or root screen does not have {@link AppWorkArea}
 */
public AppWorkAreaImpl getConfiguredWorkArea() {
    RootWindow topLevelWindow = ui.getTopLevelWindow();
    if (topLevelWindow == null) {
        throw new IllegalStateException("There is no root screen opened");
    }
    Screen controller = topLevelWindow.getFrameOwner();
    if (controller instanceof HasWorkArea) {
        AppWorkArea workArea = ((HasWorkArea) controller).getWorkArea();
        if (workArea instanceof AppWorkAreaImpl) {
            return (AppWorkAreaImpl) workArea;
        }
    }
    throw new IllegalStateException("RootWindow does not have any configured work area");
}
Also used : HasWorkArea(io.jmix.ui.component.Window.HasWorkArea) AppWorkAreaImpl(io.jmix.ui.component.impl.AppWorkAreaImpl) Screen(io.jmix.ui.screen.Screen)

Example 82 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class ScreensImpl method removeAll.

@Override
public void removeAll() {
    List<Screen> dialogScreens = getDialogScreensStream().collect(Collectors.toList());
    for (Screen dialogScreen : dialogScreens) {
        remove(dialogScreen);
    }
    AppWorkArea workArea = getConfiguredWorkAreaOrNull();
    if (workArea instanceof AppWorkAreaImpl) {
        Collection<WindowStack> workAreaStacks = getWorkAreaStacks((AppWorkAreaImpl) workArea);
        for (WindowStack workAreaStack : workAreaStacks) {
            Collection<Screen> tabScreens = workAreaStack.getBreadcrumbs();
            for (Screen screen : tabScreens) {
                remove(screen);
            }
        }
    }
}
Also used : AppWorkAreaImpl(io.jmix.ui.component.impl.AppWorkAreaImpl) Screen(io.jmix.ui.screen.Screen)

Aggregations

Screen (io.jmix.ui.screen.Screen)82 EditorScreen (io.jmix.ui.screen.EditorScreen)20 LookupScreen (io.jmix.ui.screen.LookupScreen)15 MapScreenOptions (io.jmix.ui.screen.MapScreenOptions)11 Nullable (javax.annotation.Nullable)9 Messages (io.jmix.core.Messages)6 WindowImpl (io.jmix.ui.component.impl.WindowImpl)6 Screens (io.jmix.ui.Screens)5 io.jmix.ui.component (io.jmix.ui.component)5 NavigationState (io.jmix.ui.navigation.NavigationState)5 FrameOwner (io.jmix.ui.screen.FrameOwner)5 UiControllerUtils (io.jmix.ui.screen.UiControllerUtils)5 java.util (java.util)5 Collectors (java.util.stream.Collectors)5 LoggerFactory (org.slf4j.LoggerFactory)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 LegacyFrame (com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)4 ScreenEditorWrapper (com.haulmont.cuba.gui.screen.compatibility.ScreenEditorWrapper)4 MetaClass (io.jmix.core.metamodel.model.MetaClass)4 BaseAction (io.jmix.ui.action.BaseAction)4