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 +++++++++++- .../at/asit/pdfover/gui/messages.properties | 1 + .../at/asit/pdfover/gui/messages_de.properties | 1 + 8 files changed, 90 insertions(+), 4 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 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; + } } diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index a8beae98..cf33c2a2 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -47,6 +47,7 @@ advanced_config.SigPHTransparencyMin=Invisible advanced_config.SigPHTransparencyTooltip=Set the transparency of the signature placeholder in the positioning step advanced_config.Signature_Title=Si&gnature advanced_config.Placeholder_Title=Placeholder +advanced_config.Placeholder_Enabled=Enable placeholder search advanced_config.UpdateCheck=Automatically check for updates advanced_config.UpdateCheck_Title=Updates advanced_config.UpdateCheck_ToolTip=Shows a notification when a new version is available diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index 6f35e703..d8dc0c42 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -40,6 +40,7 @@ advanced_config.SigPHTransparencyMin=Unsichtbar advanced_config.SigPHTransparencyTooltip=W\u00E4hlt die Transparenz des Signaturplatzhalters im Schritt "Positionierung" advanced_config.Signature_Title=Si&gnatur advanced_config.Placeholder_Title=Platzhalter +advanced_config.Placeholder_Enabled=Platzhalter Suche aktivieren advanced_config.UpdateCheck=Automatisch auf Updates \u00FCberpr\u00FCfen advanced_config.UpdateCheck_Title=Updates advanced_config.UpdateCheck_ToolTip=Zeigt eine Benachrichtigung, wenn eine neue Version verf\u00FCgbar ist -- cgit v1.2.3