Search in sources :

Example 6 with Screens

use of io.jmix.ui.Screens in project jmix by jmix-framework.

the class LocalizedTaskWrapper method done.

@Override
public void done(V result) {
    Screens screens = getScreenContext().getScreens();
    screens.remove(screen);
    try {
        wrappedTask.done(result);
    } catch (Exception ex) {
        // we should show exception messages immediately
        showExecutionError(ex);
    }
}
Also used : Screens(io.jmix.ui.Screens)

Example 7 with Screens

use of io.jmix.ui.Screens in project jmix by jmix-framework.

the class CubaScreensEventListener method saveScreenSettings.

public void saveScreenSettings(Screens screens) {
    Screens.OpenedScreens openedScreens = screens.getOpenedScreens();
    Screen rootScreen = openedScreens.getRootScreen();
    if (rootScreen instanceof CubaLegacySettings) {
        ((CubaLegacySettings) rootScreen).saveSettings();
    }
    for (Screen screen : openedScreens.getWorkAreaScreens()) {
        if (screen instanceof CubaLegacySettings) {
            ((CubaLegacySettings) screen).saveSettings();
        }
    }
    for (Screen screen : openedScreens.getDialogScreens()) {
        if (screen instanceof CubaLegacySettings) {
            ((CubaLegacySettings) screen).saveSettings();
        }
    }
}
Also used : Screen(io.jmix.ui.screen.Screen) CubaLegacySettings(com.haulmont.cuba.settings.CubaLegacySettings) Screens(io.jmix.ui.Screens)

Example 8 with Screens

use of io.jmix.ui.Screens in project jmix by jmix-framework.

the class EditorScreenShowEntityInfoAction method execute.

@Override
public void execute(Screen screen) {
    if (!(screen instanceof EditorScreen)) {
        throw new IllegalArgumentException("Screen must be instance of EditorScreen");
    }
    Object entity = ((EditorScreen<?>) screen).getEditedEntity();
    Screens screens = UiControllerUtils.getScreenContext(screen).getScreens();
    EntityInfoWindow infoWindow = screens.create(EntityInfoWindow.class);
    infoWindow.setEntity(entity);
    infoWindow.show();
}
Also used : EntityInfoWindow(io.jmix.datatoolsui.screen.entityinfo.EntityInfoWindow) EditorScreen(io.jmix.ui.screen.EditorScreen) Screens(io.jmix.ui.Screens)

Example 9 with Screens

use of io.jmix.ui.Screens in project jmix by jmix-framework.

the class ShowEntityInfoAction method showInfo.

public void showInfo(Object entity, Component.BelongToFrame component) {
    Screens screens = ComponentsHelper.getScreenContext(component).getScreens();
    EntityInfoWindow screen = screens.create(EntityInfoWindow.class);
    screen.setEntity(entity);
    screen.show();
}
Also used : EntityInfoWindow(io.jmix.datatoolsui.screen.entityinfo.EntityInfoWindow) Screens(io.jmix.ui.Screens)

Example 10 with Screens

use of io.jmix.ui.Screens in project jmix by jmix-framework.

the class BackgroundWorkWindow method show.

/**
 * Show modal window with message which will last until task completes.
 * Optionally cancel button can be displayed. By pressing cancel button user can cancel task execution.
 *
 * @param task          background task containing long operation
 * @param title         window title, optional
 * @param message       window message, optional
 * @param cancelAllowed show or not cancel button
 * @param <T>           task progress unit
 * @param <V>           task result type
 */
public static <T, V> void show(BackgroundTask<T, V> task, @Nullable String title, @Nullable String message, boolean cancelAllowed) {
    if (task.getOwnerScreen() == null) {
        throw new IllegalArgumentException("Task without owner cannot be run");
    }
    Map<String, Object> params = new HashMap<>();
    params.put("task", task);
    params.put("title", title);
    params.put("message", message);
    params.put("cancelAllowed", cancelAllowed);
    Screens screens = UiControllerUtils.getScreenContext(task.getOwnerScreen()).getScreens();
    WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("backgroundWorkWindow");
    ((WindowManager) screens).openWindow(windowInfo, OpenType.DIALOG, params);
}
Also used : WindowConfig(io.jmix.ui.WindowConfig) HashMap(java.util.HashMap) Screens(io.jmix.ui.Screens) WindowInfo(io.jmix.ui.WindowInfo) WindowManager(com.haulmont.cuba.gui.WindowManager)

Aggregations

Screens (io.jmix.ui.Screens)18 FrameOwner (io.jmix.ui.screen.FrameOwner)5 Screen (io.jmix.ui.screen.Screen)4 Notifications (io.jmix.ui.Notifications)3 HashMap (java.util.HashMap)3 WindowManager (com.haulmont.cuba.gui.WindowManager)2 EntityInfoWindow (io.jmix.datatoolsui.screen.entityinfo.EntityInfoWindow)2 WindowConfig (io.jmix.ui.WindowConfig)2 WindowInfo (io.jmix.ui.WindowInfo)2 LayoutAnalyzer (io.jmix.ui.app.core.dev.LayoutAnalyzer)2 LayoutAnalyzerScreen (io.jmix.ui.app.core.dev.LayoutAnalyzerScreen)2 LayoutTip (io.jmix.ui.app.core.dev.LayoutTip)2 io.jmix.ui.component (io.jmix.ui.component)2 ContainerDataUnit (io.jmix.ui.component.data.meta.ContainerDataUnit)2 MapScreenOptions (io.jmix.ui.screen.MapScreenOptions)2 CubaLegacySettings (com.haulmont.cuba.settings.CubaLegacySettings)1 AbstractComponent (com.vaadin.ui.AbstractComponent)1 MenuBar (com.vaadin.ui.MenuBar)1 DevelopmentException (io.jmix.core.DevelopmentException)1 MetaClass (io.jmix.core.metamodel.model.MetaClass)1