From 17a8b0011e749af61fa41afdc221169a579ac688 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 10 Nov 2020 13:51:09 +0100 Subject: added signature profile to the config --- .../main/java/at/asit/pdfover/gui/Constants.java | 2 ++ .../composites/AdvancedConfigurationComposite.java | 2 ++ .../composites/SimpleConfigurationComposite.java | 2 ++ .../gui/workflow/config/ConfigManipulator.java | 5 ++++ .../workflow/config/ConfigOverlayManipulator.java | 6 +++++ .../gui/workflow/config/ConfigProvider.java | 13 ++++++++++ .../gui/workflow/config/ConfigProviderImpl.java | 30 ++++++++++++---------- .../workflow/config/ConfigurationContainer.java | 4 --- .../config/ConfigurationContainerImpl.java | 2 +- .../workflow/config/PersistentConfigProvider.java | 6 +++++ 10 files changed, 54 insertions(+), 18 deletions(-) (limited to 'pdf-over-gui/src/main') 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 7cb58f74..dd53b1d3 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 @@ -40,6 +40,8 @@ public class Constants { /** Application name + version */ 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$ static { // Has to be set before (implicitly) initializing Display 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 bbcf6b9c..fe4cfc28 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 @@ -1183,6 +1183,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { store.setLocale(this.configurationContainer.getLocale()); store.setUpdateCheck(this.configurationContainer.getUpdateCheck()); + + store.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); String hostOld = provider.getProxyHostPersistent(); String hostNew = this.configurationContainer.getProxyHost(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 6737c194..147f17eb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -886,6 +886,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { store.setSignatureLocale(this.configurationContainer.getSignatureLocale()); store.setSignatureNote(this.configurationContainer.getSignatureNote()); + + store.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); } /* 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 abed492a..3aba5075 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 @@ -197,6 +197,11 @@ public interface ConfigManipulator { * @return */ public boolean getEnablePlaceholderUsage(); + + /** + * @param profile + */ + void setSignatureProfile(String profile); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java index 44c4a9c9..9b54f4ee 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java @@ -131,4 +131,10 @@ public interface ConfigOverlayManipulator { * @param configurationFile */ public void setConfigurationFile(String configurationFile); + + /** + * + * @param profile + */ + public void setSignatureProfile(String profile); } 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 4c674d17..efe0a83b 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 @@ -265,4 +265,17 @@ public interface ConfigProvider { * @return */ public boolean getEnablePlaceholderUsage(); + + /** + * @param profile + */ + public void setSignatureProfile(String profile); + + + /** + * @return + */ + public String getSignatureProfile(); } + + 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 bd149cf7..b6acb392 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 @@ -30,6 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -112,11 +113,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, // Set Output Folder setDefaultOutputFolder(config .getProperty(Constants.CFG_OUTPUT_FOLDER)); - - // Set Default Certificate Download URL - // .getProperty(Constants.CFG_DOWNLOAD_URL)); - - String localeString = config.getProperty(Constants.CFG_LOCALE); @@ -146,6 +142,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setEnablePlaceholderUsage(enablePlaceholder.equalsIgnoreCase(Constants.TRUE)); } + String signatureProfile = config.getProperty(Constants.SIGNATURE_PROFILE); + if (signatureProfile != null) { + this.configuration.setSignatureProfile(PROFILE.getProfile(signatureProfile)); + } String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); if (compat != null) @@ -158,14 +158,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, this.configuration.setMobileBKUURL(bkuUrl); } - /*String downloadURL = config - .getProperty(Constants.CFG_DOWNLOAD_URL); - - if (downloadURL != null && !downloadURL.isEmpty()) { - this.configuration.setDownloadURL(downloadURL); - }*/ - - String bkuType = config .getProperty(Constants.CFG_MOBILE_BKU_TYPE); @@ -434,6 +426,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (!getUpdateCheck()) props.setProperty(Constants.CFG_UPDATE_CHECK, Constants.FALSE); + props.setProperty(Constants.SIGNATURE_PROFILE, getSignatureProfile()); + FileOutputStream outputstream = new FileOutputStream(configFile, false); @@ -1511,6 +1505,16 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (useFields) setUseMarker(false); } + @Override + public void setSignatureProfile(String profile) { + this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(profile)); + } + + @Override + public String getSignatureProfile() { + return this.configurationOverlay.getSignatureProfile().getName(); + } + @Override public void setEnablePlaceholderUsage(boolean bool) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index 18145d4f..8b08ba9f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -153,10 +153,6 @@ public interface ConfigurationContainer { * @return the default BKU */ public BKUs getDefaultBKU(); - - - - /** * Sets the default BKU diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java index b3232cfe..3f0021f7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java @@ -147,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected boolean useSignatureFields = false; /** The Signature Profile */ - protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; //$NON-NLS-1$ + protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() 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 e217b3c8..3304b6ca 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 @@ -199,4 +199,10 @@ public interface PersistentConfigProvider { * @return */ public boolean getEnablePlaceholderUsage(); + + /*** + * + * @return the signature profile + */ + public String getSignatureProfile(); } -- cgit v1.2.3