From 3d84b06b62a9c1fcd44cd7a767e2a9c5e5a032b9 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 18 Feb 2020 13:04:11 +0100 Subject: further extension advanced config --- .../main/java/at/asit/pdfover/gui/Constants.java | 3 ++ .../composites/AdvancedConfigurationComposite.java | 38 ++++++++++++++++++++-- .../gui/workflow/config/ConfigManipulator.java | 5 +++ .../gui/workflow/config/ConfigProviderImpl.java | 15 +++++++++ .../workflow/config/ConfigurationContainer.java | 10 ++++++ .../config/ConfigurationContainerImpl.java | 21 +++++++++++- 6 files changed, 88 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main/java') 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 eec923cf..a1ebfc44 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 @@ -137,6 +137,9 @@ public class Constants { /** The use of signature fields instead of QR codes */ public static final String CFG_USE_SIGNATURE_FIELDS = "USE_FIELDS"; //$NON-NLS-1$ + + /** */ + public static final String CFG_ENABLE_PLACEHOLDER = "USE_PLACEHOLDER_SEARCH"; //$NON-NLS-1$ /** The signature placeholder transparency config parameter (0-255) */ public static final String CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$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 f9bd68c6..dad4abe8 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 @@ -277,11 +277,36 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fD_grpPlaceholder[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.grpPlaceholder.setFont(new Font(Display.getCurrent(), fD_grpPlaceholder[0])); + + + ///----- + + this.btnEnablePlaceholderUsage = new Button(this.grpPlaceholder, SWT.CHECK); + FormData fd_btnEnablePlaceholderUsage = new FormData(); + fd_btnEnablePlaceholderUsage.right = new FormAttachment(100, -5); + fd_btnEnablePlaceholderUsage.top = new FormAttachment(0, 5); + fd_btnEnablePlaceholderUsage.left = new FormAttachment(0, 5); + this.btnEnablePlaceholderUsage.setLayoutData(fd_btnEnablePlaceholderUsage); + + FontData[] fD_btnEnablePlaceholderUsage = this.btnEnablePlaceholderUsage.getFont().getFontData(); + fD_btnEnablePlaceholderUsage[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnEnablePlaceholderUsage.setFont(new Font(Display.getCurrent(), fD_btnEnablePlaceholderUsage[0])); + + this.btnEnablePlaceholderUsage.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AdvancedConfigurationComposite.this.performUseMarkerSelection( + AdvancedConfigurationComposite.this.btnEnablePlaceholderUsage.getSelection()); + } + }); + + ////---- + this.btnPlatzhalterVerwenden = new Button(this.grpPlaceholder, SWT.RADIO); FormData fd_btnPlatzhalterVerwenden = new FormData(); fd_btnPlatzhalterVerwenden.right = new FormAttachment(100, -5); - fd_btnPlatzhalterVerwenden.top = new FormAttachment(0, 5); + fd_btnPlatzhalterVerwenden.top = new FormAttachment(this.btnEnablePlaceholderUsage, 5); fd_btnPlatzhalterVerwenden.left = new FormAttachment(0, 5); this.btnPlatzhalterVerwenden.setLayoutData(fd_btnPlatzhalterVerwenden); @@ -904,12 +929,18 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setUseMarker(useMarker); this.btnPlatzhalterVerwenden.setSelection(useMarker); } - + void performUseSignatureFieldsSelection(boolean useFields) { this.configurationContainer.setUseSignatureFields(useFields); this.btnSignatureFieldsUsage.setSelection(useFields); } - + + void performEnableUsePlaceholder(boolean enable) { + this.btnPlatzhalterVerwenden.setEnabled(enable); + this.btnSignatureFieldsUsage.setEnabled(enable); + this.configurationContainer.setEnablePlaceholderUsage(enable); + } + void performPdfACompatSelection(boolean compat) { this.configurationContainer.setSignaturePdfACompat(compat); this.btnPdfACompat.setSelection(compat); @@ -1244,6 +1275,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.btnPlatzhalterVerwenden.setToolTipText(Messages.getString("advanced_config.UseMarker_ToolTip")); //$NON-NLS-1$ this.btnSignatureFieldsUsage.setText(Messages.getString("advanced_config.UseSignatureFields")); //$NON-NLS-1$ this.btnSignatureFieldsUsage.setToolTipText(Messages.getString("advanced_config.UseSignatureFields_ToolTip")); //$NON-NLS-1$ + this.btnEnablePlaceholderUsage.setText(Messages.getString("advanced_config.Placeholder_Enabled")); this.btnPdfACompat.setText(Messages .getString("advanced_config.PdfACompat")); //$NON-NLS-1$ this.btnPdfACompat.setToolTipText(Messages 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 0f00e9e3..fba7dd6d 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 @@ -188,6 +188,11 @@ public interface ConfigManipulator { */ public void setUseSignatureFields(boolean useFields); + /** + * @param bool + */ + public void setEnablePlaceholderUsage(boolean bool); + } 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 010e51ad..1a9666fd 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 @@ -140,6 +140,13 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (useSignatureFields != null) { setUseSignatureFields(useSignatureFields.equalsIgnoreCase(Constants.TRUE)); } + + String enablePlaceholder = config.getProperty(Constants.CFG_ENABLE_PLACEHOLDER); + if (enablePlaceholder != null) { + setEnablePlaceholderUsage(enablePlaceholder.equalsIgnoreCase(Constants.TRUE)); + } + + String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); if (compat != null) setSignaturePdfACompat(compat.equalsIgnoreCase(Constants.TRUE)); @@ -1497,4 +1504,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (useFields) setUseMarker(false); } + + @Override + public void setEnablePlaceholderUsage(boolean bool) { + this.configurationOverlay.setEnablePlaceholderUsage(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 52256881..f149f4c4 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 @@ -402,4 +402,14 @@ public interface ConfigurationContainer { * @return if the usage of signatureFields is enabled */ public boolean getUseSignatureFields(); + + /** + * @param bool + */ + public void setEnablePlaceholderUsage(boolean bool); + + /** + * @return + */ + public boolean getEnablePlaceholderUsage(); } 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 558503c6..8269cb0b 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 @@ -136,7 +136,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** Default Download URL for certificates*/ protected String downloadURL = null; - + /** describes if the placeholder search is enabled */ + protected boolean enabledPlaceholderUsage = false; + /** Whether to use an existing signature marker. */ protected boolean useMarker = false; @@ -703,5 +705,22 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { public boolean getUseSignatureFields() { return this.useSignatureFields; } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setEnablePlaceholderUsage(boolean) + */ + @Override + public void setEnablePlaceholderUsage(boolean bool) { + this.enabledPlaceholderUsage = bool; + + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getEnablePlaceholderUsage() + */ + @Override + public boolean getEnablePlaceholderUsage() { + return this.enabledPlaceholderUsage; + } } -- cgit v1.2.3