diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:35:17 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:35:17 +0000 |
commit | 1dd5f46b13d476e5f4e75568bcd54ed5679bb928 (patch) | |
tree | 3c02a52468328b754403ad945f44acbc2b5c70a2 /pdf-over-gui/src | |
parent | 796197e6f0073b0b868ebfe860ae54f80e6ddb7b (diff) | |
download | mocca-1dd5f46b13d476e5f4e75568bcd54ed5679bb928.tar.gz mocca-1dd5f46b13d476e5f4e75568bcd54ed5679bb928.tar.bz2 mocca-1dd5f46b13d476e5f4e75568bcd54ed5679bb928.zip |
Show dialog before requesting new TAN for IAIK mobile sig
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@397 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java | 2 | ||||
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java | 41 |
2 files changed, 30 insertions, 13 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 e80d23a3..23463e6f 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 @@ -57,7 +57,7 @@ public class MobileBKUState extends State { case IAIK: this.status = new IAIKStatus(this.stateMachine.getConfigProvider()); - this.handler = new IAIKHandler(this); + this.handler = new IAIKHandler(this, this.stateMachine.getGUIProvider().getMainShell()); break; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java index c5d38762..b2e81df4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java @@ -25,9 +25,15 @@ import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; 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; @@ -43,12 +49,16 @@ public class IAIKHandler extends MobileBKUHandler { private static final Logger log = LoggerFactory .getLogger(IAIKHandler.class); + Shell shell; + /** * Constructor * @param state the MobileBKUState + * @param shell the Shell */ - public IAIKHandler(MobileBKUState state) { + public IAIKHandler(MobileBKUState state, Shell shell) { super(state); + this.shell = shell; } /* (non-Javadoc) @@ -261,21 +271,28 @@ public class IAIKHandler extends MobileBKUHandler { new SLResponse(responseData, getStatus().getServer(), null, null)); getState().setCommunicationState(MobileBKUCommunicationState.FINAL); } else { - String errorMessage; try { - errorMessage = MobileBKUHelper.extractTag(responseData, + String errorMessage = MobileBKUHelper.extractTag(responseData, ":errorMessage\">", "</span>"); //$NON-NLS-1$ //$NON-NLS-2$ + getStatus().setErrorMessage(errorMessage); } catch (Exception e) { - errorMessage = Messages.getString("error.Unexpected"); //$NON-NLS-1$ - // move to POST_REQUEST - getState().setCommunicationState(MobileBKUCommunicationState.POST_REQUEST); + // Assume that wrong TAN was entered too many times + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + Dialog dialog = new Dialog(IAIKHandler.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); + } + } + }); } - getStatus().setErrorMessage(errorMessage); - -// if (getStatus().getTanTries() <= 0) { -// // move to POST_REQUEST -// getState().setCommunicationState(MobileBKUCommunicationState.POST_REQUEST); -// } } } |