diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:35:11 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:35:11 +0000 |
commit | 796197e6f0073b0b868ebfe860ae54f80e6ddb7b (patch) | |
tree | 6efc03d62e9a6de5b095bf77ee269c9238b355f0 /pdf-over-gui/src/main/java | |
parent | 2996df12a0efd57f5b654f5f4deec117cd3b0117 (diff) | |
download | mocca-796197e6f0073b0b868ebfe860ae54f80e6ddb7b.tar.gz mocca-796197e6f0073b0b868ebfe860ae54f80e6ddb7b.tar.bz2 mocca-796197e6f0073b0b868ebfe860ae54f80e6ddb7b.zip |
Show dialog before requesting new TAN
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@396 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java')
3 files changed, 43 insertions, 18 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java index 98f6fe3f..e80d23a3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java @@ -52,7 +52,7 @@ public class MobileBKUState extends State { switch(this.stateMachine.getConfigProvider().getMobileBKUType()) { case A_TRUST: this.status = new ATrustStatus(this.stateMachine.getConfigProvider()); - this.handler = new ATrustHandler(this); + this.handler = new ATrustHandler(this, this.stateMachine.getGUIProvider().getMainShell()); break; case IAIK: @@ -204,6 +204,7 @@ public class MobileBKUState extends State { new PostSLRequestThread(this)); postSLRequestThread.start(); break; + case POST_NUMBER: // Check if number and password is set ... // if not show UI @@ -269,6 +270,7 @@ public class MobileBKUState extends State { } } break; + case POST_TAN: // Get TAN from UI @@ -303,11 +305,15 @@ public class MobileBKUState extends State { tan.enableButton(); this.stateMachine.getGUIProvider().display(tan); } - break; + case FINAL: this.setNextState(new SigningState(this.stateMachine)); break; + + case CANCEL: + this.setNextState(new BKUSelectionState(this.stateMachine)); + break; } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java index dcab0641..0ce95c4e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java @@ -21,9 +21,16 @@ import java.io.IOException; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.protocol.Protocol; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.controls.Dialog; +import at.asit.pdfover.gui.controls.Dialog.BUTTONS; +import at.asit.pdfover.gui.controls.Dialog.ICON; +import at.asit.pdfover.gui.utils.Messages; import at.asit.pdfover.gui.workflow.states.LocalBKUState; import at.asit.pdfover.gui.workflow.states.MobileBKUState; import at.asit.pdfover.signator.SLResponse; @@ -32,11 +39,15 @@ import at.asit.pdfover.signator.SLResponse; * A-Trust mobile BKU handler */ public class ATrustHandler extends MobileBKUHandler { + Shell shell; + /** * @param state + * @param shell */ - public ATrustHandler(MobileBKUState state) { + public ATrustHandler(MobileBKUState state, Shell shell) { super(state); + this.shell = shell; } /** @@ -196,8 +207,21 @@ public class ATrustHandler extends MobileBKUHandler { } if (getStatus().getTanTries() <= 0) { - // move to POST_REQUEST - getState().setCommunicationState(MobileBKUCommunicationState.POST_REQUEST); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + Dialog dialog = new Dialog(ATrustHandler.this.shell, Messages.getString("common.warning"), //$NON-NLS-1$ + Messages.getString("mobileBKU.tan_tries_exceeded"), //$NON-NLS-1$ + BUTTONS.OK_CANCEL, ICON.QUESTION); + if (dialog.open() == SWT.CANCEL) { + // Cancel + getState().setCommunicationState(MobileBKUCommunicationState.CANCEL); + } else { + // move to POST_REQUEST again + getState().setCommunicationState(MobileBKUCommunicationState.POST_REQUEST); + } + } + }); } } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUCommunicationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUCommunicationState.java index 339f2db3..de6e777c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUCommunicationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUCommunicationState.java @@ -20,23 +20,18 @@ package at.asit.pdfover.gui.workflow.states.mobilebku; */ public enum MobileBKUCommunicationState { - /** - * POST SL Request to A-Trust BKU - */ + /** POST SL Request to A-Trust BKU */ POST_REQUEST, - /** - * POST User informations (number, password) to A-Trust BKU - */ + /** POST User informations (number, password) to A-Trust BKU */ POST_NUMBER, - /** - * POST tan to A-Trust BKU and retrieve SL Response - */ + /** POST tan to A-Trust BKU and retrieve SL Response */ POST_TAN, - /** - * Final state - */ - FINAL + /** Final state */ + FINAL, + + /** Cancel state */ + CANCEL } |