|| ((ChangeTrackerCloseAction) closeAction).isCheckForUnsavedChanges(); && ((ChangeTrackerCloseAction) closeAction).isCheckForUnsavedChanges() && hasUnsavedChanges()) { Configuration configuration = getBeanLocator().get(Configuration.NAME);
protected void preventUnsavedChanges(BeforeCloseEvent event) { CloseAction action = event.getCloseAction(); if (action instanceof ChangeTrackerCloseAction && ((ChangeTrackerCloseAction) action).isCheckForUnsavedChanges() && hasUnsavedChanges()) { Configuration configuration = getBeanLocator().get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.NAME); UnknownOperationResult result = new UnknownOperationResult(); if (clientConfig.getUseSaveConfirmation()) { screenValidation.showSaveConfirmationDialog(this, action) .onCommit(() -> result.resolveWith(closeWithCommit())) .onDiscard(() -> result.resolveWith(closeWithDiscard())) .onCancel(result::fail); } else { screenValidation.showUnsavedChangesDialog(this, action) .onDiscard(() -> result.resolveWith(closeWithDiscard())) .onCancel(result::fail); } event.preventWindowClose(result); } }