/** * Close the screen. * <br> If the screen has uncommitted changes in its {@link com.haulmont.cuba.gui.data.DsContext}, * the confirmation dialog will be shown. * <br> Don't override this method in subclasses, use hook {@link AbstractWindow#preClose(String)} * * @param actionId action ID that will be propagated to attached {@link CloseListener}s. * Use {@link #COMMIT_ACTION_ID} if some changes have just been committed, or * {@link #CLOSE_ACTION_ID} otherwise. These constants are recognized by various mechanisms of the * framework. */ @Deprecated default boolean close(String actionId) { OperationResult result = getFrameOwner().close(new StandardCloseAction(actionId)); return result.getStatus() == OperationResult.Status.SUCCESS; }
/** * Close the screen. * <br> If the window has uncommitted changes in its {@link com.haulmont.cuba.gui.data.DsContext}, * and force=false, the confirmation dialog will be shown. * * @param actionId action ID that will be propagated to attached {@link CloseListener}s. * Use {@link #COMMIT_ACTION_ID} if some changes have just been committed, or * {@link #CLOSE_ACTION_ID} otherwise. These constants are recognized by various mechanisms of the * framework. * @param force if true, no confirmation dialog will be shown even if the screen has uncommitted changes */ @Deprecated default boolean close(String actionId, boolean force) { OperationResult result = getFrameOwner().close(new StandardCloseAction(actionId, !force)); return result.getStatus() == OperationResult.Status.SUCCESS; }
protected boolean closeWindowStack(Screens.WindowStack windowStack) { boolean closed = true; for (Screen screen : windowStack.getBreadcrumbs()) { if (isNotCloseable(screen.getWindow()) || isWindowClosePrevented(screen.getWindow(), CloseOriginType.CLOSE_BUTTON)) { closed = false; windowStack.select(); break; } OperationResult closeResult = screen.close(FrameOwner.WINDOW_CLOSE_ACTION); if (closeResult.getStatus() != OperationResult.Status.SUCCESS) { closed = false; windowStack.select(); break; } } return closed; }
protected boolean closeWindowStack(WindowStack windowStack) { boolean closed = true; Collection<Screen> tabScreens = windowStack.getBreadcrumbs(); for (Screen screen : tabScreens) { if (isNotCloseable(screen.getWindow())) { continue; } if (isWindowClosePrevented(screen.getWindow(), CloseOriginType.CLOSE_BUTTON)) { closed = false; // focus tab windowStack.select(); break; } OperationResult closeResult = screen.close(FrameOwner.WINDOW_CLOSE_ACTION); if (closeResult.getStatus() != OperationResult.Status.SUCCESS) { closed = false; // focus tab windowStack.select(); break; } } return closed; }