This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit f3da33f48cb7a95443266024064be9d08ae99ef5 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Aug 20 22:26:51 2014 +0200 fixes #3454: Improve org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler#quitScreen(boolean, boolean, java.lang.String, java.lang.String, javax.swing.Action) --- .../swing/AbstractApplicationUIHandler.java | 77 ++++++++++++---------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/jaxx-application-swing/src/main/java/org/nuiton/jaxx/application/swing/AbstractApplicationUIHandler.java b/jaxx-application-swing/src/main/java/org/nuiton/jaxx/application/swing/AbstractApplicationUIHandler.java index 7eebf6a..93b3cea 100644 --- a/jaxx-application-swing/src/main/java/org/nuiton/jaxx/application/swing/AbstractApplicationUIHandler.java +++ b/jaxx-application-swing/src/main/java/org/nuiton/jaxx/application/swing/AbstractApplicationUIHandler.java @@ -909,53 +909,52 @@ public abstract class AbstractApplicationUIHandler<M, UI extends ApplicationUI<M }); } + /** + * @deprecated since 2.11, use now {@link #quitScreen(boolean, boolean, String, String, Action, boolean)} + */ + @Deprecated protected boolean quitScreen(boolean modelIsValid, boolean modelIsModify, String askGiveUpMessage, String askSaveMessage, Action saveAction) { - boolean result; - - if (!modelIsValid) { - - // model is not valid - // ask user to qui or not - result = askCancelEditBeforeLeaving(askGiveUpMessage); - } else if (modelIsModify) { - - // something is modify ask user what to do - int answer = askSaveBeforeLeaving(askSaveMessage); - switch (answer) { - case JOptionPane.YES_OPTION: - - // ok save - saveAction.actionPerformed(null); - result = true; - break; - case JOptionPane.NO_OPTION: - - // do not save but can still quit the screen (so nothing to do) - result = true; - break; - default: - // do not save and stay here (so nothing to do) - result = false; - - } - } else { - - // model is valid and not modify, can safely quit screen - result = true; - } + boolean result = quitScreen(modelIsValid, + modelIsModify, + askGiveUpMessage, + askSaveMessage, + saveAction, + false); return result; + } + /** + * @deprecated since 2.11, use now {@link #quitScreen(boolean, boolean, String, String, Action, boolean)} + */ + @Deprecated protected boolean quitInternalScreen(boolean modelIsValid, boolean modelIsModify, String askGiveUpMessage, String askSaveMessage, Action saveAction) { + + boolean result = quitScreen(modelIsValid, + modelIsModify, + askGiveUpMessage, + askSaveMessage, + saveAction, + true); + return result; + + } + + protected boolean quitScreen(boolean modelIsValid, + boolean modelIsModify, + String askGiveUpMessage, + String askSaveMessage, + Action saveAction, + boolean runInternal) { boolean result; if (!modelIsValid) { @@ -972,8 +971,16 @@ public abstract class AbstractApplicationUIHandler<M, UI extends ApplicationUI<M case JOptionPane.YES_OPTION: // ok save - ApplicationUIAction uiAction = (ApplicationUIAction) saveAction; - getContext().getActionEngine().runFullInternalAction(uiAction.getLogicAction()); + if (runInternal) { + + ApplicationUIAction uiAction = (ApplicationUIAction) saveAction; + getContext().getActionEngine().runFullInternalAction(uiAction.getLogicAction()); + + } else { + + saveAction.actionPerformed(null); + + } result = true; break; case JOptionPane.NO_OPTION: -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.