From c5c829fea00057499f6818d450f849ac255c2f10 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 3 Nov 2022 14:15:48 +0100 Subject: auto focus username/password field as appropriate --- .../gui/composites/mobilebku/MobileBKUEnterNumberComposite.java | 9 ++++++++- .../gui/composites/mobilebku/MobileBKUFido2Composite.java | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku') 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); -- cgit v1.2.3