CloseAction NAVIGATION_CLOSE_ACTION = new StandardCloseAction(NAVIGATION_CLOSE_ACTION_ID);
protected boolean isCommitCloseAction(CloseAction closeAction) { return (closeAction instanceof StandardCloseAction) && ((StandardCloseAction) closeAction).getActionId().equals(Window.COMMIT_ACTION_ID); } }
protected boolean isCommitCloseAction(CloseAction closeAction) { return (closeAction instanceof StandardCloseAction) && ((StandardCloseAction) closeAction).getActionId().equals(Window.COMMIT_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); }
CloseAction closeAction = event.getCloseAction(); if (closeAction instanceof StandardCloseAction && ((StandardCloseAction) closeAction).getActionId().equals(Window.COMMIT_ACTION_ID)) { actualField.setValue(((ListEditorWindowController) screen).getValue());
/** * 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; }
@Override public void accept(AfterCloseEvent afterCloseEvent) { if (afterCloseEvent.getCloseAction() instanceof StandardCloseAction) { String actionId = ((StandardCloseAction) afterCloseEvent.getCloseAction()).getActionId(); closeListener.windowClosed(actionId); } else { closeListener.windowClosed(UNKNOWN_CLOSE_ACTION_ID); } } }
/** * 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 openLookup(@Nullable Runnable afterLookupSelect) { Screen lookupScreen; if (lookupProvider == null) { lookupScreen = createLookupScreen(afterLookupSelect); } else { lookupScreen = lookupProvider.get(); if (!(LookupScreen.class.isAssignableFrom(lookupScreen.getClass()))) { log.info("Not suitable screen is returned from LookupScreen provider. Default implementation will be used"); lookupScreen = createLookupScreen(afterLookupSelect); } //noinspection unchecked ((LookupScreen<V>) lookupScreen).setSelectHandler(selected -> { handleLookupSelection(selected); if (afterLookupSelect != null) { afterLookupSelect.run(); } }); } lookupScreen.show(); if (afterLookupCloseHandler != null) { lookupScreen.addAfterCloseListener(event -> { String actionId = ((StandardCloseAction) event.getCloseAction()).getActionId(); afterLookupCloseHandler.onClose(event.getScreen().getWindow(), actionId); }); } }
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)); } }
CloseAction closeAction = event.getCloseAction(); if (closeAction instanceof StandardCloseAction) { closeActionId = ((StandardCloseAction) closeAction).getActionId();
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)); } } }
((StandardCloseAction) closeAction).getActionId() : UNKNOWN_CLOSE_ACTION_ID;