summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-02 14:18:37 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-02 14:18:37 +0200
commit62a3115ce4d55a7a3b3fbf202bac0fff85dc412b (patch)
tree21259582d60491447e06e941682df7ada3437c46 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration
parent2513de9079b48864c89d7a633a0a4fa43d2f313f (diff)
downloadpdf-over-62a3115ce4d55a7a3b3fbf202bac0fff85dc412b.tar.gz
pdf-over-62a3115ce4d55a7a3b3fbf202bac0fff85dc412b.tar.bz2
pdf-over-62a3115ce4d55a7a3b3fbf202bac0fff85dc412b.zip
YAGNI: PDF signer factory pattern
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java26
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java45
5 files changed, 14 insertions, 83 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java
index fe3442a0..1f1cc1ba 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java
@@ -132,10 +132,6 @@ public class AboutComposite extends ConfigurationCompositeBase {
this.btnOpenLogDirectory.setText(Messages.getString("config.ShowLogDirectory"));
}
-
- @Override
- protected void signerChanged() {}
-
@Override
public void initConfiguration(ConfigurationManager provider) {}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
index 31a10b01..e9776846 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
@@ -455,17 +455,6 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
AdvancedConfigurationComposite.this.txtSaveFilePostFix.setText(postfix);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
- */
- @Override
- protected void signerChanged() {
- // Nothing to do here (yet)
- }
-
void performOutputFolderChanged(String foldername) {
log.debug("Selected Output folder: {}", foldername);
this.configurationContainer.outputFolder = foldername;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
index 16dcd366..54207292 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
@@ -19,7 +19,6 @@ package at.asit.pdfover.gui.composites.configuration;
import org.eclipse.swt.widgets.Composite;
import at.asit.pdfover.gui.composites.StateComposite;
-import at.asit.pdfover.gui.workflow.PDFSigner;
import at.asit.pdfover.gui.workflow.config.ConfigurationManager;
import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory;
import at.asit.pdfover.gui.workflow.states.State;
@@ -35,31 +34,6 @@ public abstract class ConfigurationCompositeBase extends StateComposite {
protected ConfigurationDataInMemory configurationContainer;
/**
- * The PDF Signer used to produce signature block preview
- */
- protected PDFSigner signer;
-
- /**
- * @return the signer
- */
- public PDFSigner getSigner() {
- return this.signer;
- }
-
- /**
- * @param signer the signer to set
- */
- public void setSigner(PDFSigner signer) {
- this.signer = signer;
- this.signerChanged();
- }
-
- /**
- * Called when the signer is changed!
- */
- protected abstract void signerChanged();
-
- /**
* @param parent
* @param style
* @param state
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
index 74d3d62b..14100128 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
@@ -430,17 +430,6 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
/*
* (non-Javadoc)
*
- * @see
- * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
- */
- @Override
- protected void signerChanged() {
- // Nothing to do here (yet)
- }
-
- /*
- * (non-Javadoc)
- *
* @see at.asit.pdfover.gui.composites.StateComposite#doLayout()
*/
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
index 2de930bf..c5ad6f5a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
@@ -68,6 +68,7 @@ import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.CachedFileNameEmblem;
import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signer.pdfas.PdfAs4Signer;
/**
*
@@ -440,22 +441,20 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
ImageData logo = null;
try {
- if (this.signer != null) {
- SignatureParameter param = this.signer.getPDFSigner().newParameter();
- if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) {
- param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote);
- }
+ SignatureParameter param = PdfAs4Signer.newParameter();
+ if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) {
+ param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote);
+ }
- param.setSignatureLanguage(this.configurationContainer.signatureLocale.getLanguage());
- param.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat);
- if (image != null && !image.trim().isEmpty()) {
- logo = new ImageData(image);
- param.setEmblem(new CachedFileNameEmblem(image));
- }
- //TODO deactivated the placeholder preview
- //TODO display accurate placeholder preview -> now its only standard placeholder shown
- //img = SignaturePlaceholderCache.getSWTPlaceholder(param);
+ param.setSignatureLanguage(this.configurationContainer.signatureLocale.getLanguage());
+ param.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat);
+ if (image != null && !image.trim().isEmpty()) {
+ logo = new ImageData(image);
+ param.setEmblem(new CachedFileNameEmblem(image));
}
+ //TODO deactivated the placeholder preview
+ //TODO display accurate placeholder preview -> now its only standard placeholder shown
+ //img = SignaturePlaceholderCache.getSWTPlaceholder(param);
} catch (Exception e) {
log.error("Failed to load image for display...", e);
}
@@ -555,12 +554,8 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
}
void setSignatureProfileSetting(){
- if (this.signer == null){
- log.debug("In setSignatureProfileSettings: Signer was null");
- return;
- }
try {
- SignatureParameter param = this.signer.getPDFSigner().newParameter();
+ SignatureParameter param = PdfAs4Signer.newParameter();
param.setSignatureProfile(this.configurationContainer.getSignatureProfile().name());
} catch (Exception e){
@@ -568,18 +563,6 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
- */
- @Override
- protected void signerChanged() {
- this.setVisibleImage();
- this.setSignatureProfileSetting();
- }
-
private void plainMobileNumberSetter() {
String number = this.txtMobileNumber.getText();
this.configurationContainer.setMobileNumber(number);