summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-11-03 14:15:48 +0100
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-11-03 14:15:48 +0100
commitc5c829fea00057499f6818d450f849ac255c2f10 (patch)
tree3d3e0831cb01f59206203490bf8e9b6d2ef55505 /pdf-over-gui/src/main/java/at/asit/pdfover/gui
parent612e0044b3a2529c85e3f2b0224f43c7590b5898 (diff)
downloadpdf-over-c5c829fea00057499f6818d450f849ac255c2f10.tar.gz
pdf-over-c5c829fea00057499f6818d450f849ac255c2f10.tar.bz2
pdf-over-c5c829fea00057499f6818d450f849ac255c2f10.zip
auto focus username/password field as appropriate
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java1
5 files changed, 17 insertions, 3 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java
index 833669ff..2a340fa8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java
@@ -52,4 +52,9 @@ public abstract class StateComposite extends Composite {
* Reloads the localizeable resources
*/
public abstract void reloadResources();
+
+ /**
+ * Called when the control is .display()ed
+ */
+ public void onDisplay() {}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java
index b7d70167..38335c83 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java
@@ -206,6 +206,14 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
SWTUtils.anchor(btn_remember).right(100, -10).top(0, 5);
}
+ @Override public void onDisplay() {
+ if (this.txt_number.getText().isEmpty()) {
+ this.txt_number.setFocus();
+ } else {
+ this.txt_password.setFocus();
+ }
+ }
+
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
@@ -244,7 +252,6 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
if (this.mobileNumber != null && !this.mobileNumber.isEmpty()) {
this.txt_number.setText(this.mobileNumber);
- this.txt_password.setFocus();
} else {
this.txt_number.setText("");
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java
index 70439527..89dc431d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java
@@ -66,6 +66,7 @@ public class MobileBKUFido2Composite extends StateComposite {
}
}).start();
}
+ @Override public void onDisplay() { beginAuthentication(); }
public MobileBKUFido2Composite(Composite parent, int style, State state) {
super(parent, style, state);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
index 3cbf28f9..1ac40b8f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow;
+import at.asit.pdfover.gui.composites.StateComposite;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.commons.Messages;
@@ -147,8 +148,9 @@ public class StateMachine {
* at.asit.pdfover.gui.workflow.StateMachine#display(org.eclipse.swt.widgets
* .Composite)
*/
- public void display(Composite composite) {
+ public void display(StateComposite composite) {
this.mainWindow.setTopControl(composite);
+ composite.onDisplay();
}
private void createMainWindow() {
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 d615d710..4ddededf 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
@@ -563,7 +563,6 @@ public class MobileBKUState extends State {
// TODO signature data, sms tan support
getStateMachine().display(fido2);
- fido2.beginAuthentication();
Display display = fido2.getDisplay();
while (!fido2.isDone()) {