From be87bc6674daeec3a58931775f5b0d7c9cd71709 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:33:57 +0000 Subject: Allow error messages in tan state git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@384 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../gui/composites/MobileBKUEnterTANComposite.java | 19 ++++++++++++++----- .../pdfover/gui/workflow/states/MobileBKUState.java | 4 ++-- .../gui/workflow/states/mobilebku/ATrustHandler.java | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index 8ae6aacd..953a898d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -63,13 +63,10 @@ public class MobileBKUEnterTANComposite extends StateComposite { @Override public void widgetSelected(SelectionEvent e) { - if(!MobileBKUEnterTANComposite.this.btn_ok.getEnabled()) { return; } - - - + String tan = MobileBKUEnterTANComposite.this.txt_tan.getText(); tan = tan.trim(); @@ -152,6 +149,19 @@ public class MobileBKUEnterTANComposite extends StateComposite { String.format(Messages.getString("tanEnter.tries"), tries)); //$NON-NLS-1$ } + /** + * Set an error message + * @param errorMessage the error message + */ + public void setErrorMessage(String errorMessage) { + if (errorMessage == null) + this.lblTries.setText(""); //$NON-NLS-1$ + else + this.lblTries.setText( + Messages.getString("error.Title") + ": " + errorMessage); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** * Sets the message * @@ -423,5 +433,4 @@ public class MobileBKUEnterTANComposite extends StateComposite { .getString("tanEnter.ReferenceValue")); //$NON-NLS-1$ this.lblTan.setText(Messages.getString("tanEnter.TAN")); //$NON-NLS-1$ } - } 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 671c670b..09dc56c2 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 @@ -289,13 +289,13 @@ public class MobileBKUState extends State { } else { tan.setRefVal(mobileStatus.getRefVal()); tan.setSignatureData(mobileStatus.getSignatureDataURL()); - + tan.setErrorMessage(mobileStatus.getErrorMessage()); if (mobileStatus.getTanTries() < mobileStatus.getMaxTanTries() && mobileStatus.getTanTries() > 0) { // show warning message x tries left! + // overrides error message tan.setTries(mobileStatus.getTanTries()); - } tan.enableButton(); this.stateMachine.getGUIProvider().display(tan); 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 64f63b46..dcab0641 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 @@ -178,6 +178,7 @@ public class ATrustHandler extends MobileBKUHandler { */ @Override public void handleTANResponse(String responseData) { + getStatus().setErrorMessage(null); if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl")) { //$NON-NLS-1$ // success !! -- cgit v1.2.3