summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main
diff options
context:
space:
mode:
authorAndreas Abraham <andreas.abraham@egiz.gv.at>2019-11-04 17:11:52 +0100
committerAndreas Abraham <andreas.abraham@egiz.gv.at>2019-11-04 17:11:52 +0100
commit4c3803be61dab135fbc7892c3feb915113477ef6 (patch)
tree3df2f2742b862224c5df558063ca4dac4b257800 /pdf-over-gui/src/main
parent009afebd8d3b877023a0f348285e78ba28a239e7 (diff)
downloadpdf-over-4c3803be61dab135fbc7892c3feb915113477ef6.tar.gz
pdf-over-4c3803be61dab135fbc7892c3feb915113477ef6.tar.bz2
pdf-over-4c3803be61dab135fbc7892c3feb915113477ef6.zip
cancel button and functionality implemented
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java49
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingForAppComposite.java46
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java4
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties3
4 files changed, 49 insertions, 53 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
index 0835ff40..762b9316 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
@@ -15,10 +15,6 @@
*/
package at.asit.pdfover.gui.bku;
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.commons.httpclient.util.HttpURLConnection;
// Imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -100,6 +96,8 @@ public class MobileBKUConnector implements BkuSlConnector {
ATrustHandler aHandler = (ATrustHandler) handler;
String response = aHandler.postSMSRequest();
aHandler.handleCredentialsResponse(response);
+ } else if (((ATrustStatus) this.state.getStatus()).getErrorMessage().equals("cancel")) { //$NON-NLS-1$
+ throw new SignatureException(new IllegalStateException());
} else {
handler.handlePolling(responseData);
}
@@ -113,9 +111,8 @@ public class MobileBKUConnector implements BkuSlConnector {
} catch (Exception ex) {
log.error("Error in PostCredentialsThread", ex); //$NON-NLS-1$
- this.state.setThreadException(ex);
- this.state.displayError(ex);
- throw new SignatureException(ex);
+ this.state.setThreadException(new IllegalStateException());
+ throw new SignatureException(new IllegalStateException());
}
} while(this.state.getStatus().getErrorMessage() != null);
@@ -145,9 +142,8 @@ public class MobileBKUConnector implements BkuSlConnector {
handler.handleCredentialsResponse(response);
} catch (Exception ex) {
log.error("Error in PostCredentialsThread", ex); //$NON-NLS-1$
- this.state.setThreadException(ex);
- this.state.displayError(ex);
- throw new SignatureException(ex);
+ this.state.setThreadException(new IllegalStateException());
+ throw new SignatureException(new IllegalStateException());
}
} else {
enterTAN = false;
@@ -214,37 +210,6 @@ public class MobileBKUConnector implements BkuSlConnector {
} while (this.state.getStatus().getTanTries() == -2);
return signingState.getSignatureResponse();
- }
-
-
- private void handleSMSTan(MobileBKUHandler handler) throws Exception {
-
- if (handler instanceof ATrustHandler) {
- ((ATrustStatus)this.state.getStatus()).setSmsTan(false);
- ATrustHandler aHandler = (ATrustHandler) handler;
- String response = aHandler.postSMSRequest();
- aHandler.handleCredentialsResponse(response);
- //((ATrustStatus)this.state.getStatus()).setIsAPPTan("sms"); //$NON-NLS-1$
- this.state.checkTAN();
-
- // Post TAN
- try {
- response = aHandler.postTAN();
- log.trace("Response from mobile BKU: " + response); //$NON-NLS-1$
-
- // Now we have received some data lets check it:
- aHandler.handleTANResponse(response);
-
- } catch (Exception ex) {
- log.error("Error in PostTanThread", ex); //$NON-NLS-1$
- this.state.setThreadException(ex);
- this.state.displayError(ex);
- throw new SignatureException(ex);
- }
- // if everything went fine -> return
- //return signingState.getSignatureResponse();
- }
- }
-
+ }
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingForAppComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingForAppComposite.java
index 14d257bd..921c6c8b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingForAppComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingForAppComposite.java
@@ -36,6 +36,7 @@ import org.eclipse.swt.events.SelectionEvent;
public class WaitingForAppComposite extends StateComposite {
private Label lbl_description;
private Button btn_sms;
+ private Button btn_cancel;
private Boolean isUserSMS = false;
private Boolean userCancel = false;
private Boolean isDone = false;
@@ -44,7 +45,7 @@ public class WaitingForAppComposite extends StateComposite {
* @return the isDone
*/
public Boolean getIsDone() {
- return isDone;
+ return this.isDone;
}
/**
@@ -84,16 +85,42 @@ public class WaitingForAppComposite extends StateComposite {
this.btn_sms = new Button(this, SWT.NONE);
this.btn_sms.addSelectionListener(new SMSSelectionListener());
- FormData fd_btnNewButton = new FormData();
- fd_btnNewButton.bottom = new FormAttachment(100, -26);
- fd_btnNewButton.right = new FormAttachment(100, -40);
- this.btn_sms.setLayoutData(fd_btnNewButton);
+ FormData fd_btnSMS = new FormData();
+ fd_btnSMS.top = new FormAttachment(progressBar, 24);
+ fd_btnSMS.right = new FormAttachment(progressBar, 0, SWT.RIGHT);
+ this.btn_sms.setLayoutData(fd_btnSMS);
this.btn_sms.setText(Messages.getString("SMS tan")); //$NON-NLS-1$
+ this.btn_cancel = new Button(this, SWT.NONE);
+ this.btn_cancel.addSelectionListener(new CancelSelectionListener());
+ FormData fd_btnCancel = new FormData();
+ fd_btnCancel.top = new FormAttachment(btn_sms, 0, SWT.TOP);
+ fd_btnCancel.right = new FormAttachment(btn_sms, -6);
+ this.btn_cancel.setLayoutData(fd_btnCancel);
+ this.btn_cancel.setText(Messages.getString("WaitingForAppComposite.btnCancel.text")); //$NON-NLS-1$
+
reloadResources();
}
+ /**
+ *
+ */
+ private final class CancelSelectionListener extends SelectionAdapter {
+ /**
+ * Empty constructor
+ */
+ public CancelSelectionListener() {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ WaitingForAppComposite.this.setUserCancel(true);
+ WaitingForAppComposite.this.btn_cancel.setEnabled(false);
+ WaitingForAppComposite.this.btn_sms.setEnabled(false);
+ }
+ }
+
private final class SMSSelectionListener extends SelectionAdapter {
/**
* Empty constructor
@@ -109,6 +136,7 @@ public class WaitingForAppComposite extends StateComposite {
WaitingForAppComposite.this.setUserSMS(true);
WaitingForAppComposite.this.btn_sms.setEnabled(false);
+ WaitingForAppComposite.this.btn_cancel.setEnabled(false);
}
}
@@ -135,21 +163,23 @@ public class WaitingForAppComposite extends StateComposite {
@Override
public void reloadResources() {
this.lbl_description.setText(Messages.getString("waiting_for_app.message")); //$NON-NLS-1$
- this.btn_sms.setText("SMS tan"); //$NON-NLS-1$
+ this.btn_sms.setText(Messages.getString("tanEnter.SMS")); //$NON-NLS-1$
+ this.btn_cancel.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$
+ this.btn_sms.setText(Messages.getString("tanEnter.SMS")); //$NON-NLS-1$
}
/**
* @return
*/
public boolean getUserCancel() {
- return userCancel;
+ return this.userCancel;
}
/**
* @param b
*/
public void setUserCancel(boolean b) {
- userCancel = b;
+ this.userCancel = b;
}
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 cf107b58..3d98ab5e 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
@@ -446,7 +446,7 @@ public class MobileBKUState extends State {
}
/**
- *
+ * This composite notifies the user to open the signature-app
*/
public void showOpenAppMessageWithSMSandCancel() {
@@ -509,7 +509,7 @@ public class MobileBKUState extends State {
waitingForAppcomposite.setIsDone(false);
// show waiting composite
- getStateMachine().getGUIProvider().display(MobileBKUState.this.getWaitingComposite());
+ //getStateMachine().getGUIProvider().display(MobileBKUState.this.getWaitingComposite());
}
});
}
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
index 7d6b625f..a368693d 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
@@ -1,11 +1,12 @@
#Eclipse messages class
-#Wed Oct 30 13:33:54 CET 2019
+#Mon Nov 04 16:17:29 CET 2019
BKU.KS=Keystore
BKU.LOCAL=Local CCE
BKU.MOBILE=Mobile CCE
BKU.NONE=no default
BKUSelectionComposite.btnMobile.text=MOBILE
TrustedSocketFactory.FailedToCreateSecureConnection=Failed to create secure network connection
+WaitingForAppComposite.btnCancel.text=Cancel
WaitingForAppComposite.btnCancel_1.text=Cancel
WaitingForAppComposite.btnNewButton.text=New Button
WaitingForAppComposite.btnRequestSms.text=Request SMS