From 402805f8485a926a8efd8d01de9af98824941140 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 16:30:36 +0100 Subject: Added Postfix option to the configuration --- .../main/java/at/asit/pdfover/gui/Constants.java | 5 +++- .../composites/AdvancedConfigurationComposite.java | 9 +++++++- .../gui/workflow/config/ConfigManipulator.java | 4 +++- .../gui/workflow/config/ConfigProvider.java | 2 ++ .../gui/workflow/config/ConfigProviderImpl.java | 27 ++++++++++++---------- .../workflow/config/PersistentConfigProvider.java | 4 +++- 6 files changed, 35 insertions(+), 16 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java index 17a9a8d7..1fa31abb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -41,8 +41,9 @@ public class Constants { public static final String APP_NAME_VERSION = (APP_VERSION == null ? APP_NAME : APP_NAME + " v" + APP_VERSION); //$NON-NLS-1$ public static final String SIGNATURE_PROFILE = "SIGNATURE_PROFILE"; //$NON-NLS-1$ + public static final String DEFAULT_POSTFIX = "_signed"; - static { + static { // Has to be set before (implicitly) initializing Display Display.setAppName(APP_NAME); } @@ -209,6 +210,8 @@ public class Constants { /** The output folder config parameter */ public static final String CFG_OUTPUT_FOLDER = "OUTPUT_FOLDER"; //$NON-NLS-1$ + public static final String CFG_POSTFIX = "SAVE_FILE_POSTFIX"; + /** The main window size (Format: width,height) */ public static final String CFG_MAINWINDOW_SIZE = "MAINWINDOW_SIZE"; //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index 0cb26983..8ed1b640 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -869,6 +869,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setKeyStoreEnabled(provider.getKeyStoreEnabledPersistent()); this.configurationContainer.setOutputFolder(provider.getDefaultOutputFolderPersistent()); + this.configurationContainer.setSaveFilePostFix(provider.getSaveFilePostFix()); this.configurationContainer.setLocale(provider.getLocale()); @@ -899,6 +900,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { if (outputFolder != null) { performOutputFolderChanged(outputFolder); } + String postFix = this.configurationContainer.getSaveFilePostFix(); + if (postFix != null) { + performPostFixChanged(postFix); + } else { + performPostFixChanged(Constants.DEFAULT_POSTFIX); + } SignaturePosition pos = this.configurationContainer.getDefaultSignaturePosition(); performPositionSelection(pos != null && pos.useAutoPositioning()); performUseMarkerSelection(this.configurationContainer.getUseMarker()); @@ -963,7 +970,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { store.setKeyStoreEnabled(this.configurationContainer.getKeyStoreEnabled()); store.setDefaultOutputFolder(this.configurationContainer.getOutputFolder()); - + store.setSaveFilePostFix(this.configurationContainer.getSaveFilePostFix()); store.setLocale(this.configurationContainer.getLocale()); store.setUpdateCheck(this.configurationContainer.getUpdateCheck()); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java index 3aba5075..befb244b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java @@ -201,7 +201,9 @@ public interface ConfigManipulator { /** * @param profile */ - void setSignatureProfile(String profile); + public void setSignatureProfile(String profile); + + public void setSaveFilePostFix(String postFix); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index efe0a83b..b6935206 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -276,6 +276,8 @@ public interface ConfigProvider { * @return */ public String getSignatureProfile(); + + public String getSaveFilePostFix(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index 92a64103..9dc19be4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -114,6 +114,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setDefaultOutputFolder(config .getProperty(Constants.CFG_OUTPUT_FOLDER)); + setSaveFilePostFix(config.getProperty(Constants.CFG_POSTFIX)); + String localeString = config.getProperty(Constants.CFG_LOCALE); Locale targetLocale = LocaleSerializer.parseFromString(localeString); @@ -351,6 +353,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, props.setProperty(Constants.CFG_SIGNATURE_NOTE, getSignatureNote()); props.setProperty(Constants.CFG_MOBILE_NUMBER, getDefaultMobileNumberPersistent()); props.setProperty(Constants.CFG_OUTPUT_FOLDER, getDefaultOutputFolderPersistent()); + props.setProperty(Constants.CFG_POSTFIX, getSaveFilePostFix()); props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY, Integer.toString(getPlaceholderTransparency())); @@ -985,16 +988,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - - /*@Override - public void setDefaultDownloadURL(String downloadURL) { - if (downloadURL == null || downloadURL.trim().isEmpty()) { - this.configuration.setDownloadURL(Constants.CERTIFICATE_DOWNLOAD_XML_URL+Constants.CERTIFICATE_XML_FILE); - } else { - this.configuration.setDownloadURL(downloadURL); - } - } - /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultOutputFolderOverlay(java.lang.String) */ @@ -1510,8 +1503,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, public void setSignatureProfile(String profile) { this.configurationOverlay.setSignatureProfile(Profile.getProfile(profile)); } - - @Override + + @Override + public void setSaveFilePostFix(String postFix) { + this.configurationOverlay.setSaveFilePostFix(postFix); + } + + @Override + public String getSaveFilePostFix(){ + return this.configurationOverlay.getSaveFilePostFix(); + } + + @Override public String getSignatureProfile() { return this.configurationOverlay.getSignatureProfile().getName(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java index 3304b6ca..1175ca9a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java @@ -204,5 +204,7 @@ public interface PersistentConfigProvider { * * @return the signature profile */ - public String getSignatureProfile(); + public String getSignatureProfile(); + + public String getSaveFilePostFix(); } -- cgit v1.2.3