From 135c54f61da53a5f6342d9a4fc947b3d64498625 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Tue, 2 Aug 2022 14:29:11 +0200 Subject: YAGNI: SignatureParameter abstract class --- .../gui/composites/configuration/SimpleConfigurationComposite.java | 6 ++---- .../java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java | 6 +++--- .../java/at/asit/pdfover/gui/workflow/states/PositioningState.java | 4 +--- .../at/asit/pdfover/gui/workflow/states/PrepareSigningState.java | 3 +-- 4 files changed, 7 insertions(+), 12 deletions(-) (limited to 'pdf-over-gui/src/main/java') 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 b00dc00a..c3392a46 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 @@ -67,9 +67,7 @@ import at.asit.pdfover.gui.workflow.config.ConfigurationManager; 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.PdfAs4SignatureParameter; -import at.asit.pdfover.signer.pdfas.PdfAs4Signer; /** * @@ -442,7 +440,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { ImageData logo = null; try { - SignatureParameter param = new PdfAs4SignatureParameter(); + PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) { param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote); } @@ -556,7 +554,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { void setSignatureProfileSetting(){ try { - SignatureParameter param = new PdfAs4SignatureParameter(); + PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); param.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); } catch (Exception e){ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java index 2d9a190b..7d2d444f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.signator.CachedFileNameEmblem; import at.asit.pdfover.signator.Emblem; -import at.asit.pdfover.signator.SignatureParameter; +import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; /** * @@ -61,7 +61,7 @@ public class SignaturePlaceholderCache { * @param param SignatureParameter * @return the placeholder AWT Image */ - public static Image getPlaceholder(SignatureParameter param) { + public static Image getPlaceholder(PdfAs4SignatureParameter param) { final String fileDir = Constants.CONFIG_DIRECTORY; final String imgFileName = Constants.PLACEHOLDER_CACHE_FILENAME; final String imgFileExt = "png"; @@ -144,7 +144,7 @@ public class SignaturePlaceholderCache { * @param param SignatureParameter * @return the placeholder SWT ImageData */ - public static ImageData getSWTPlaceholder(SignatureParameter param) { + public static ImageData getSWTPlaceholder(PdfAs4SignatureParameter param) { return ImageConverter.convertToSWT((BufferedImage) getPlaceholder(param)); } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 1b1a978c..ea6f3003 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -37,10 +37,8 @@ import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.signator.CachedFileNameEmblem; import at.asit.pdfover.signator.Emblem; -import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; -import at.asit.pdfover.signer.pdfas.PdfAs4Signer; /** * Decides where to position the signature block @@ -109,7 +107,7 @@ public class PositioningState extends State { } // Update possibly changed values ConfigurationManager config = stateMachine.configProvider; - SignatureParameter param = new PdfAs4SignatureParameter(); + PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); Emblem emblem = new CachedFileNameEmblem(config.getDefaultEmblem()); param.setEmblem(emblem); if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 57a91da5..e6a10aa6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -34,7 +34,6 @@ import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.signator.CachedFileNameEmblem; import at.asit.pdfover.signator.PDFFileDocumentSource; -import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; import at.asit.pdfover.signer.pdfas.PdfAs4Signer; @@ -168,7 +167,7 @@ public class PrepareSigningState extends State { **/ static final Logger log = LoggerFactory.getLogger(PrepareSigningState.class); - SignatureParameter signatureParameter; + PdfAs4SignatureParameter signatureParameter; private WaitingComposite waitingComposite = null; -- cgit v1.2.3