Mercurial > hg > release > thermostat-1.4
changeset 1763:6a3aa751cd82
Make cancel button in setup gui indicate failure
Reviewed-by: omajid, jerboaa
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-August/015564.html
PR2581
author | Anirudhan Mukundan <amukunda@redhat.com> |
---|---|
date | Fri, 28 Aug 2015 09:59:28 -0400 |
parents | 1cdd3119a7b9 |
children | 8e0d3c92f621 |
files | setup/command/src/main/java/com/redhat/thermostat/setup/command/internal/SetupWindow.java setup/command/src/main/java/com/redhat/thermostat/setup/command/locale/LocaleResources.java setup/command/src/main/resources/com/redhat/thermostat/setup/locale/strings.properties |
diffstat | 3 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/setup/command/src/main/java/com/redhat/thermostat/setup/command/internal/SetupWindow.java Thu Aug 27 15:03:16 2015 +0200 +++ b/setup/command/src/main/java/com/redhat/thermostat/setup/command/internal/SetupWindow.java Fri Aug 28 09:59:28 2015 -0400 @@ -76,6 +76,7 @@ private String storageUsername = null; private char[] storagePassword = null; private boolean showDetailedBlurb = false; + private boolean setupCancelled = false; private final ThermostatSetup thermostatSetup; private SwingWorker<IOException, Void> finishAction; @@ -116,6 +117,9 @@ logger.log(Level.INFO, "Setup failed.", finishException); throw new CommandException(translator.localize(LocaleResources.SETUP_FAILED), finishException); } + } else if (setupCancelled) { + logger.log(Level.INFO, "Setup was cancelled."); + throw new CommandException(translator.localize(LocaleResources.SETUP_CANCELLED)); } } catch (InterruptedException | ExecutionException e) { throw new CommandException(translator.localize(LocaleResources.SETUP_INTERRUPTED), e); @@ -180,12 +184,6 @@ showView(mongoUserSetupView); } }); - startView.getCancelBtn().addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - shutdown(); - } - }); startView.getShowMoreInfoBtn().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { @@ -224,24 +222,23 @@ } } }); - mongoUserSetupView.getCancelBtn().addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - shutdown(); - } - }); userPropertiesView.getFinishBtn().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { runSetup(); } }); - userPropertiesView.getCancelBtn().addActionListener(new ActionListener() { + + ActionListener cancelButtonListener = new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { + setupCancelled = true; shutdown(); } - }); + }; + startView.getCancelBtn().addActionListener(cancelButtonListener); + mongoUserSetupView.getCancelBtn().addActionListener(cancelButtonListener); + userPropertiesView.getCancelBtn().addActionListener(cancelButtonListener); } private void setLargeFrame(boolean setLarge) {
--- a/setup/command/src/main/java/com/redhat/thermostat/setup/command/locale/LocaleResources.java Thu Aug 27 15:03:16 2015 +0200 +++ b/setup/command/src/main/java/com/redhat/thermostat/setup/command/locale/LocaleResources.java Fri Aug 28 09:59:28 2015 -0400 @@ -59,6 +59,7 @@ SERVICE_UNAVAILABLE_MESSAGE, SETUP_FAILED, SETUP_INTERRUPTED, + SETUP_CANCELLED, ; static final String RESOURCE_BUNDLE =
--- a/setup/command/src/main/resources/com/redhat/thermostat/setup/locale/strings.properties Thu Aug 27 15:03:16 2015 +0200 +++ b/setup/command/src/main/resources/com/redhat/thermostat/setup/locale/strings.properties Fri Aug 28 09:59:28 2015 -0400 @@ -68,3 +68,5 @@ SETUP_FAILED=Setup failed. SETUP_INTERRUPTED=Setup was interrupted. + +SETUP_CANCELLED=Setup was cancelled.