/** * Closes the screen with {@link #WINDOW_CLOSE_ACTION} action. * * @return result of close request */ public OperationResult closeWithDefaultAction() { return close(WINDOW_CLOSE_ACTION); }
/** * INTERNAL. Don't call from application code. * * @deprecated Use {@link #getFrameOwner()} and trigger {@link Screen#close(CloseAction)} instead. */ @Deprecated default void closeAndRun(String actionId, Runnable runnable) { getFrameOwner().close(new StandardCloseAction(actionId)) .then(runnable); }
/** * 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 void onCloseWindowButtonClick(@SuppressWarnings("unused") MouseEventDetails meDetails) { Window window = getCurrentWindow(); if (!window.isCloseable()) { return; } if (!isCloseWithCloseButtonPrevented(window)) { window.getFrameOwner() .close(FrameOwner.WINDOW_CLOSE_ACTION); } }
@Override public void actionPerform(Component component) { if (window.getSelectHandler() == null) { // window opened not as Lookup return; } if (!validate()) return; window.getFrameOwner() .close(LookupScreen.LOOKUP_SELECT_CLOSE_ACTION) .then(this::handleSelection); }
@Override public void run() { Window currentWindow = breadCrumbs.getCurrentWindow(); if (!currentWindow.isCloseable()) { return; } if (window != currentWindow) { if (!isWindowClosePrevented(currentWindow, CloseOriginType.BREADCRUMBS)) { currentWindow.getFrameOwner() .close(WINDOW_CLOSE_ACTION) .then(this); } } } };
protected void onCloseButtonClick(CubaWindow.PreCloseEvent preCloseEvent) { preCloseEvent.setPreventClose(true); com.vaadin.ui.Component component = getComponent(); CubaUI ui = (CubaUI) component.getUI(); if (!ui.isAccessibleForUser(component)) { LoggerFactory.getLogger(WebWindow.class) .debug("Ignore close button click because Window is inaccessible for user"); return; } BeforeCloseEvent event = new BeforeCloseEvent(this, CloseOriginType.CLOSE_BUTTON); fireBeforeClose(event); if (!event.isClosePrevented()) { // user has clicked on X getFrameOwner().close(new StandardCloseAction(Window.CLOSE_ACTION_ID)); } }
protected void onCloseShortcutTriggered(Object sender, Object target) { if (this.isCloseable()) { com.vaadin.ui.Component component = getComponent(); CubaUI ui = (CubaUI) component.getUI(); if (!ui.isAccessibleForUser(component)) { LoggerFactory.getLogger(WebWindow.class) .debug("Ignore shortcut action because Window is inaccessible for user"); return; } BeforeCloseEvent event = new BeforeCloseEvent(this, CloseOriginType.SHORTCUT); fireBeforeClose(event); if (!event.isClosePrevented()) { getFrameOwner().close(new StandardCloseAction(Window.CLOSE_ACTION_ID)); } } }
if (previousTab != null) { currentWindow.getFrameOwner() .close(FrameOwner.WINDOW_CLOSE_ACTION) .then(() -> tabSheet.setSelectedTab(previousTab)); } else { currentWindow.getFrameOwner() .close(FrameOwner.WINDOW_CLOSE_ACTION); .close(FrameOwner.WINDOW_CLOSE_ACTION); .close(FrameOwner.WINDOW_CLOSE_ACTION);
@Override public void run() { Window windowToClose = breadCrumbs.getCurrentWindow(); if (windowToClose != null) { if (!getConfiguredWorkArea().isNotCloseable(breadCrumbs.getCurrentWindow()) && !isWindowClosePrevented(windowToClose, CloseOriginType.CLOSE_BUTTON)) { windowToClose.getFrameOwner() .close(WINDOW_CLOSE_ACTION) .then(new TabCloseTask(breadCrumbs)); } } } }
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; }
OperationResult screenCloseResult = lastOpenedScreen .getWindow().getFrameOwner() .close(FrameOwner.WINDOW_CLOSE_ACTION) .then(() -> proceedHistoryBackward(_requestedState));