diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-08 14:37:52 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-08 14:38:08 +0200 |
commit | 4d0eef628cedbcac69f41fd92cdbeb4c25189a34 (patch) | |
tree | 3df2769f0c78c6a8be32ff71b411a9bec4fef096 /pdf-over-gui/src/main/java | |
parent | 3a419fea87c3ccebd5d437a151d1dd66df82c5bf (diff) | |
download | pdf-over-4d0eef628cedbcac69f41fd92cdbeb4c25189a34.tar.gz pdf-over-4d0eef628cedbcac69f41fd92cdbeb4c25189a34.tar.bz2 pdf-over-4d0eef628cedbcac69f41fd92cdbeb4c25189a34.zip |
config cleanup
Diffstat (limited to 'pdf-over-gui/src/main/java')
7 files changed, 106 insertions, 107 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index 3c957d40..16fb05f3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -228,7 +228,7 @@ public class MainWindow { @Override public void shellClosed(ShellEvent e) { log.debug("Closing main window"); - MainWindow.this.stateMachine.configProvider.setMainWindowSize(getShell().getSize()); + MainWindow.this.stateMachine.configProvider.setMainWindowSizePersistent(getShell().getSize()); try { MainWindow.this.stateMachine.configProvider.saveToDisk(); } catch (IOException e1) { 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 ea84abce..31a10b01 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 @@ -349,7 +349,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.locale; + Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.interfaceLocale; Locale selectedLocale = Constants.SUPPORTED_LOCALES[AdvancedConfigurationComposite.this.cmbLocaleAuswahl .getSelectionIndex()]; if (!currentLocale.equals(selectedLocale)) { @@ -528,7 +528,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { void performLocaleSelectionChanged(Locale selected) { log.debug("Selected Locale: {}", selected); - this.configurationContainer.locale = selected; + this.configurationContainer.interfaceLocale = selected; this.cmbLocaleAuswahl.select(this.getLocaleElementIndex(selected)); } @@ -662,7 +662,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.configurationContainer.outputFolder = provider.getDefaultOutputFolderPersistent(); this.configurationContainer.saveFilePostFix = provider.getSaveFilePostFix(); - this.configurationContainer.locale = provider.getLocale(); + this.configurationContainer.interfaceLocale = provider.getInterfaceLocale(); this.configurationContainer.updateCheck = provider.getUpdateCheck(); @@ -702,7 +702,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { performUseSignatureFieldsSelection(this.configurationContainer.getUseSignatureFields()); performEnableUsePlaceholder(this.configurationContainer.enabledPlaceholderUsage); this.sclTransparenz.setSelection(this.configurationContainer.placeholderTransparency); - performLocaleSelectionChanged(this.configurationContainer.locale); + performLocaleSelectionChanged(this.configurationContainer.interfaceLocale); performPdfACompatSelection(this.configurationContainer.signaturePDFACompat); performKeystoreEnabledSelection(this.configurationContainer.keystoreEnabled); performUpdateCheckSelection(this.configurationContainer.updateCheck); @@ -740,23 +740,23 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { @Override public void storeConfiguration(ConfigurationManager store) { - store.setAutoPositionSignature(this.configurationContainer.autoPositionSignature); - store.setUseMarker(this.configurationContainer.getUseMarker()); - store.setUseSignatureFields(this.configurationContainer.getUseSignatureFields()); - store.setEnablePlaceholderUsage(this.configurationContainer.enabledPlaceholderUsage); - store.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat); + store.setAutoPositionSignaturePersistent(this.configurationContainer.autoPositionSignature); + store.setUseMarkerPersistent(this.configurationContainer.getUseMarker()); + store.setUseSignatureFieldsPersistent(this.configurationContainer.getUseSignatureFields()); + store.setEnablePlaceholderUsagePersistent(this.configurationContainer.enabledPlaceholderUsage); + store.setSignaturePdfACompatPersistent(this.configurationContainer.signaturePDFACompat); store.setPlaceholderTransparency(this.configurationContainer.placeholderTransparency); - store.setDefaultBKU(this.configurationContainer.defaultBKU); - store.setKeyStoreEnabled(this.configurationContainer.keystoreEnabled); + store.setDefaultBKUPersistent(this.configurationContainer.defaultBKU); + store.setKeyStoreEnabledPersistent(this.configurationContainer.keystoreEnabled); - store.setDefaultOutputFolder(this.configurationContainer.outputFolder); - store.setSaveFilePostFix(this.configurationContainer.saveFilePostFix); - store.setLocale(this.configurationContainer.locale); + store.setDefaultOutputFolderPersistent(this.configurationContainer.outputFolder); + store.setSaveFilePostFixPersistent(this.configurationContainer.saveFilePostFix); + store.setInterfaceLocalePersistent(this.configurationContainer.interfaceLocale); - store.setUpdateCheck(this.configurationContainer.updateCheck); + store.setUpdateCheckPersistent(this.configurationContainer.updateCheck); - store.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); + store.setSignatureProfilePersistent(this.configurationContainer.getSignatureProfile().name()); String hostOld = store.getProxyHostPersistent(); String hostNew = this.configurationContainer.proxyHost; @@ -766,7 +766,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { System.clearProperty("http.proxyHost"); System.clearProperty("https.proxyHost"); } - store.setProxyHost(hostNew); + store.setProxyHostPersistent(hostNew); int portOld = store.getProxyPortPersistent(); int portNew = this.configurationContainer.getProxyPort(); @@ -775,7 +775,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { System.clearProperty("http.proxyPort"); System.clearProperty("https.proxyPort"); } - store.setProxyPort(portNew); + store.setProxyPortPersistent(portNew); String userOld = store.getProxyUserPersistent(); String userNew = this.configurationContainer.proxyUser; @@ -784,7 +784,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { System.clearProperty("http.proxyUser"); System.clearProperty("https.proxyUser"); } - store.setProxyUser(userNew); + store.setProxyUserPersistent(userNew); String passOld = store.getProxyPassPersistent(); String passNew = this.configurationContainer.proxyPass; @@ -793,7 +793,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { System.clearProperty("http.proxyPassword"); System.clearProperty("https.proxyPassword"); } - store.setProxyPass(passNew); + store.setProxyPassPersistent(passNew); } /* 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 45626d77..4b2499e6 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 @@ -235,7 +235,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { File f = new File(KeystoreConfigurationComposite.this .configurationContainer.keystoreFile); try { - loadKeystore(true); + loadKeystore(); } catch (KeyStoreException ex) { log.error("Error loading keystore", ex); showErrorDialog(Messages.getString("error.KeyStore")); @@ -305,14 +305,12 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { e.open(); } - void loadKeystore(boolean force) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException { + void loadKeystore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException { this.cmbKeystoreAlias.remove(0, this.cmbKeystoreAlias.getItemCount()-1); ConfigurationDataInMemory config = this.configurationContainer; this.ks = null; String pass = config.keystoreStorePass; - if (!force && pass == null) - throw new UnrecoverableKeyException("No password specified"); while (this.ks == null) { @@ -392,6 +390,11 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { this.txtKeystoreKeyPass.setVisible(showPasswordFields); this.lblKeystoreStorePass.setVisible(showPasswordFields); this.txtKeystoreStorePass.setVisible(showPasswordFields); + if (showPasswordFields) + { /* get rid of potential nulls */ + performKeystoreKeyPassChanged(this.txtKeystoreKeyPass.getText()); + performKeystoreStorePassChanged(this.txtKeystoreStorePass.getText()); + } } /** @@ -476,8 +479,8 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { performKeystoreStorePassChanged(config.keystoreStorePass); try { File ksf = new File(ks); - if (ksf.exists()) - loadKeystore(false); + if (ksf.exists() && config.keystoreStorePass != null) + loadKeystore(); } catch (Exception e) { log.info("Failed to load keystore on init", e); } @@ -488,10 +491,10 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { @Override public void storeConfiguration(ConfigurationManager store) { ConfigurationDataInMemory config = this.configurationContainer; - store.setKeyStoreFile(config.keystoreFile); - store.setKeyStoreType(config.keystoreType); - store.setKeyStoreAlias(config.keystoreAlias); - store.setKeyStorePassStorageType(config.keystorePassStorageType); + store.setKeyStoreFilePersistent(config.keystoreFile); + store.setKeyStoreTypePersistent(config.keystoreType); + store.setKeyStoreAliasPersistent(config.keystoreAlias); + store.setKeyStorePassStorageTypePersistent(config.keystorePassStorageType); if (config.keystorePassStorageType == KeyStorePassStorageType.DISK) { store.setKeyStoreStorePassPersistent(config.keystoreStorePass); @@ -527,7 +530,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { // Fall through case 1: try { - loadKeystore(true); + loadKeystore(); } catch (Exception e) { throw new CantLoadKeystoreException(e, 4); //skip next checks } 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 83c159a0..e4237026 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 @@ -665,11 +665,11 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { @Override public void storeConfiguration(ConfigurationManager 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()); + store.setDefaultMobileNumberPersistent(this.configurationContainer.getMobileNumber()); + store.setDefaultEmblemPersistent(this.configurationContainer.getEmblem()); + store.setSignatureLocalePersistent(this.configurationContainer.signatureLocale); + store.setSignatureNotePersistent(this.configurationContainer.signatureNote); + store.setSignatureProfilePersistent(this.configurationContainer.getSignatureProfile().name()); } /* diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java index 6102ebac..c6a50c0b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java @@ -122,7 +122,7 @@ public class ConfigurationDataInMemory { public String signatureNote = null; /** Holds the locale */ - public Locale locale = null; + public Locale interfaceLocale = null; /** Holds the signature locale */ public Locale signatureLocale = null; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java index 5afbe33d..3d5ebfff 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java @@ -84,58 +84,58 @@ public class ConfigurationManager { diskConfig.load(new FileInputStream(Constants.CONFIG_DIRECTORY + File.separator + getConfigurationFileName())); - setDefaultEmblem(diskConfig.getProperty(Constants.CFG_EMBLEM)); + setDefaultEmblemPersistent(diskConfig.getProperty(Constants.CFG_EMBLEM)); - setDefaultMobileNumber(diskConfig.getProperty(Constants.CFG_MOBILE_NUMBER)); + setDefaultMobileNumberPersistent(diskConfig.getProperty(Constants.CFG_MOBILE_NUMBER)); - setProxyHost(diskConfig.getProperty(Constants.CFG_PROXY_HOST)); - setProxyUser(diskConfig.getProperty(Constants.CFG_PROXY_USER)); - setProxyPass(diskConfig.getProperty(Constants.CFG_PROXY_PASS)); + setProxyHostPersistent(diskConfig.getProperty(Constants.CFG_PROXY_HOST)); + setProxyUserPersistent(diskConfig.getProperty(Constants.CFG_PROXY_USER)); + setProxyPassPersistent(diskConfig.getProperty(Constants.CFG_PROXY_PASS)); - setDefaultOutputFolder(diskConfig.getProperty(Constants.CFG_OUTPUT_FOLDER)); + setDefaultOutputFolderPersistent(diskConfig.getProperty(Constants.CFG_OUTPUT_FOLDER)); String postFix = diskConfig.getProperty(Constants.CFG_POSTFIX); if (postFix == null) - setSaveFilePostFix(Constants.DEFAULT_POSTFIX); + setSaveFilePostFixPersistent(Constants.DEFAULT_POSTFIX); else - setSaveFilePostFix(postFix); + setSaveFilePostFixPersistent(postFix); String localeString = diskConfig.getProperty(Constants.CFG_LOCALE); Locale targetLocale = LocaleSerializer.parseFromString(localeString); if (targetLocale != null) - setLocale(targetLocale); + setInterfaceLocalePersistent(targetLocale); String signatureLocaleString = diskConfig.getProperty(Constants.CFG_SIGNATURE_LOCALE); Locale signatureTargetLocale = LocaleSerializer.parseFromString(signatureLocaleString); if (signatureTargetLocale != null) - setSignatureLocale(signatureTargetLocale); + setSignatureLocalePersistent(signatureTargetLocale); String useMarker = diskConfig.getProperty(Constants.CFG_USE_MARKER); if (useMarker != null) - setUseMarker(useMarker.equalsIgnoreCase(Constants.TRUE)); + setUseMarkerPersistent(useMarker.equalsIgnoreCase(Constants.TRUE)); String useSignatureFields = diskConfig.getProperty(Constants.CFG_USE_SIGNATURE_FIELDS); if (useSignatureFields != null) - setUseSignatureFields(useSignatureFields.equalsIgnoreCase(Constants.TRUE)); + setUseSignatureFieldsPersistent(useSignatureFields.equalsIgnoreCase(Constants.TRUE)); String enablePlaceholder = diskConfig.getProperty(Constants.CFG_ENABLE_PLACEHOLDER); if (enablePlaceholder != null) - setEnablePlaceholderUsage(enablePlaceholder.equalsIgnoreCase(Constants.TRUE)); + setEnablePlaceholderUsagePersistent(enablePlaceholder.equalsIgnoreCase(Constants.TRUE)); String signatureProfileName = diskConfig.getProperty(Constants.SIGNATURE_PROFILE); if (signatureProfileName != null) - setSignatureProfile(signatureProfileName); + setSignatureProfilePersistent(signatureProfileName); if (diskConfig.containsKey(Constants.CFG_SIGNATURE_NOTE)) - setSignatureNote(diskConfig.getProperty(Constants.CFG_SIGNATURE_NOTE)); + setSignatureNotePersistent(diskConfig.getProperty(Constants.CFG_SIGNATURE_NOTE)); else - setSignatureNote(Profile.getProfile(getSignatureProfile()).getDefaultSignatureBlockNote(getSignatureLocale())); + setSignatureNotePersistent(Profile.getProfile(getSignatureProfile()).getDefaultSignatureBlockNote(getSignatureLocale())); String compat = diskConfig.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); if (compat != null) - setSignaturePdfACompat(compat.equalsIgnoreCase(Constants.TRUE)); + setSignaturePdfACompatPersistent(compat.equalsIgnoreCase(Constants.TRUE)); String bkuUrl = diskConfig.getProperty(Constants.CFG_MOBILE_BKU_URL); if (bkuUrl != null && !bkuUrl.isEmpty()) @@ -164,7 +164,7 @@ public class ConfigurationManager { int port = Integer.parseInt(proxyPortString); if (port > 0 && port <= 0xFFFF) - setProxyPort(port); + setProxyPortPersistent(port); else log.warn("Proxy port is out of range!: " + port); } @@ -183,7 +183,7 @@ public class ConfigurationManager { defaultBKU = BKUs.NONE; } } - setDefaultBKU(defaultBKU); + setDefaultBKUPersistent(defaultBKU); // Set Signature placeholder transparency int transparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY; @@ -221,15 +221,15 @@ public class ConfigurationManager { // Set Signature Position String signaturePositionStr = diskConfig.getProperty(Constants.CFG_SIGNATURE_POSITION); - setAutoPositionSignature(signaturePositionStr != null && signaturePositionStr.trim().equals("auto")); + setAutoPositionSignaturePersistent(signaturePositionStr != null && signaturePositionStr.trim().equals("auto")); //Set keystore stuff String keystoreEnabled = diskConfig.getProperty(Constants.CFG_KEYSTORE_ENABLED); if (keystoreEnabled != null) - setKeyStoreEnabled(keystoreEnabled.equalsIgnoreCase(Constants.TRUE)); - setKeyStoreFile(diskConfig.getProperty(Constants.CFG_KEYSTORE_FILE)); - setKeyStoreType(diskConfig.getProperty(Constants.CFG_KEYSTORE_TYPE)); - setKeyStoreAlias(diskConfig.getProperty(Constants.CFG_KEYSTORE_ALIAS)); + setKeyStoreEnabledPersistent(keystoreEnabled.equalsIgnoreCase(Constants.TRUE)); + setKeyStoreFilePersistent(diskConfig.getProperty(Constants.CFG_KEYSTORE_FILE)); + setKeyStoreTypePersistent(diskConfig.getProperty(Constants.CFG_KEYSTORE_TYPE)); + setKeyStoreAliasPersistent(diskConfig.getProperty(Constants.CFG_KEYSTORE_ALIAS)); setKeyStoreStorePassPersistent(diskConfig.getProperty(Constants.CFG_KEYSTORE_STOREPASS)); setKeyStoreKeyPassPersistent(diskConfig.getProperty(Constants.CFG_KEYSTORE_KEYPASS)); String storeTypeOnDisk = diskConfig.getProperty(Constants.CFG_KEYSTORE_PASSSTORETYPE); @@ -243,16 +243,16 @@ public class ConfigurationManager { storeTypeOnDisk = "memory"; } if ("disk".equals(storeTypeOnDisk)) - setKeyStorePassStorageType(KeyStorePassStorageType.DISK); + setKeyStorePassStorageTypePersistent(KeyStorePassStorageType.DISK); else if ("memory".equals(storeTypeOnDisk)) - setKeyStorePassStorageType(KeyStorePassStorageType.MEMORY); + setKeyStorePassStorageTypePersistent(KeyStorePassStorageType.MEMORY); else - setKeyStorePassStorageType(null); + setKeyStorePassStorageTypePersistent(null); // Set update check String updateCheck = diskConfig.getProperty(Constants.CFG_UPDATE_CHECK); if (updateCheck != null) - setUpdateCheck(!updateCheck.equalsIgnoreCase(Constants.FALSE)); + setUpdateCheckPersistent(!updateCheck.equalsIgnoreCase(Constants.FALSE)); log.info("Successfully loaded config from: " + getConfigurationFileName()); loaded = true; @@ -292,7 +292,7 @@ public class ConfigurationManager { Point size = this.configuration.mainWindowSize; props.setProperty(Constants.CFG_MAINWINDOW_SIZE, size.x + "," + size.y); - Locale configLocale = getLocale(); + Locale configLocale = getInterfaceLocale(); if(configLocale != null) { props.setProperty(Constants.CFG_LOCALE, LocaleSerializer.getParsableString(configLocale)); } @@ -390,7 +390,7 @@ public class ConfigurationManager { } public String getConfigurationFileName() { return this.configurationFile; } - public void setDefaultBKU(BKUs bku) { + public void setDefaultBKUPersistent(BKUs bku) { this.configuration.defaultBKU = bku; } @@ -409,7 +409,7 @@ public class ConfigurationManager { return this.configuration.defaultBKU; } - public void setAutoPositionSignature(boolean state) { + public void setAutoPositionSignaturePersistent(boolean state) { this.configuration.autoPositionSignature = state; } @@ -433,7 +433,7 @@ public class ConfigurationManager { return this.configuration.placeholderTransparency; } - public void setDefaultMobileNumber(String number) { + public void setDefaultMobileNumberPersistent(String number) { if (number == null || number.trim().isEmpty()) { this.configuration.setMobileNumber(STRING_EMPTY); } else { @@ -463,14 +463,6 @@ public class ConfigurationManager { return number; } - public void setDefaultMobilePassword(String password) { - if (password == null || password.trim().isEmpty()) { - this.configuration.mobilePassword = STRING_EMPTY; - } else { - this.configuration.mobilePassword = password; - } - } - public void setDefaultMobilePasswordOverlay(String password) { if (password == null || password.trim().isEmpty()) { this.configurationOverlay.mobilePassword = STRING_EMPTY; @@ -484,7 +476,7 @@ public class ConfigurationManager { return this.configurationOverlay.mobilePassword; } - public void setDefaultEmblem(String emblem) { + public void setDefaultEmblemPersistent(String emblem) { try { if (emblem == null || emblem.trim().isEmpty()) { this.configuration.setEmblem(STRING_EMPTY); @@ -532,7 +524,7 @@ public class ConfigurationManager { return emblem; } - public void setProxyHost(String host) { + public void setProxyHostPersistent(String host) { if (host == null || host.trim().isEmpty()) { this.configuration.proxyHost = STRING_EMPTY; } else { @@ -562,7 +554,7 @@ public class ConfigurationManager { return host; } - public void setProxyPort(int port) { + public void setProxyPortPersistent(int port) { try { this.configuration.setProxyPort(port); } catch (InvalidPortException e) { @@ -591,7 +583,7 @@ public class ConfigurationManager { return this.configuration.getProxyPort(); } - public void setProxyUser(String user) { + public void setProxyUserPersistent(String user) { if (user == null || user.trim().isEmpty()) { this.configuration.proxyUser = STRING_EMPTY; } else { @@ -621,7 +613,7 @@ public class ConfigurationManager { return user; } - public void setProxyPass(String pass) { + public void setProxyPassPersistent(String pass) { if (pass == null || pass.trim().isEmpty()) { this.configuration.proxyPass = STRING_EMPTY; } else { @@ -651,7 +643,7 @@ public class ConfigurationManager { return pass; } - public void setDefaultOutputFolder(String outputFolder) { + public void setDefaultOutputFolderPersistent(String outputFolder) { if (outputFolder == null || outputFolder.trim().isEmpty()) { this.configuration.outputFolder = STRING_EMPTY; } else { @@ -693,7 +685,7 @@ public class ConfigurationManager { return this.configuration.mobileBKUBase64; } - public void setSignatureNote(String note) { + public void setSignatureNotePersistent(String note) { if (note == null || note.trim().isEmpty()) { this.configuration.signatureNote = STRING_EMPTY; } else { @@ -708,24 +700,24 @@ public class ConfigurationManager { return note; } - public void setLocale(Locale locale) { + public void setInterfaceLocalePersistent(Locale locale) { if(locale == null) { - this.configuration.locale = Messages.getDefaultLocale(); + this.configuration.interfaceLocale = Messages.getDefaultLocale(); } else { - this.configuration.locale = locale; + this.configuration.interfaceLocale = locale; Locale.setDefault(locale); Messages.setLocale(locale); } } - public Locale getLocale() { - Locale locale = this.configuration.locale; + public Locale getInterfaceLocale() { + Locale locale = this.configuration.interfaceLocale; if (locale == null) locale = Messages.getDefaultLocale(); return locale; } - public void setSignatureLocale(Locale locale) { + public void setSignatureLocalePersistent(Locale locale) { if(locale == null) { this.configuration.signatureLocale = Messages.getDefaultLocale(); } else { @@ -740,7 +732,7 @@ public class ConfigurationManager { return locale; } - public void setSignaturePdfACompat(boolean compat) { + public void setSignaturePdfACompatPersistent(boolean compat) { this.configuration.signaturePDFACompat = compat; } @@ -748,7 +740,7 @@ public class ConfigurationManager { return this.configuration.signaturePDFACompat; } - public void setKeyStoreEnabled(Boolean enabled) { + public void setKeyStoreEnabledPersistent(Boolean enabled) { this.configuration.keystoreEnabled = enabled; } @@ -770,7 +762,7 @@ public class ConfigurationManager { return enabled; } - public void setKeyStoreFile(String file) { + public void setKeyStoreFilePersistent(String file) { if (file == null || file.trim().isEmpty()) { this.configuration.keystoreFile = STRING_EMPTY; } else { @@ -800,7 +792,7 @@ public class ConfigurationManager { return file; } - public void setKeyStoreType(String type) { + public void setKeyStoreTypePersistent(String type) { if (type == null || type.trim().isEmpty()) { this.configuration.keystoreType = STRING_EMPTY; } else { @@ -830,7 +822,7 @@ public class ConfigurationManager { return type; } - public void setKeyStoreAlias(String alias) { + public void setKeyStoreAliasPersistent(String alias) { if (alias == null || alias.trim().isEmpty()) { this.configuration.keystoreAlias = STRING_EMPTY; } else { @@ -860,7 +852,7 @@ public class ConfigurationManager { return alias; } - public void setKeyStorePassStorageType(KeyStorePassStorageType type) { + public void setKeyStorePassStorageTypePersistent(KeyStorePassStorageType type) { this.configuration.keystorePassStorageType = type; } @@ -910,7 +902,7 @@ public class ConfigurationManager { return this.configuration.keystoreKeyPass; } - public void setUpdateCheck(boolean checkUpdate) { + public void setUpdateCheckPersistent(boolean checkUpdate) { this.configuration.updateCheck = checkUpdate; } @@ -918,7 +910,7 @@ public class ConfigurationManager { return this.configuration.updateCheck; } - public void setMainWindowSize(Point size) { + public void setMainWindowSizePersistent(Point size) { this.configuration.mainWindowSize = size; } @@ -938,25 +930,25 @@ public class ConfigurationManager { return this.configuration.getUseSignatureFields(); } - public void setUseSignatureFields(boolean useFields) { + public void setUseSignatureFieldsPersistent(boolean useFields) { this.configuration.setUseSignatureFields(useFields); - if (useFields) setUseMarker(false); + if (useFields) setUseMarkerPersistent(false); } public boolean getUseMarker() { return this.configuration.getUseMarker(); } - public void setUseMarker(boolean useMarker) { + public void setUseMarkerPersistent(boolean useMarker) { this.configuration.setUseMarker(useMarker); - if (useMarker) setUseSignatureFields(false); + if (useMarker) setUseSignatureFieldsPersistent(false); } - public void setSignatureProfile(String profile) { + public void setSignatureProfilePersistent(String profile) { this.configuration.setSignatureProfile(Profile.getProfile(profile)); } - public void setSaveFilePostFix(String postFix) { + public void setSaveFilePostFixPersistent(String postFix) { this.configuration.saveFilePostFix = postFix; } @@ -968,7 +960,7 @@ public class ConfigurationManager { return this.configuration.getSignatureProfile().name(); } - public void setEnablePlaceholderUsage(boolean bool) { + public void setEnablePlaceholderUsagePersistent(boolean bool) { this.configuration.enabledPlaceholderUsage = bool; } 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 4f32715b..e371a321 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 @@ -74,7 +74,11 @@ public class ConfigurationUIState extends State { if(config.isUserDone()) { this.reloadResources(); - this.setNextState(status.getPreviousState()); + State previousState = status.getPreviousState(); + if (previousState instanceof OutputState) + this.setNextState(new OpenState(getStateMachine())); + else + this.setNextState(previousState); } } |