From 562b38f66da0dbe67f8cff9c02165ca89434d171 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Wed, 31 Jul 2019 17:31:31 +0200 Subject: button implemented where the user can request tan sms during loading spinner wait --- .../gui/composites/WaitingForAppComposite.java | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui') 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 039ddc41..80bfe46c 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 @@ -15,14 +15,18 @@ */ package at.asit.pdfover.gui.composites; + // Imports import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Button; import at.asit.pdfover.gui.utils.Messages; import at.asit.pdfover.gui.workflow.states.State; @@ -32,6 +36,37 @@ import at.asit.pdfover.gui.workflow.states.State; */ public class WaitingForAppComposite extends StateComposite { private Label lbl_description; + private Button btnRequestSms; + private boolean userSms; + + /** + * + */ + private final class SMSSelectionListener extends SelectionAdapter { + /** + * Empty constructor + */ + public SMSSelectionListener() { + } + + @Override + public void widgetSelected(SelectionEvent e) { + if(!WaitingForAppComposite.this.btnRequestSms.getEnabled()) { + return; + } + + WaitingForAppComposite.this.setUserSMS(true); + WaitingForAppComposite.this.btnRequestSms.setEnabled(false); + } + } + + public void setUserSMS(boolean bool ) { + this.userSms = bool; + } + + public boolean getUserSMS() { + return this.userSms; + } /** * Create the composite. @@ -59,6 +94,17 @@ public class WaitingForAppComposite extends StateComposite { fd_progressBar.left = new FormAttachment(50, -100); fd_progressBar.right = new FormAttachment(50, +100); progressBar.setLayoutData(fd_progressBar); + + + this.btnRequestSms = new Button(this, SWT.NONE); + FormData fd_btnRequestSms = new FormData(); + fd_btnRequestSms.top = new FormAttachment(progressBar, 23); + fd_btnRequestSms.right = new FormAttachment(100, -123); + this.btnRequestSms.setLayoutData(fd_btnRequestSms); + this.btnRequestSms.setText(Messages.getString("WaitingForAppComposite.btnRequestSms.text")); //$NON-NLS-1$ + this.btnRequestSms.addSelectionListener(new SMSSelectionListener()); + reloadResources(); + } @Override @@ -80,5 +126,6 @@ public class WaitingForAppComposite extends StateComposite { @Override public void reloadResources() { this.lbl_description.setText(Messages.getString("waiting_for_app.message")); //$NON-NLS-1$ + this.btnRequestSms.setText(Messages.getString("tanEnter.SMS")); //$NON-NLS-1$ } } -- cgit v1.2.3