From 8e56cd2c9a300f7f9251263d6aceb2b00453324b Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Wed, 3 Dec 2014 18:10:46 +0100 Subject: Add cancel button to Mobile BKU dialogs --- .../gui/composites/MobileBKUEnterTANComposite.java | 53 +++++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.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 28f8b65e..66063a62 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 @@ -92,6 +92,22 @@ public class MobileBKUEnterTANComposite extends StateComposite { } } + /** + * + */ + private final class CancelSelectionListener extends SelectionAdapter { + /** + * Empty constructor + */ + public CancelSelectionListener() { + } + + @Override + public void widgetSelected(SelectionEvent e) { + MobileBKUEnterTANComposite.this.setUserCancel(true); + } + } + /** * SLF4J Logger instance **/ @@ -101,6 +117,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { Text txt_tan; boolean userAck = false; + boolean userCancel = false; private Label lblRefVal; @@ -126,12 +143,11 @@ public class MobileBKUEnterTANComposite extends StateComposite { String tan; private Label lblTries; - private Label lblRefValLabel; - private Label lblTan; Button btn_ok; + Button btn_cancel; /** * @return the userAck @@ -140,6 +156,13 @@ public class MobileBKUEnterTANComposite extends StateComposite { return this.userAck; } + /** + * @return the userCancel + */ + public boolean isUserCancel() { + return this.userCancel; + } + /** * Set how many tries are left * @@ -182,6 +205,14 @@ public class MobileBKUEnterTANComposite extends StateComposite { this.userAck = userAck; } + /** + * @param userCancel + * the userCancel to set + */ + public void setUserCancel(boolean userCancel) { + this.userCancel = userCancel; + } + /** * @return the reference value */ @@ -375,8 +406,6 @@ public class MobileBKUEnterTANComposite extends StateComposite { } }); - 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(); @@ -387,11 +416,14 @@ public class MobileBKUEnterTANComposite extends StateComposite { lnk_sig_data.addSelectionListener(new ShowSignatureDataListener()); lnk_sig_data.setText(Messages.getString("mobileBKU.show")); //$NON-NLS-1$ lnk_sig_data.setToolTipText(Messages.getString("mobileBKU.show_tooltip")); //$NON-NLS-1$ - + + this.btn_ok = new Button(containerComposite, SWT.NATIVE); + this.btn_cancel = new Button(containerComposite, SWT.NATIVE); + 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(this.btn_ok, -10); + fd_lbl_tries.right = new FormAttachment(this.btn_cancel, -10); // fd_lbl_tries.top = new FormAttachment(70, -15); fd_lbl_tries.bottom = new FormAttachment(100, -20); this.lblTries.setLayoutData(fd_lbl_tries); @@ -406,6 +438,15 @@ public class MobileBKUEnterTANComposite extends StateComposite { this.btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$ this.btn_ok.addSelectionListener(new OkSelectionListener()); + FormData fd_btn_cancel = new FormData(); + // fd_btn_cancel.left = new FormAttachment(95, 0); + fd_btn_cancel.right = new FormAttachment(this.btn_ok, -20); + //fd_btn_cancel.left = new FormAttachment(100, -70); + fd_btn_cancel.bottom = new FormAttachment(100, -20); + + this.btn_cancel.setLayoutData(fd_btn_cancel); + this.btn_cancel.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ + this.btn_cancel.addSelectionListener(new CancelSelectionListener()); } @Override -- cgit v1.2.3