/*
- * jSite - KeyDialog.java - Copyright © 2010 David Roden
+ * jSite - KeyDialog.java - Copyright © 2010–2012 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/** The text field for the public key. */
private JTextField publicKeyTextField;
+ /** Whether the dialog was cancelled. */
+ private boolean cancelled;
+
/**
* Creates a new key dialog.
*
//
/**
+ * 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
private void createActions() {
okAction = new AbstractAction(I18n.getMessage("jsite.general.ok")) {
- @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionOk();
cancelAction = new AbstractAction(I18n.getMessage("jsite.general.cancel")) {
- @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionCancel();
generateAction = new AbstractAction(I18n.getMessage("jsite.key-dialog.button.generate")) {
- @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionGenerate();
I18nContainer.getInstance().registerRunnable(new Runnable() {
- @Override
public void run() {
keysLabel.setText(I18n.getMessage("jsite.key-dialog.label.keys"));
privateKeyLabel.setText(I18n.getMessage("jsite.key-dialog.label.private-key"));
private void actionOk() {
publicKey = publicKeyTextField.getText();
privateKey = privateKeyTextField.getText();
+ cancelled = false;
setVisible(false);
}
* Quits the dialog, discarding all changes.
*/
private void actionCancel() {
+ cancelled = true;
setVisible(false);
}