diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 11:29:46 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 11:29:46 +0200 |
commit | 5555d3c73c2b4b9e1f9341be9053dde91a02af6a (patch) | |
tree | b2713353e9a988fae8ef14f94552effa4694ddd9 /pdf-over-gui/src/main/java/at/asit/pdfover/gui | |
parent | bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8 (diff) | |
download | pdf-over-5555d3c73c2b4b9e1f9341be9053dde91a02af6a.tar.gz pdf-over-5555d3c73c2b4b9e1f9341be9053dde91a02af6a.tar.bz2 pdf-over-5555d3c73c2b4b9e1f9341be9053dde91a02af6a.zip |
get rid of duplicate ConfigurationProviderImpl in ConfigurationComposite(Base)
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui')
7 files changed, 23 insertions, 54 deletions
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 33f19845..dd40bb83 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 @@ -42,9 +42,8 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.exceptions.ResumableException; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.PDFSigner; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; /** @@ -64,14 +63,9 @@ public class ConfigurationComposite extends StateComposite { .getLogger(ConfigurationComposite.class); /** - * configuration manipulator - */ - ConfigManipulator configManipulator = null; - - /** * configuration provider */ - PersistentConfigProvider configProvider = null; + ConfigProviderImpl configProvider = null; /** * simple configuration composite @@ -311,20 +305,11 @@ public class ConfigurationComposite extends StateComposite { } /** - * Sets the configuration manipulator - * - * @param manipulator - */ - public void setConfigManipulator(ConfigManipulator manipulator) { - this.configManipulator = manipulator; - } - - /** * Sets the configuration provider * * @param provider */ - public void setConfigProvider(PersistentConfigProvider provider) { + public void setConfigProvider(ConfigProviderImpl provider) { this.configProvider = provider; if (this.configProvider != null) { // Initialize Configuration Container @@ -443,20 +428,17 @@ public class ConfigurationComposite extends StateComposite { } // Write current Configuration - this.simpleConfigComposite.storeConfiguration( - this.configManipulator, this.configProvider); - this.advancedConfigComposite.storeConfiguration( - this.configManipulator, this.configProvider); + this.simpleConfigComposite.storeConfiguration(this.configProvider); + this.advancedConfigComposite.storeConfiguration(this.configProvider); if (this.keystoreConfigComposite != null) - this.keystoreConfigComposite.storeConfiguration( - this.configManipulator, this.configProvider); + this.keystoreConfigComposite.storeConfiguration(this.configProvider); status = false; redo = false; do { // Save current config to file try { - this.configManipulator.saveCurrentConfiguration(); + this.configProvider.saveCurrentConfiguration(); redo = false; status = true; } catch (IOException e) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java index 713fa3a8..6377a548 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java @@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; public class AboutComposite extends ConfigurationCompositeBase { @@ -144,7 +144,7 @@ public class AboutComposite extends ConfigurationCompositeBase { public void loadConfiguration() {} @Override - public void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider) {} + public void storeConfiguration(ConfigProviderImpl store) {} @Override public void validateSettings(int resumeFrom) throws Exception {} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java index 0a405d3a..f8e8eb5a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java @@ -53,7 +53,7 @@ import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.exceptions.InvalidPortException; import at.asit.pdfover.gui.exceptions.OutputfolderDoesntExistException; import at.asit.pdfover.gui.exceptions.OutputfolderNotADirectoryException; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; @@ -746,16 +746,8 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { } } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration( - * at.asit.pdfover.gui.workflow.config.ConfigManipulator, - * at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) - */ @Override - public void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider) { + public void storeConfiguration(ConfigProviderImpl store) { store.setDefaultSignaturePosition(this.configurationContainer.defaultSignaturePosition); store.setUseMarker(this.configurationContainer.getUseMarker()); store.setUseSignatureFields(this.configurationContainer.getUseSignatureFields()); @@ -774,7 +766,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); - String hostOld = provider.getProxyHostPersistent(); + String hostOld = store.getProxyHostPersistent(); String hostNew = this.configurationContainer.proxyHost; if (hostOld != null && !hostOld.isEmpty() && (hostNew == null || hostNew.isEmpty())) { // Proxy has been removed, let's clear the system properties @@ -784,7 +776,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { } store.setProxyHost(hostNew); - int portOld = provider.getProxyPortPersistent(); + int portOld = store.getProxyPortPersistent(); int portNew = this.configurationContainer.getProxyPort(); if (portOld != -1 && portNew == -1) { // cf. above @@ -793,7 +785,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { } store.setProxyPort(portNew); - String userOld = provider.getProxyUserPersistent(); + String userOld = store.getProxyUserPersistent(); String userNew = this.configurationContainer.proxyUser; if (userOld != null && !userOld.isEmpty() && (userNew == null || userNew.isEmpty())) { // cf. above @@ -802,7 +794,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { } store.setProxyUser(userNew); - String passOld = provider.getProxyPassPersistent(); + String passOld = store.getProxyPassPersistent(); String passNew = this.configurationContainer.proxyPass; if (passOld != null && passNew == null) { // cf. above 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 5dfee07b..2c871e3e 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 @@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.Composite; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.workflow.PDFSigner; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; @@ -83,11 +83,10 @@ public abstract class ConfigurationCompositeBase extends StateComposite { public abstract void loadConfiguration(); /** - * Store configuration from ConfigurationContainer to ConfigManipulator - * @param store the ConfigManipulator to store config to - * @param provider the PersistentConfigProvider containing the old config + * Store configuration from ConfigurationContainer to ConfigProvider + * @param store the ConfigProvider to store config to */ - public abstract void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider); + public abstract void storeConfiguration(ConfigProviderImpl store); /** * Called before exit. diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java index 4e4694da..dba585fa 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java @@ -55,7 +55,7 @@ import at.asit.pdfover.gui.exceptions.KeystoreAliasNoKeyException; import at.asit.pdfover.gui.exceptions.KeystoreDoesntExistException; import at.asit.pdfover.gui.exceptions.KeystoreKeyPasswordException; import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; @@ -422,8 +422,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration(at.asit.pdfover.gui.workflow.config.ConfigManipulator, at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) */ @Override - public void storeConfiguration(ConfigManipulator store, - PersistentConfigProvider provider) { + public void storeConfiguration(ConfigProviderImpl store) { ConfigurationContainer config = this.configurationContainer; store.setKeyStoreFile(config.keystoreFile); store.setKeyStoreType(config.keystoreType); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index b6a9edf0..49a9260f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -63,7 +63,7 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.utils.ImageConverter; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; @@ -673,14 +673,12 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration(at.asit.pdfover.gui.workflow.config.ConfigManipulator, at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) */ @Override - public void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider) { + public void storeConfiguration(ConfigProviderImpl store) { store.setDefaultMobileNumber(this.configurationContainer.getMobileNumber()); store.setDefaultEmblem(this.configurationContainer.getEmblem()); store.setSignatureLocale(this.configurationContainer.signatureLocale); store.setSignatureNote(this.configurationContainer.signatureNote); store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); - - } /* 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 1e02893a..4f32715b 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 @@ -45,7 +45,6 @@ public class ConfigurationUIState extends State { if (this.configurationComposite == null) { this.configurationComposite = getStateMachine().createComposite(ConfigurationComposite.class, SWT.RESIZE, this); - this.configurationComposite.setConfigManipulator(getStateMachine().configProvider); this.configurationComposite.setConfigProvider(getStateMachine().configProvider); this.configurationComposite.setSigner(getStateMachine().pdfSigner); } |