diff options
3 files changed, 52 insertions, 12 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index 1f4ef4d1..5f83fd92 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -57,6 +57,10 @@ public class MobileBKUEnterNumberComposite extends StateComposite { private final SelectionListener okListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { + if(!MobileBKUEnterNumberComposite.this.btn_ok.isEnabled()) { + return; + } + try { String number = MobileBKUEnterNumberComposite.this.txt_number .getText(); @@ -75,6 +79,9 @@ public class MobileBKUEnterNumberComposite extends StateComposite { MobileBKUEnterNumberComposite.this.mobilePassword = password; MobileBKUEnterNumberComposite.this.setUserAck(true); + + MobileBKUEnterNumberComposite.this.btn_ok.setEnabled(false); + } catch(InvalidNumberException ex) { log.error("Validating input for Mobile BKU failed!", ex); //$NON-NLS-1$ MobileBKUEnterNumberComposite.this @@ -139,7 +146,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite { private Label lbl_number; - private Button btn_ok; + Button btn_ok; /** * @return the errorMessage @@ -192,8 +199,8 @@ public class MobileBKUEnterNumberComposite extends StateComposite { }); containerComposite.setLayout(new FormLayout()); FormData fd_containerComposite = new FormData(); - fd_containerComposite.top = new FormAttachment(50, -100); - fd_containerComposite.bottom = new FormAttachment(50, 100); + fd_containerComposite.top = new FormAttachment(50, -120); + fd_containerComposite.bottom = new FormAttachment(50, 120); fd_containerComposite.left = new FormAttachment(50, -200); fd_containerComposite.right = new FormAttachment(50, 200); containerComposite.setLayoutData(fd_containerComposite); @@ -278,6 +285,13 @@ public class MobileBKUEnterNumberComposite extends StateComposite { // Disable the check that prevents subclassing of SWT components } + /** + * enables submit button + */ + public void enableButton() { + this.btn_ok.setEnabled(true); + } + /* * (non-Javadoc) * 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 51ea61e7..8ae6aacd 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,6 +63,13 @@ 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(); @@ -81,7 +88,9 @@ public class MobileBKUEnterTANComposite extends StateComposite { MobileBKUEnterTANComposite.this.tan = tan; MobileBKUEnterTANComposite.this.setUserAck(true); + MobileBKUEnterTANComposite.this.btn_ok.setEnabled(false); MobileBKUEnterTANComposite.this.state.updateStateMachine(); + //MobileBKUEnterTANComposite.this.btn_ok.setEnabled(true); } } @@ -124,6 +133,8 @@ public class MobileBKUEnterTANComposite extends StateComposite { private Label lblTan; + Button btn_ok; + /** * @return the userAck */ @@ -166,6 +177,13 @@ public class MobileBKUEnterTANComposite extends StateComposite { public String getRefVal() { return this.refVal; } + + /** + * Enables the submit button + */ + public void enableButton() { + this.btn_ok.setEnabled(true); + } /** * @param refVal @@ -260,8 +278,8 @@ public class MobileBKUEnterTANComposite extends StateComposite { }); containerComposite.setLayout(new FormLayout()); FormData fd_containerComposite = new FormData(); - fd_containerComposite.top = new FormAttachment(50, -100); - fd_containerComposite.bottom = new FormAttachment(50, 100); + fd_containerComposite.top = new FormAttachment(50, -120); + fd_containerComposite.bottom = new FormAttachment(50, 120); fd_containerComposite.left = new FormAttachment(50, -200); fd_containerComposite.right = new FormAttachment(50, 200); containerComposite.setLayoutData(fd_containerComposite); @@ -323,7 +341,9 @@ public class MobileBKUEnterTANComposite extends StateComposite { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN) { - (new OkSelectionListener()).widgetSelected(null); + if(MobileBKUEnterTANComposite.this.btn_ok.isEnabled()) { + (new OkSelectionListener()).widgetSelected(null); + } } } }); @@ -344,13 +364,13 @@ public class MobileBKUEnterTANComposite extends StateComposite { } }); - Button btn_ok = new Button(containerComposite, SWT.NATIVE); + this.btn_ok = new Button(containerComposite, SWT.NATIVE); Link lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE); FormData fd_lnk_data = new FormData(); fd_lnk_data.right = new FormAttachment(100, -20); - fd_lnk_data.bottom = new FormAttachment(btn_ok, -5); + fd_lnk_data.top = new FormAttachment(0, 20); lnk_sig_data.setEnabled(true); lnk_sig_data.setLayoutData(fd_lnk_data); lnk_sig_data.addSelectionListener(new ShowSignatureDataListener()); @@ -360,7 +380,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { this.lblTries = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); FormData fd_lbl_tries = new FormData(); // fd_lbl_tries.left = new FormAttachment(15, 5); - fd_lbl_tries.right = new FormAttachment(btn_ok, -10); + fd_lbl_tries.right = new FormAttachment(this.btn_ok, -10); // fd_lbl_tries.top = new FormAttachment(70, -15); fd_lbl_tries.bottom = new FormAttachment(100, -20); this.lblTries.setLayoutData(fd_lbl_tries); @@ -371,9 +391,9 @@ public class MobileBKUEnterTANComposite extends StateComposite { //fd_btn_ok.left = new FormAttachment(100, -70); fd_btn_ok.bottom = new FormAttachment(100, -20); - btn_ok.setLayoutData(fd_btn_ok); - btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$ - btn_ok.addSelectionListener(new OkSelectionListener()); + this.btn_ok.setLayoutData(fd_btn_ok); + this.btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$ + this.btn_ok.addSelectionListener(new OkSelectionListener()); } 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 4b7a3f3e..671c670b 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 @@ -261,6 +261,7 @@ public class MobileBKUState extends State { // set possible password ui.setMobilePassword(mobileStatus.getMobilePassword()); } + ui.enableButton(); this.stateMachine.getGUIProvider().display(ui); } } @@ -277,6 +278,10 @@ public class MobileBKUState extends State { mobileStatus.setTan(tan.getTan()); + // show waiting composite + this.stateMachine.getGUIProvider().display( + this.getWaitingComposite()); + // post to BKU! Thread postTanThread = new Thread(new PostTanThread(this)); postTanThread.start(); @@ -292,6 +297,7 @@ public class MobileBKUState extends State { tan.setTries(mobileStatus.getTanTries()); } + tan.enableButton(); this.stateMachine.getGUIProvider().display(tan); } |