CloseAction NAVIGATION_CLOSE_ACTION = new StandardCloseAction(NAVIGATION_CLOSE_ACTION_ID);
/** * 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 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)); } } }