diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 17:27:03 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 17:27:03 +0200 |
commit | bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8 (patch) | |
tree | 3f426e8fa800a298c1f1566dda4e18bb6913417a /pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites | |
parent | da37de85afc55f67b4ceefe35350ac9a0af32c6e (diff) | |
download | pdf-over-bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8.tar.gz pdf-over-bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8.tar.bz2 pdf-over-bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8.zip |
YAGNI: ConfigurationContainer interface
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites')
4 files changed, 105 insertions, 117 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 3691a519..33f19845 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 @@ -44,7 +44,6 @@ 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.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.ConfigurationContainerImpl; import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; @@ -97,7 +96,7 @@ public class ConfigurationComposite extends StateComposite { /** * configuration container Keeps state for current configuration changes */ - ConfigurationContainer configurationContainer = new ConfigurationContainerImpl(); + ConfigurationContainer configurationContainer = new ConfigurationContainer(); /** * The stack layout 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 6212c5ca..0a405d3a 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 @@ -247,7 +247,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { @Override public void widgetSelected(SelectionEvent e) { int selectionIndex = getBKUElementIndex( - AdvancedConfigurationComposite.this.configurationContainer.getDefaultBKU()); + AdvancedConfigurationComposite.this.configurationContainer.defaultBKU); if (AdvancedConfigurationComposite.this.cmbBKUAuswahl.getSelectionIndex() != selectionIndex) { selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl.getSelectionIndex(); performBKUSelectionChanged( @@ -348,7 +348,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.getLocale(); + Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.locale; Locale selectedLocale = Constants.SUPPORTED_LOCALES[AdvancedConfigurationComposite.this.cmbLocaleAuswahl .getSelectionIndex()]; if (!currentLocale.equals(selectedLocale)) { @@ -450,7 +450,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { private void performPostFixChanged(String postfix) { log.debug("Save file postfix changed to : {}", postfix); - this.configurationContainer.setSaveFilePostFix(postfix); + this.configurationContainer.saveFilePostFix = postfix; AdvancedConfigurationComposite.this.txtSaveFilePostFix.setText(postfix); } @@ -467,7 +467,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { void performOutputFolderChanged(String foldername) { log.debug("Selected Output folder: {}", foldername); - this.configurationContainer.setOutputFolder(foldername); + this.configurationContainer.outputFolder = foldername; AdvancedConfigurationComposite.this.txtOutputFolder.setText(foldername); } @@ -485,7 +485,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { void performBKUSelectionChanged(BKUs selected) { log.debug("Selected BKU: {}", selected); - this.configurationContainer.setDefaultBKU(selected); + this.configurationContainer.defaultBKU = selected; this.cmbBKUAuswahl.select(this.getBKUElementIndex(selected)); } @@ -527,14 +527,14 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { void performLocaleSelectionChanged(Locale selected) { log.debug("Selected Locale: {}", selected); - this.configurationContainer.setLocale(selected); + this.configurationContainer.locale = selected; this.cmbLocaleAuswahl.select(this.getLocaleElementIndex(selected)); } void performPositionSelection(boolean automatic) { log.debug("Selected Position: {}", automatic); SignaturePosition pos = automatic ? new SignaturePosition() : null; - this.configurationContainer.setDefaultSignaturePosition(pos); + this.configurationContainer.defaultSignaturePosition = pos; this.btnAutomatischePositionierung.setSelection(automatic); } @@ -551,17 +551,17 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { void performEnableUsePlaceholder(boolean enable) { this.btnPlatzhalterVerwenden.setEnabled(enable); this.btnSignatureFieldsUsage.setEnabled(enable); - this.configurationContainer.setEnablePlaceholderUsage(enable); + this.configurationContainer.enabledPlaceholderUsage = enable; this.btnEnablePlaceholderUsage.setSelection(enable); } void performPdfACompatSelection(boolean compat) { - this.configurationContainer.setSignaturePdfACompat(compat); + this.configurationContainer.signaturePDFACompat = compat; this.btnPdfACompat.setSelection(compat); } void performKeystoreEnabledSelection(boolean enabled) { - this.configurationContainer.setKeyStoreEnabled(enabled); + this.configurationContainer.keystoreEnabled = enabled; this.btnKeystoreEnabled.setSelection(enabled); this.configurationComposite.keystoreEnabled(enabled); @@ -581,11 +581,11 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { } void performPlaceholderTransparency(int transparency) { - this.configurationContainer.setPlaceholderTransparency(transparency); + this.configurationContainer.placeholderTransparency = transparency; } void performUpdateCheckSelection(boolean checkUpdate) { - this.configurationContainer.setUpdateCheck(checkUpdate); + this.configurationContainer.updateCheck = checkUpdate; this.btnUpdateCheck.setSelection(checkUpdate); } @@ -605,7 +605,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { */ private void plainProxyHostSetter() { String host = this.txtProxyHost.getText(); - this.configurationContainer.setProxyHost(host); + this.configurationContainer.proxyHost = host; } void processProxyPortChanged() { @@ -656,31 +656,31 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { */ @Override public void initConfiguration(PersistentConfigProvider provider) { - this.configurationContainer.setDefaultSignaturePosition(provider.getDefaultSignaturePositionPersistent()); + this.configurationContainer.defaultSignaturePosition = provider.getDefaultSignaturePositionPersistent(); this.configurationContainer.setUseMarker(provider.getUseMarker()); this.configurationContainer.setUseSignatureFields(provider.getUseSignatureFields()); - this.configurationContainer.setEnablePlaceholderUsage(provider.getEnablePlaceholderUsage()); - this.configurationContainer.setSignaturePdfACompat(provider.getSignaturePdfACompat()); - this.configurationContainer.setPlaceholderTransparency(provider.getPlaceholderTransparency()); + this.configurationContainer.enabledPlaceholderUsage = provider.getEnablePlaceholderUsage(); + this.configurationContainer.signaturePDFACompat = provider.getSignaturePdfACompat(); + this.configurationContainer.placeholderTransparency = provider.getPlaceholderTransparency(); - this.configurationContainer.setDefaultBKU(provider.getDefaultBKUPersistent()); - this.configurationContainer.setKeyStoreEnabled(provider.getKeyStoreEnabledPersistent()); + this.configurationContainer.defaultBKU = provider.getDefaultBKUPersistent(); + this.configurationContainer.keystoreEnabled = provider.getKeyStoreEnabledPersistent(); - this.configurationContainer.setOutputFolder(provider.getDefaultOutputFolderPersistent()); - this.configurationContainer.setSaveFilePostFix(provider.getSaveFilePostFix()); + this.configurationContainer.outputFolder = provider.getDefaultOutputFolderPersistent(); + this.configurationContainer.saveFilePostFix = provider.getSaveFilePostFix(); - this.configurationContainer.setLocale(provider.getLocale()); + this.configurationContainer.locale = provider.getLocale(); - this.configurationContainer.setUpdateCheck(provider.getUpdateCheck()); + this.configurationContainer.updateCheck = provider.getUpdateCheck(); - this.configurationContainer.setProxyHost(provider.getProxyHostPersistent()); + this.configurationContainer.proxyHost = provider.getProxyHostPersistent(); try { this.configurationContainer.setProxyPort(provider.getProxyPortPersistent()); } catch (InvalidPortException e) { log.error("Failed to set proxy port!", e); } - this.configurationContainer.setProxyUser(provider.getProxyUserPersistent()); - this.configurationContainer.setProxyPass(provider.getProxyPassPersistent()); + this.configurationContainer.proxyUser = provider.getProxyUserPersistent(); + this.configurationContainer.proxyPass = provider.getProxyPassPersistent(); this.configurationContainer.setSignatureProfile(Profile.getProfile(provider.getSignatureProfile())); } @@ -693,27 +693,27 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { @Override public void loadConfiguration() { // load advanced settings - performBKUSelectionChanged(this.configurationContainer.getDefaultBKU()); - String outputFolder = this.configurationContainer.getOutputFolder(); + performBKUSelectionChanged(this.configurationContainer.defaultBKU); + String outputFolder = this.configurationContainer.outputFolder; if (outputFolder != null) { performOutputFolderChanged(outputFolder); } - String postFix = this.configurationContainer.getSaveFilePostFix(); + String postFix = this.configurationContainer.saveFilePostFix; if (postFix != null) { performPostFixChanged(postFix); } else { performPostFixChanged(Constants.DEFAULT_POSTFIX); } - SignaturePosition pos = this.configurationContainer.getDefaultSignaturePosition(); + SignaturePosition pos = this.configurationContainer.defaultSignaturePosition; performPositionSelection(pos != null && pos.useAutoPositioning()); performUseMarkerSelection(this.configurationContainer.getUseMarker()); performUseSignatureFieldsSelection(this.configurationContainer.getUseSignatureFields()); - performEnableUsePlaceholder(this.configurationContainer.getEnablePlaceholderUsage()); - this.sclTransparenz.setSelection(this.configurationContainer.getPlaceholderTransparency()); - performLocaleSelectionChanged(this.configurationContainer.getLocale()); - performPdfACompatSelection(this.configurationContainer.getSignaturePdfACompat()); - performKeystoreEnabledSelection(this.configurationContainer.getKeyStoreEnabled()); - performUpdateCheckSelection(this.configurationContainer.getUpdateCheck()); + performEnableUsePlaceholder(this.configurationContainer.enabledPlaceholderUsage); + this.sclTransparenz.setSelection(this.configurationContainer.placeholderTransparency); + performLocaleSelectionChanged(this.configurationContainer.locale); + performPdfACompatSelection(this.configurationContainer.signaturePDFACompat); + performKeystoreEnabledSelection(this.configurationContainer.keystoreEnabled); + performUpdateCheckSelection(this.configurationContainer.updateCheck); performSetSignatureProfile(this.configurationContainer.getSignatureProfile()); int port = this.configurationContainer.getProxyPort(); @@ -721,7 +721,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.txtProxyPort.setText(Integer.toString(port)); } - String host = this.configurationContainer.getProxyHost(); + String host = this.configurationContainer.proxyHost; if (host != null) { this.txtProxyHost.setText(host); } @@ -756,26 +756,26 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { */ @Override public void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider) { - store.setDefaultSignaturePosition(this.configurationContainer.getDefaultSignaturePosition()); + store.setDefaultSignaturePosition(this.configurationContainer.defaultSignaturePosition); store.setUseMarker(this.configurationContainer.getUseMarker()); store.setUseSignatureFields(this.configurationContainer.getUseSignatureFields()); - store.setEnablePlaceholderUsage(this.configurationContainer.getEnablePlaceholderUsage()); - store.setSignaturePdfACompat(this.configurationContainer.getSignaturePdfACompat()); - store.setPlaceholderTransparency(this.configurationContainer.getPlaceholderTransparency()); + store.setEnablePlaceholderUsage(this.configurationContainer.enabledPlaceholderUsage); + store.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat); + store.setPlaceholderTransparency(this.configurationContainer.placeholderTransparency); - store.setDefaultBKU(this.configurationContainer.getDefaultBKU()); - store.setKeyStoreEnabled(this.configurationContainer.getKeyStoreEnabled()); + store.setDefaultBKU(this.configurationContainer.defaultBKU); + store.setKeyStoreEnabled(this.configurationContainer.keystoreEnabled); - store.setDefaultOutputFolder(this.configurationContainer.getOutputFolder()); - store.setSaveFilePostFix(this.configurationContainer.getSaveFilePostFix()); - store.setLocale(this.configurationContainer.getLocale()); + store.setDefaultOutputFolder(this.configurationContainer.outputFolder); + store.setSaveFilePostFix(this.configurationContainer.saveFilePostFix); + store.setLocale(this.configurationContainer.locale); - store.setUpdateCheck(this.configurationContainer.getUpdateCheck()); + store.setUpdateCheck(this.configurationContainer.updateCheck); store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); String hostOld = provider.getProxyHostPersistent(); - String hostNew = this.configurationContainer.getProxyHost(); + String hostNew = this.configurationContainer.proxyHost; if (hostOld != null && !hostOld.isEmpty() && (hostNew == null || hostNew.isEmpty())) { // Proxy has been removed, let's clear the system properties // Otherwise, the proxy settings wouldn't get removed @@ -794,7 +794,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { store.setProxyPort(portNew); String userOld = provider.getProxyUserPersistent(); - String userNew = this.configurationContainer.getProxyUser(); + String userNew = this.configurationContainer.proxyUser; if (userOld != null && !userOld.isEmpty() && (userNew == null || userNew.isEmpty())) { // cf. above System.clearProperty("http.proxyUser"); @@ -803,7 +803,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { store.setProxyUser(userNew); String passOld = provider.getProxyPassPersistent(); - String passNew = this.configurationContainer.getProxyPass(); + String passNew = this.configurationContainer.proxyPass; if (passOld != null && passNew == null) { // cf. above System.clearProperty("http.proxyPassword"); @@ -821,7 +821,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { @Override public void validateSettings(int resumeIndex) throws Exception { - String foldername = this.configurationContainer.getOutputFolder(); + String foldername = this.configurationContainer.outputFolder; switch (resumeIndex) { case 0: 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 a2284ee3..4e4694da 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 @@ -213,7 +213,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { @Override public void widgetSelected(SelectionEvent e) { File f = new File(KeystoreConfigurationComposite.this - .configurationContainer.getKeyStoreFile()); + .configurationContainer.keystoreFile); try { loadKeystore(); } catch (KeyStoreException ex) { @@ -280,10 +280,10 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { void loadKeystore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { ConfigurationContainer config = KeystoreConfigurationComposite.this.configurationContainer; - File f = new File(config.getKeyStoreFile()); - this.ks = KeyStore.getInstance(config.getKeyStoreType()); + File f = new File(config.keystoreFile); + this.ks = KeyStore.getInstance(config.keystoreType); FileInputStream fis = new FileInputStream(f); - this.ks.load(fis, config.getKeyStoreStorePass().toCharArray()); + this.ks.load(fis, config.keystoreStorePass.toCharArray()); this.cmbKeystoreAlias.remove(0, this.cmbKeystoreAlias.getItemCount()-1); Enumeration<String> aliases = this.ks.aliases(); while (aliases.hasMoreElements()) @@ -301,7 +301,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { */ protected void performKeystoreFileChanged(String fileName) { log.debug("Selected keystore file: " + fileName); - this.configurationContainer.setKeyStoreFile(fileName); + this.configurationContainer.keystoreFile = fileName; KeystoreConfigurationComposite.this.txtKeystoreFile.setText(fileName); int i = fileName.lastIndexOf('.'); if (i > 0) { @@ -323,7 +323,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { */ protected void performKeystoreTypeChanged(String type) { log.debug("Selected keystore type: " + type); - this.configurationContainer.setKeyStoreType(type); + this.configurationContainer.keystoreType = type; for (int i = 0; i < this.cmbKeystoreType.getItemCount(); ++i) { if (this.keystoreTypes.get(this.cmbKeystoreType.getItem(i)).equals(type)) { this.cmbKeystoreType.select(i); @@ -337,7 +337,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { */ protected void performKeystoreStorePassChanged(String storepass) { log.debug("Changed keystore store password"); - this.configurationContainer.setKeyStoreStorePass(storepass); + this.configurationContainer.keystoreStorePass = storepass; this.txtKeystoreStorePass.setText(storepass); } @@ -346,7 +346,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { */ protected void performKeystoreAliasChanged(String alias) { log.debug("Selected keystore alias: " + alias); - this.configurationContainer.setKeyStoreAlias(alias); + this.configurationContainer.keystoreAlias = alias; this.cmbKeystoreAlias.setText(alias); } @@ -355,7 +355,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { */ protected void performKeystoreKeyPassChanged(String keypass) { log.debug("Changed keystore key password"); - this.configurationContainer.setKeyStoreKeyPass(keypass); + this.configurationContainer.keystoreKeyPass = keypass; this.txtKeystoreKeyPass.setText(keypass); } @@ -387,11 +387,11 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { @Override public void initConfiguration(PersistentConfigProvider provider) { ConfigurationContainer config = this.configurationContainer; - config.setKeyStoreFile(provider.getKeyStoreFilePersistent()); - config.setKeyStoreType(provider.getKeyStoreTypePersistent()); - config.setKeyStoreAlias(provider.getKeyStoreAliasPersistent()); - config.setKeyStoreStorePass(provider.getKeyStoreStorePassPersistent()); - config.setKeyStoreKeyPass(provider.getKeyStoreKeyPassPersistent()); + config.keystoreFile = provider.getKeyStoreFilePersistent(); + config.keystoreType = provider.getKeyStoreTypePersistent(); + config.keystoreAlias = provider.getKeyStoreAliasPersistent(); + config.keystoreStorePass = provider.getKeyStoreStorePassPersistent(); + config.keystoreKeyPass = provider.getKeyStoreKeyPassPersistent(); } /* @@ -403,10 +403,10 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { public void loadConfiguration() { // Initialize form fields from configuration Container ConfigurationContainer config = this.configurationContainer; - String ks = config.getKeyStoreFile(); + String ks = config.keystoreFile; performKeystoreFileChanged(ks); - performKeystoreTypeChanged(config.getKeyStoreType()); - performKeystoreStorePassChanged(config.getKeyStoreStorePass()); + performKeystoreTypeChanged(config.keystoreType); + performKeystoreStorePassChanged(config.keystoreStorePass); try { File ksf = new File(ks); if (ksf.exists()) @@ -414,8 +414,8 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { } catch (Exception e) { log.error("Error loading keystore", e); } - performKeystoreAliasChanged(config.getKeyStoreAlias()); - performKeystoreKeyPassChanged(config.getKeyStoreKeyPass()); + performKeystoreAliasChanged(config.keystoreAlias); + performKeystoreKeyPassChanged(config.keystoreKeyPass); } /* (non-Javadoc) @@ -425,11 +425,11 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { public void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider) { ConfigurationContainer config = this.configurationContainer; - store.setKeyStoreFile(config.getKeyStoreFile()); - store.setKeyStoreType(config.getKeyStoreType()); - store.setKeyStoreAlias(config.getKeyStoreAlias()); - store.setKeyStoreStorePass(config.getKeyStoreStorePass()); - store.setKeyStoreKeyPass(config.getKeyStoreKeyPass()); + store.setKeyStoreFile(config.keystoreFile); + store.setKeyStoreType(config.keystoreType); + store.setKeyStoreAlias(config.keystoreAlias); + store.setKeyStoreStorePass(config.keystoreStorePass); + store.setKeyStoreKeyPass(config.keystoreKeyPass); } /* @@ -444,7 +444,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { ConfigurationContainer config = this.configurationContainer; switch (resumeFrom) { case 0: - String fname = config.getKeyStoreFile(); + String fname = config.keystoreFile; if (fname.isEmpty()) break; //no checks required File f = new File(fname); @@ -459,7 +459,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { } // Fall through case 2: - String alias = config.getKeyStoreAlias(); + String alias = config.keystoreAlias; if (!this.ks.containsAlias(alias)) throw new KeystoreAliasDoesntExistException(alias, 4); //skip next check if (!this.ks.isKeyEntry(alias)) @@ -467,8 +467,8 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { // Fall through case 3: try { - alias = config.getKeyStoreAlias(); - String keypass = config.getKeyStoreKeyPass(); + alias = config.keystoreAlias; + String keypass = config.keystoreKeyPass; this.ks.getKey(alias, keypass.toCharArray()); } catch (Exception e) { throw new KeystoreKeyPasswordException(4); 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 bf74eaa8..b6a9edf0 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 @@ -303,11 +303,8 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - Locale currentLocale = SimpleConfigurationComposite.this.configurationContainer - .getSignatureLocale(); - Locale selectedLocale = Constants. - SUPPORTED_LOCALES[SimpleConfigurationComposite.this.cmbSignatureLang - .getSelectionIndex()]; + Locale currentLocale = SimpleConfigurationComposite.this.configurationContainer.signatureLocale; + Locale selectedLocale = Constants.SUPPORTED_LOCALES[SimpleConfigurationComposite.this.cmbSignatureLang.getSelectionIndex()]; if (!currentLocale.equals(selectedLocale)) { performSignatureLangSelectionChanged(selectedLocale, currentLocale); } @@ -446,12 +443,12 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { try { if (this.signer != null) { SignatureParameter param = this.signer.getPDFSigner().newParameter(); - if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { - param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); + if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) { + param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote); } - param.setSignatureLanguage(this.configurationContainer.getSignatureLocale().getLanguage()); - param.setSignaturePdfACompat(this.configurationContainer.getSignaturePdfACompat()); + param.setSignatureLanguage(this.configurationContainer.signatureLocale.getLanguage()); + param.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat); if (image != null && !image.trim().isEmpty()) { logo = new ImageData(image); param.setEmblem(new CachedFileNameEmblem(image)); @@ -527,7 +524,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { void performSignatureLangSelectionChanged(Locale selected, Locale previous) { log.debug("Selected Sign Locale: {}", selected); - this.configurationContainer.setSignatureLocale(selected); + this.configurationContainer.signatureLocale = selected; this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); if ((previous != null) && (txtSignatureNote.getText().equals(getDefaultSignatureBlockNoteTextFor(null, previous)))) @@ -543,7 +540,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.cmbSignatureProfiles.select(newProfile.ordinal()); if (newProfile.equals(Profile.AMTSSIGNATURBLOCK) || newProfile.equals(Profile.INVISIBLE)){ - this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); + this.configurationContainer.defaultSignaturePosition = new SignaturePosition(); } setSignatureProfileSetting(); if (txtSignatureNote.getText().equals(getDefaultSignatureBlockNoteTextFor(oldProfile, null))) @@ -554,7 +551,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { if (profile == null) profile = configurationContainer.getSignatureProfile(); if (locale == null) - locale = configurationContainer.getSignatureLocale(); + locale = configurationContainer.signatureLocale; return profile.getDefaultSignatureBlockNote(locale); } @@ -597,7 +594,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { void processSignatureNoteChanged() { String note = this.txtSignatureNote.getText(); - this.configurationContainer.setSignatureNote(note); + this.configurationContainer.signatureNote = note; } /* @@ -626,11 +623,8 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { log.error("Failed to set emblem!", e); } - this.configurationContainer.setSignatureLocale( - provider.getSignatureLocale()); - - this.configurationContainer.setSignatureNote( - provider.getSignatureNote()); + this.configurationContainer.signatureLocale = provider.getSignatureLocale(); + this.configurationContainer.signatureNote = provider.getSignatureNote(); } /* @@ -661,7 +655,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { } } - String note = this.configurationContainer.getSignatureNote(); + String note = this.configurationContainer.signatureNote; if (note != null) { this.txtSignatureNote.setText(note); @@ -669,7 +663,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.setVisibleImage(); - this.performSignatureLangSelectionChanged(this.configurationContainer.getSignatureLocale(), null); + this.performSignatureLangSelectionChanged(this.configurationContainer.signatureLocale, null); this.preformProfileSelectionChanged(this.configurationContainer.getSignatureProfile()); @@ -679,16 +673,11 @@ 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(ConfigManipulator store, PersistentConfigProvider provider) { store.setDefaultMobileNumber(this.configurationContainer.getMobileNumber()); - store.setDefaultEmblem(this.configurationContainer.getEmblem()); - - store.setSignatureLocale(this.configurationContainer.getSignatureLocale()); - - store.setSignatureNote(this.configurationContainer.getSignatureNote()); - + store.setSignatureLocale(this.configurationContainer.signatureLocale); + store.setSignatureNote(this.configurationContainer.signatureNote); store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); @@ -704,14 +693,14 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { @Override public void validateSettings(int resumeFrom) throws Exception { switch (resumeFrom) { - case 0: - this.plainMobileNumberSetter(); - // Fall through - case 1: - this.processSignatureNoteChanged(); - break; - default: - //Fall through + case 0: + this.plainMobileNumberSetter(); + // Fall through + case 1: + this.processSignatureNoteChanged(); + break; + default: + break; } } |