/** * Check before exiting. * 1/ Traverse module to check that no pending changes need to be forwarded * 2/ Traverse asynchronous executor to check that none if them are still alive * @param context * The context. * @return the i18n message to display or null */ protected String checkBeforeExitFrontAction(IActionHandler actionHandler, Map<String, Object> context) { StringBuilder sb = new StringBuilder(); if (hasDirtyModules(actionHandler, context)) { sb.append(getTranslationProvider(context).getTranslation( "module.content.dirty.message", getLocale(context))); } if (hasAliveAsynchronousExecutors(actionHandler, context)) { if (sb.length()>0) { sb.append("<br/>"); } sb.append(getTranslationProvider(context).getTranslation( "asynchronous.tasks.alive.message", getLocale(context))); } return sb.length()==0 ? null : sb.toString(); }
/** * Stops the frontend controller. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { String checkBeforeExitMsg = checkBeforeExitFrontAction(actionHandler, context); if (checkBeforeExitMsg!=null) { checkBeforeExitMsg = "<html>" + checkBeforeExitMsg + "<br><br>" + getTranslationProvider(context).getTranslation("exit.question.message", getLocale(context)) + "</html>"; getController(context).popupYesNo( getSourceComponent(context), getTranslationProvider(context).getTranslation("module.content.dirty.title", getLocale(context)), getIconFactory(context).getQuestionIconImageURL(), checkBeforeExitMsg, actualExitAction, null, context); } else { return actualExitAction.execute(actionHandler, context); } return false; }