From 1d599dd166e3a00ddaa1c7b8ffa9c296289942e2 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 18 Feb 2020 09:52:42 +0100 Subject: finished: pdf-over advanced config extension --- .../gui/composites/AdvancedConfigurationComposite.java | 9 ++++++--- .../asit/pdfover/gui/workflow/config/ConfigProviderImpl.java | 12 ++++++++++-- .../java/at/asit/pdfover/gui/workflow/states/OpenState.java | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'pdf-over-gui/src/main/java') 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 0a1f0715..e79964fc 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 @@ -311,7 +311,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.btnSignatureFieldsUsage.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - AdvancedConfigurationComposite.this.performUseMarkerSelection( + AdvancedConfigurationComposite.this.performUseSignatureFieldsSelection( AdvancedConfigurationComposite.this.btnSignatureFieldsUsage.getSelection()); } }); @@ -901,12 +901,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { void performUseMarkerSelection(boolean useMarker) { this.configurationContainer.setUseMarker(useMarker); - //this.btnPlatzhalterVerwenden.setSelection(useMarker); + this.btnPlatzhalterVerwenden.setSelection(useMarker); } void performUseSignatureFieldsSelection(boolean useFields) { this.configurationContainer.setUseSignatureFields(useFields); - //this.btnPlatzhalterVerwenden.setSelection(useMarker); + this.btnSignatureFieldsUsage.setSelection(useFields); } void performPdfACompatSelection(boolean compat) { @@ -1047,6 +1047,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setDefaultSignaturePosition( provider.getDefaultSignaturePositionPersistent()); this.configurationContainer.setUseMarker(provider.getUseMarker()); + this.configurationContainer.setUseSignatureFields(provider.getUseSignatureFields()); /*this.configurationContainer.setDownloadURL( provider.getDownloadURL());*/ this.configurationContainer.setSignaturePdfACompat( @@ -1098,6 +1099,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getDefaultSignaturePosition(); performPositionSelection(pos != null && pos.useAutoPositioning()); performUseMarkerSelection(this.configurationContainer.getUseMarker()); + performUseSignatureFieldsSelection(this.configurationContainer.getUseSignatureFields()); this.sclTransparenz.setSelection(this.configurationContainer .getPlaceholderTransparency()); performLocaleSelectionChanged(this.configurationContainer.getLocale()); @@ -1136,6 +1138,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { store.setDefaultSignaturePosition( this.configurationContainer.getDefaultSignaturePosition()); store.setUseMarker(this.configurationContainer.getUseMarker()); + store.setUseSignatureFields(this.configurationContainer.getUseSignatureFields()); store.setSignaturePdfACompat( this.configurationContainer.getSignaturePdfACompat()); store.setPlaceholderTransparency( 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 8bf13e4c..56e79935 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 @@ -115,6 +115,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, // Set Default Certificate Download URL // .getProperty(Constants.CFG_DOWNLOAD_URL)); + + String localeString = config.getProperty(Constants.CFG_LOCALE); @@ -135,9 +137,11 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setUseMarker(useMarker.equalsIgnoreCase(Constants.TRUE)); String useSignatureFields = config.getProperty(Constants.CFG_USE_SIGNATURE_FIELDS); - if (useSignatureFields != null) + if (useSignatureFields == null) { + config.setProperty(Constants.CFG_USE_SIGNATURE_FIELDS, ""); + } else { setUseSignatureFields(useSignatureFields.equalsIgnoreCase(Constants.TRUE)); - + } String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); if (compat != null) setSignaturePdfACompat(compat.equalsIgnoreCase(Constants.TRUE)); @@ -367,6 +371,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (getUseMarker()) props.setProperty(Constants.CFG_USE_MARKER, Constants.TRUE); + + if (getUseSignatureFields()) { + props.setProperty(Constants.CFG_USE_SIGNATURE_FIELDS, Constants.TRUE); + } if (getSignaturePdfACompat()) props.setProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT, Constants.TRUE); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java index bb0e649f..04b1678d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java @@ -112,7 +112,7 @@ public class OpenState extends State { // scan for signature placeholders // - see if we want to scan for placeholders in the settings - if (getStateMachine().getConfigProvider().getUseMarker()) { + if (getStateMachine().getConfigProvider().getUseMarker() || getStateMachine().getConfigProvider().getUseSignatureFields()) { try { // - scan for placeholders -- cgit v1.2.3