From f80e371ad8592eb2114482be3ebc8c643b4c5684 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Jan 2010 14:07:46 +0100 Subject: [PATCH] Expose whether the dialog was cancelled. --- src/de/todesbaum/jsite/application/KeyDialog.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/de/todesbaum/jsite/application/KeyDialog.java b/src/de/todesbaum/jsite/application/KeyDialog.java index 2e30829..ffe70a3 100644 --- a/src/de/todesbaum/jsite/application/KeyDialog.java +++ b/src/de/todesbaum/jsite/application/KeyDialog.java @@ -81,6 +81,9 @@ public class KeyDialog extends JDialog { /** The text field for the public key. */ private JTextField publicKeyTextField; + /** Whether the dialog was cancelled. */ + private boolean cancelled; + /** * Creates a new key dialog. * @@ -108,6 +111,15 @@ public class KeyDialog extends JDialog { // /** + * Returns whether the dialog was cancelled. + * + * @return {@code true} if the dialog was cancelled, {@code false} otherwise + */ + public boolean wasCancelled() { + return cancelled; + } + + /** * Returns the public key. * * @return The public key @@ -276,6 +288,7 @@ public class KeyDialog extends JDialog { private void actionOk() { publicKey = publicKeyTextField.getText(); privateKey = privateKeyTextField.getText(); + cancelled = false; setVisible(false); } @@ -283,6 +296,7 @@ public class KeyDialog extends JDialog { * Quits the dialog, discarding all changes. */ private void actionCancel() { + cancelled = true; setVisible(false); } -- 2.7.4