diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-11-04 11:17:46 +0100 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-11-04 11:17:46 +0100 |
commit | ebe6fc151f2ebf63cde3094d4d462d591d35b25d (patch) | |
tree | af5dcb48d4f21e7b1a46e11585428ecfcb6e1312 | |
parent | c9fd54f595c7bcd5097d0ff086e3a42e5d0ddd8c (diff) | |
download | pdf-over-ebe6fc151f2ebf63cde3094d4d462d591d35b25d.tar.gz pdf-over-ebe6fc151f2ebf63cde3094d4d462d591d35b25d.tar.bz2 pdf-over-ebe6fc151f2ebf63cde3094d4d462d591d35b25d.zip |
deduplicate doLayout and onDisplay, they do the same thing (more or less)
17 files changed, 7 insertions, 106 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index e1a843a8..9c73c2e5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -119,14 +119,6 @@ public class BKUSelectionComposite extends StateComposite { } /* (non-Javadoc) - * @see at.asit.pdfover.gui.components.StateComposite#doLayout() - */ - @Override - public void doLayout() { - this.layout(true, true); - } - - /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index 20173ea8..aa757305 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -375,7 +375,7 @@ public class ConfigurationComposite extends StateComposite { * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() */ @Override - public void doLayout() { + public void onDisplay() { Control ctrl = this.compositeStack.topControl; this.containerComposite.layout(true, true); getShell().layout(true, true); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index 2c544366..0bcbdf17 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -270,14 +270,8 @@ public class DataSourceSelectComposite extends StateComposite { private Button btn_open; - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.components.StateComposite#doLayout() - */ @Override - public void doLayout() { - this.layout(true, true); + public void onDisplay() { this.drop_area.layout(true, true); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index e3533271..bb21d4b6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -420,17 +420,6 @@ public class OutputComposite extends StateComposite { } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do - this.layout(true); - } - /** * @return true when linux and java version <= 8 * diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index c2f69501..b4d06546 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -299,17 +299,6 @@ public class PositioningComposite extends StateComposite { }); } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.components.StateComposite#doLayout() - */ - @Override - public void doLayout() { - this.layout(true, true); -// requestFocus(); - } - /** * Translate the signature placeholder position * 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 93a7477b..085f7b71 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 @@ -42,11 +42,7 @@ public abstract class StateComposite extends Composite { this.state = state; } - /** - * Performs layout for all children in composite - * (SWT layout(...) only layouts children no grandchildren!) - */ - public abstract void doLayout(); + public final void doLayout() { this.layout(true,true); this.onDisplay(); } /** * Reloads the localizeable resources diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java index 69b0f2ef..dc18155a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/WaitingComposite.java @@ -62,14 +62,6 @@ public class WaitingComposite extends StateComposite { } /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do here - } - - /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java index 1eaa7d87..54207292 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java @@ -74,6 +74,4 @@ public abstract class ConfigurationCompositeBase extends StateComposite { * @throws Exception */ public abstract void validateSettings(int resumeFrom) throws Exception; - - @Override public final void doLayout() { this.layout(true, true); } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java index a294569f..dfca6c9a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java @@ -6,8 +6,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Link; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.sun.jna.Platform; @@ -20,7 +18,6 @@ import at.asit.pdfover.gui.workflow.states.State; import at.asit.webauthn.WebAuthN; public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { - private static final Logger log = LoggerFactory.getLogger(Fido2ConfigurationComposite.class); private Link lnkInfoText; private Link unsupportedText; 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 2a31ae80..7c02eda0 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 @@ -207,6 +207,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite { } @Override public void onDisplay() { + getShell().setDefaultButton(this.btn_ok); if (this.txt_number.getText().isEmpty()) { this.txt_number.setFocus(); } else { @@ -222,16 +223,6 @@ public class MobileBKUEnterNumberComposite extends StateComposite { } /** - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - getShell().setDefaultButton(this.btn_ok); - } - - /** * @return the mobileNumber */ public String getMobileNumber() { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java index 70fabcc8..a1e90f51 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java @@ -258,8 +258,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { SWTUtils.anchor(lblMessage).right(btn_fido2, -10).bottom(100, -20); } - @Override public void doLayout() { getShell().setDefaultButton(btn_ok); } - @Override public void onDisplay() { txt_tan.setFocus(); } + @Override public void onDisplay() { getShell().setDefaultButton(btn_ok); txt_tan.setFocus(); } /* * (non-Javadoc) 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 48dec801..218416e2 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 @@ -74,8 +74,7 @@ public class MobileBKUFido2Composite extends StateComposite { this.getDisplay().wake(); } }).start(); - } - @Override public void onDisplay() { beginAuthentication(); } + } public MobileBKUFido2Composite(Composite parent, int style, State state) { super(parent, style, state); @@ -121,7 +120,7 @@ public class MobileBKUFido2Composite extends StateComposite { SWTUtils.addSelectionListener(lnk_sigData, (e) -> { SWTUtils.openURL(this.signatureDataURI); }); } - @Override public void doLayout() { getShell().setDefaultButton(this.btn_authenticate); } + @Override public void onDisplay() { getShell().setDefaultButton(this.btn_authenticate); beginAuthentication(); } @Override public void reloadResources() { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java index 9d9e3064..0d6bdefc 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java @@ -163,16 +163,6 @@ public class MobileBKUFingerprintComposite extends StateComposite { /* * (non-Javadoc) * - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do - } - - /* - * (non-Javadoc) - * * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java index b121d420..135bb775 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java @@ -225,16 +225,6 @@ public class MobileBKUQRComposite extends StateComposite { /* * (non-Javadoc) * - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do - } - - /* - * (non-Javadoc) - * * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java index 226c416d..24529452 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java @@ -94,14 +94,6 @@ public class WaitingForAppComposite extends StateComposite { } /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do here - } - - /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() */ @Override 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 1ac40b8f..b5df6ff3 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 @@ -150,7 +150,6 @@ public class StateMachine { */ 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/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java index 2aad12c9..7393f13e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java @@ -34,14 +34,8 @@ import at.asit.pdfover.gui.workflow.config.ConfigurationManager; * */ public class ConfigurationUIState extends State { - /** - * SLF4J Logger instance - **/ - @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(ConfigurationUIState.class); - - private ConfigurationComposite configurationComposite = null; private ConfigurationComposite getConfigurationComposite() { |