From 62fb9bc1e350bfda25463899cf4fb06253763c0c Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 27 Mar 2020 14:42:17 +0100 Subject: ... --- .../at/asit/pdfover/gui/composites/PositioningComposite.java | 1 + .../at/asit/pdfover/gui/utils/CertificateDownloadSource.java | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index 7f42db8f..22d18f2d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -310,6 +310,7 @@ public class PositioningComposite extends StateComposite { if (e.getWheelRotation() < 0) { if (PositioningComposite.this.currentPage > 1) + System.out.println("################## page " + newPage); newPage--; } else if (e.getWheelRotation() > 0) { if (PositioningComposite.this.currentPage < PositioningComposite.this.numPages) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java index ad4fa70e..6ce5b176 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java @@ -85,7 +85,7 @@ public class CertificateDownloadSource { - if (!cp.getProxyHost().equals("")) { + if (!cp.getProxyHost().equals("")) { //$NON-NLS-1$ log.info("Found PDF-Over Host settings: "+cp.getProxyHost().toString()); //$NON-NLS-1$ try{ @@ -103,7 +103,7 @@ public class CertificateDownloadSource { {log.info("Illegal Argument for Proxy and/or Host)");} //$NON-NLS-1$ } else { - log.info("Opening default connection"); + log.info("Opening default connection"); //$NON-NLS-1$ connection = url.openConnection(); } @@ -131,7 +131,7 @@ public class CertificateDownloadSource { Document doc = dBuilder.newDocument(); // root element - Node rootElement = doc.createElement("certificates"); + Node rootElement = doc.createElement("certificates"); //$NON-NLS-1$ doc.appendChild(rootElement); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); @@ -169,7 +169,7 @@ public class CertificateDownloadSource { Node certificates_added = doc_added.getFirstChild(); NodeList certificates_added_list = certificates_added.getChildNodes(); - log.info("===== Starting to download accepted certificates ====="); + log.info("===== Starting to download accepted certificates ====="); //$NON-NLS-1$ // identify the certificate that has to be downloaded for (int i = 0; i < certificates_added_list.getLength(); i++) { @@ -187,7 +187,7 @@ public class CertificateDownloadSource { } URLConnection connection; - if (!certificateNode.getTextContent().equals("")) { + if (!certificateNode.getTextContent().equals("")) { //$NON-NLS-1$ String certResource = Constants.CERTIFICATE_DOWNLOAD_XML_URL + certificateNode.getTextContent(); URL url = new URL(certResource); -- cgit v1.2.3 From 0d7f6f56d7a359d6d67763000712dd6b153f741f Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Wed, 13 May 2020 15:49:20 +0200 Subject: sms tan --- .../src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java | 2 +- .../at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java index 4c8b42e8..fe91dfa9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java @@ -245,7 +245,7 @@ public class ATrustStatus extends AbstractMobileBKUStatusImpl { * @return the smsTan */ public boolean isSmsTan() { - return smsTan; + return this.smsTan; } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index f49ebdc4..f10ea855 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -360,6 +360,8 @@ public class MobileBKUEnterNumberComposite extends StateComposite { public String getMobilePassword() { return this.mobilePassword; } + + /** * @param mobilePassword -- cgit v1.2.3 From ad8cccc8a24e8238dba18f636a138d72f5d77057 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Mon, 9 Nov 2020 13:19:42 +0100 Subject: added new group for signature profile selection --- .../main/java/at/asit/pdfover/gui/Constants.java | 2 + .../gui/composites/ConfigurationComposite.java | 2 + .../composites/SimpleConfigurationComposite.java | 96 ++++++++++++++++++++-- .../workflow/config/ConfigurationContainer.java | 6 ++ .../config/ConfigurationContainerImpl.java | 8 ++ 5 files changed, 106 insertions(+), 8 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 a1ebfc44..5c74b78e 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 @@ -55,6 +55,8 @@ public class Constants { /** Supported locales */ public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH }; + + public static final String[] SUPPORTED_PROFILES = {"Signaturblock Normal", "Signaturblock Klein", "Amtssignaturblock", "Nur Bildmarke"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ /** Configuration directory */ public static final String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index 7396a6b0..dc88834b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -173,6 +173,7 @@ public class ConfigurationComposite extends StateComposite { this.simpleTabItem = new TabItem(this.tabFolder, SWT.NONE); this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + System.out.println(Messages.getString("config.Simple")); ScrolledComposite simpleCompositeScr = new ScrolledComposite(this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); @@ -188,6 +189,7 @@ public class ConfigurationComposite extends StateComposite { this.advancedTabItem = new TabItem(this.tabFolder, SWT.NONE); this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ + System.out.print(Messages.getString("config.Advanced")); ScrolledComposite advancedCompositeScr = new ScrolledComposite( this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index e54b4a59..c3e4a138 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -113,6 +113,11 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { String logoFile; Image sigPreview = null; Image logo = null; + + private final Group grpSingnatureProfile; + private final Label lblSignatureProfile; + private final Combo cmbSingatureProfiles; + /** * @param parent @@ -198,12 +203,80 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { processNumberChanged(); } }); + + + //----------------------------------------------------------------------- + + this.grpSingnatureProfile = new Group(this, SWT.NONE); + + FormData fd_grpSingnatureProfile = new FormData(); + fd_grpSingnatureProfile.right = new FormAttachment(100, -5); + fd_grpSingnatureProfile.left = new FormAttachment(0, 5); + fd_grpSingnatureProfile.top = new FormAttachment(this.grpHandySignatur, 5); + this.grpSingnatureProfile.setLayoutData(fd_grpSingnatureProfile); + this.grpSingnatureProfile.setLayout(new GridLayout(2, false)); + this.grpSingnatureProfile.setText("Signature Profile"); + + + this.lblSignatureProfile = new Label(this.grpSingnatureProfile, SWT.NONE); + + FontData[] fD_grpSingnatureProfile = this.grpSingnatureProfile.getFont() + .getFontData(); + fD_grpSingnatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.grpSingnatureProfile.setFont(new Font(Display.getCurrent(), + fD_grpSingnatureProfile[0])); + + // TODO create text for each language + this.lblSignatureProfile.setText("Profile"); //$NON-NLS-1$ + + FontData[] fD_lblSignatureProfile = this.lblSignatureProfile.getFont() + .getFontData(); + fD_lblSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblSignatureProfile.setFont(new Font(Display.getCurrent(), + fD_lblSignatureProfile[0])); + + this.cmbSingatureProfiles = new Combo(this.grpSingnatureProfile, SWT.READ_ONLY); + FormData fd_cmbSingatureProfiles = new FormData(); + fd_cmbSingatureProfiles.left = new FormAttachment(this.grpSingnatureProfile, 10); + fd_cmbSingatureProfiles.right = new FormAttachment(100, -10); + fd_cmbSingatureProfiles.top = new FormAttachment(0, 10); + fd_cmbSingatureProfiles.bottom = new FormAttachment(100, -10); + this.grpSingnatureProfile.setLayoutData(fd_cmbSingatureProfiles); + + FontData[] fD_cmbSignatureLang = this.grpSingnatureProfile.getFont() + .getFontData(); + fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.grpSingnatureProfile.setFont(new Font(Display.getCurrent(), + fD_cmbSignatureLang[0])); + + String[] profiles = new String[Constants.SUPPORTED_PROFILES.length]; + for (int i = 0; i < Constants.SUPPORTED_PROFILES.length; ++i) { + profiles[i] = Constants.SUPPORTED_PROFILES[i]; + } + this.cmbSignatureLang.setItems(profiles); + this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Locale currentLocale = SimpleConfigurationComposite.this.configurationContainer + .getSignatureLocale(); + String selectedLocale = Constants. + SUPPORTED_PROFILES[SimpleConfigurationComposite.this.cmbSignatureLang + .getSelectionIndex()]; + if (!currentLocale.equals(selectedLocale)) { + performSignatureLangSelectionChanged(selectedLocale, currentLocale); + } + } + }); + + + //------------------------------------------------------------------------ + this.grpLogo = new Group(this, SWT.NONE); FormData fd_grpBildmarke = new FormData(); fd_grpBildmarke.left = new FormAttachment(0, 5); fd_grpBildmarke.right = new FormAttachment(100, -5); - fd_grpBildmarke.top = new FormAttachment(this.grpHandySignatur, 5); + fd_grpBildmarke.top = new FormAttachment(this.grpSingnatureProfile, 5); this.grpLogo.setLayoutData(fd_grpBildmarke); this.grpLogo.setLayout(new FormLayout()); @@ -411,16 +484,16 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_cmbSignatureLang.bottom = new FormAttachment(100, -10); this.cmbSignatureLang.setLayoutData(fd_cmbSignatureLang); - FontData[] fD_cmbSignatureLang = this.cmbSignatureLang.getFont() - .getFontData(); - fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); +// FontData[] fD_cmbSignatureLang = this.cmbSignatureLang.getFont() +// .getFontData(); +// fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.cmbSignatureLang.setFont(new Font(Display.getCurrent(), fD_cmbSignatureLang[0])); - String[] localeSignStrings = new String[Constants.SUPPORTED_LOCALES.length]; - for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; ++i) { - localeSignStrings[i] = Constants.SUPPORTED_LOCALES[i].getDisplayLanguage(); - } +// String[] localeSignStrings = new String[Constants.SUPPORTED_LOCALES.length]; +// for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; ++i) { +// localeSignStrings[i] = Constants.SUPPORTED_LOCALES[i].getDisplayLanguage(); +// } this.cmbSignatureLang.setItems(localeSignStrings); this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { @Override @@ -704,6 +777,13 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { processSignatureNoteChanged(); } } + } + + private void preformProfileSelectionChanged(String selected, String previous) { + + + + } /* 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 d5976b3c..668c8cb7 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 @@ -412,4 +412,10 @@ public interface ConfigurationContainer { * @return boolean */ public boolean getEnablePlaceholderUsage(); + + + /** + * @return selected signature profile as string + */ + public String getSignatureProfile(); } 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 8269cb0b..e6b168dc 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 @@ -144,6 +144,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** Either QR-Code or signature fields as marker */ protected boolean useSignatureFields = false; + + /** The Signature Profile */ + protected String signatureProfile = "Normal"; //$NON-NLS-1$ /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() @@ -723,4 +726,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { return this.enabledPlaceholderUsage; } + @Override + public String getSignatureProfile() { + return this.signatureProfile; + } + } -- cgit v1.2.3 From 01f5b6348cdd84ce765b2235e60f309ebe7fac0c Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Mon, 9 Nov 2020 16:18:42 +0100 Subject: Extending GUI (profiles) + configf --- .../main/java/at/asit/pdfover/gui/Constants.java | 22 ++++- .../composites/SimpleConfigurationComposite.java | 97 ++++++++++++---------- .../config/ConfigurationContainerImpl.java | 1 + 3 files changed, 72 insertions(+), 48 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 5c74b78e..98fac033 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 @@ -56,8 +56,26 @@ public class Constants { /** Supported locales */ public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH }; - public static final String[] SUPPORTED_PROFILES = {"Signaturblock Normal", "Signaturblock Klein", "Amtssignaturblock", "Nur Bildmarke"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - + public static final String[] SUPPORTED_PROFILES_STRINGS = {"Signaturblock Normal", "Signaturblock Klein", "Amtssignaturblock", "Nur Bildmarke"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + public static enum PROFILE { + SIGNATUREBLOCK_NORMAL("Signaturblock Normal"), //$NON-NLS-1$ + SIGNATUREBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ + AMTSSIGNATUREBLOCK("Amtssignaturblock"), //$NON-NLS-1$ + LOGO_ONLY("Nur Bildmarke"); //$NON-NLS-1$ + + public static int length = 4; + private String name; + + PROFILE(String profile){ + this.name = profile; + } + + public String getName() { + return this.name; + } + } + /** Configuration directory */ public static final String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index c3e4a138..b3925775 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -62,6 +62,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; @@ -114,9 +115,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { Image sigPreview = null; Image logo = null; - private final Group grpSingnatureProfile; - private final Label lblSignatureProfile; + private final Group grpSignatureProfile; +// private final Label lblSignatureProfile; private final Combo cmbSingatureProfiles; + /** @@ -207,63 +209,66 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { //----------------------------------------------------------------------- - this.grpSingnatureProfile = new Group(this, SWT.NONE); + this.grpSignatureProfile = new Group(this, SWT.NONE); FormData fd_grpSingnatureProfile = new FormData(); fd_grpSingnatureProfile.right = new FormAttachment(100, -5); fd_grpSingnatureProfile.left = new FormAttachment(0, 5); fd_grpSingnatureProfile.top = new FormAttachment(this.grpHandySignatur, 5); - this.grpSingnatureProfile.setLayoutData(fd_grpSingnatureProfile); - this.grpSingnatureProfile.setLayout(new GridLayout(2, false)); - this.grpSingnatureProfile.setText("Signature Profile"); - + this.grpSignatureProfile.setLayoutData(fd_grpSingnatureProfile); + //this.grpSignatureProfile.setLayout(new GridLayout(2, false)); + this.grpSignatureProfile.setText("Signature Profile"); //$NON-NLS-1$ - this.lblSignatureProfile = new Label(this.grpSingnatureProfile, SWT.NONE); - FontData[] fD_grpSingnatureProfile = this.grpSingnatureProfile.getFont() +// this.lblSignatureProfile = new Label(this.grpSignatureProfile, SWT.NONE); +// + FontData[] fD_grpSignatureProfile = this.grpSignatureProfile.getFont() .getFontData(); - fD_grpSingnatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpSingnatureProfile.setFont(new Font(Display.getCurrent(), - fD_grpSingnatureProfile[0])); + fD_grpSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.grpSignatureProfile.setFont(new Font(Display.getCurrent(), + fD_grpSignatureProfile[0])); // TODO create text for each language - this.lblSignatureProfile.setText("Profile"); //$NON-NLS-1$ +// this.lblSignatureProfile.setText("Profile"); //$NON-NLS-1$ +// +// FontData[] fD_lblSignatureProfile = this.lblSignatureProfile.getFont() +// .getFontData(); +// fD_lblSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); +// this.lblSignatureProfile.setFont(new Font(Display.getCurrent(), +// fD_lblSignatureProfile[0])); - FontData[] fD_lblSignatureProfile = this.lblSignatureProfile.getFont() - .getFontData(); - fD_lblSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblSignatureProfile.setFont(new Font(Display.getCurrent(), - fD_lblSignatureProfile[0])); + this.cmbSingatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); - this.cmbSingatureProfiles = new Combo(this.grpSingnatureProfile, SWT.READ_ONLY); FormData fd_cmbSingatureProfiles = new FormData(); - fd_cmbSingatureProfiles.left = new FormAttachment(this.grpSingnatureProfile, 10); + fd_cmbSingatureProfiles.left = new FormAttachment(0, 10); fd_cmbSingatureProfiles.right = new FormAttachment(100, -10); fd_cmbSingatureProfiles.top = new FormAttachment(0, 10); fd_cmbSingatureProfiles.bottom = new FormAttachment(100, -10); - this.grpSingnatureProfile.setLayoutData(fd_cmbSingatureProfiles); + this.cmbSingatureProfiles.setLayoutData(fd_cmbSingatureProfiles); - FontData[] fD_cmbSignatureLang = this.grpSingnatureProfile.getFont() - .getFontData(); - fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpSingnatureProfile.setFont(new Font(Display.getCurrent(), - fD_cmbSignatureLang[0])); - String[] profiles = new String[Constants.SUPPORTED_PROFILES.length]; - for (int i = 0; i < Constants.SUPPORTED_PROFILES.length; ++i) { - profiles[i] = Constants.SUPPORTED_PROFILES[i]; + FontData[] fD_cmbSignatureProfile = this.grpSignatureProfile.getFont() + .getFontData(); + fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.grpSignatureProfile.setFont(new Font(Display.getCurrent(), + fD_cmbSignatureProfile[0])); + + String[] profiles = new String[PROFILE.length]; + int i = 0; + for (PROFILE profile : PROFILE.values()) { + profiles[i] = profile.name(); + i++; } - this.cmbSignatureLang.setItems(profiles); - this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { + + this.cmbSingatureProfiles.setItems(profiles); + this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - Locale currentLocale = SimpleConfigurationComposite.this.configurationContainer - .getSignatureLocale(); - String selectedLocale = Constants. - SUPPORTED_PROFILES[SimpleConfigurationComposite.this.cmbSignatureLang + String current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); + String selected = profiles[SimpleConfigurationComposite.this.cmbSingatureProfiles .getSelectionIndex()]; - if (!currentLocale.equals(selectedLocale)) { - performSignatureLangSelectionChanged(selectedLocale, currentLocale); + if (!current.equals(selected)) { + preformProfileSelectionChanged(selected, current); } } }); @@ -276,7 +281,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { FormData fd_grpBildmarke = new FormData(); fd_grpBildmarke.left = new FormAttachment(0, 5); fd_grpBildmarke.right = new FormAttachment(100, -5); - fd_grpBildmarke.top = new FormAttachment(this.grpSingnatureProfile, 5); + fd_grpBildmarke.top = new FormAttachment(this.grpSignatureProfile, 5); this.grpLogo.setLayoutData(fd_grpBildmarke); this.grpLogo.setLayout(new FormLayout()); @@ -484,16 +489,16 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_cmbSignatureLang.bottom = new FormAttachment(100, -10); this.cmbSignatureLang.setLayoutData(fd_cmbSignatureLang); -// FontData[] fD_cmbSignatureLang = this.cmbSignatureLang.getFont() -// .getFontData(); -// fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); + FontData[] fD_cmbSignatureLang = this.cmbSignatureLang.getFont() + .getFontData(); + fD_cmbSignatureLang[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.cmbSignatureLang.setFont(new Font(Display.getCurrent(), fD_cmbSignatureLang[0])); -// String[] localeSignStrings = new String[Constants.SUPPORTED_LOCALES.length]; -// for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; ++i) { -// localeSignStrings[i] = Constants.SUPPORTED_LOCALES[i].getDisplayLanguage(); -// } + String[] localeSignStrings = new String[Constants.SUPPORTED_LOCALES.length]; + for (int idx = 0; idx < Constants.SUPPORTED_LOCALES.length; ++idx) { + localeSignStrings[idx] = Constants.SUPPORTED_LOCALES[idx].getDisplayLanguage(); + } this.cmbSignatureLang.setItems(localeSignStrings); this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { @Override @@ -778,8 +783,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } } } - private void preformProfileSelectionChanged(String selected, String previous) { + 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 e6b168dc..be2444a0 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 @@ -726,6 +726,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { return this.enabledPlaceholderUsage; } + @Override public String getSignatureProfile() { return this.signatureProfile; -- cgit v1.2.3 From a27fdd91c4ba25f7d99c8c916fc7b8cdfc8a2f13 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 10 Nov 2020 09:46:16 +0100 Subject: Not showing combo fixed --- .../composites/SimpleConfigurationComposite.java | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index b3925775..00df4a99 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -119,6 +119,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { // private final Label lblSignatureProfile; private final Combo cmbSingatureProfiles; + /** @@ -210,32 +211,21 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { //----------------------------------------------------------------------- this.grpSignatureProfile = new Group(this, SWT.NONE); - FormData fd_grpSingnatureProfile = new FormData(); fd_grpSingnatureProfile.right = new FormAttachment(100, -5); fd_grpSingnatureProfile.left = new FormAttachment(0, 5); fd_grpSingnatureProfile.top = new FormAttachment(this.grpHandySignatur, 5); this.grpSignatureProfile.setLayoutData(fd_grpSingnatureProfile); - //this.grpSignatureProfile.setLayout(new GridLayout(2, false)); +// this.grpSignatureProfile.setLayout(new GridLayout(2, false)); this.grpSignatureProfile.setText("Signature Profile"); //$NON-NLS-1$ - - -// this.lblSignatureProfile = new Label(this.grpSignatureProfile, SWT.NONE); -// + this.grpSignatureProfile.setLayout(new FormLayout()); + FontData[] fD_grpSignatureProfile = this.grpSignatureProfile.getFont() .getFontData(); fD_grpSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.grpSignatureProfile.setFont(new Font(Display.getCurrent(), fD_grpSignatureProfile[0])); - // TODO create text for each language -// this.lblSignatureProfile.setText("Profile"); //$NON-NLS-1$ -// -// FontData[] fD_lblSignatureProfile = this.lblSignatureProfile.getFont() -// .getFontData(); -// fD_lblSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); -// this.lblSignatureProfile.setFont(new Font(Display.getCurrent(), -// fD_lblSignatureProfile[0])); this.cmbSingatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); @@ -246,11 +236,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_cmbSingatureProfiles.bottom = new FormAttachment(100, -10); this.cmbSingatureProfiles.setLayoutData(fd_cmbSingatureProfiles); - - FontData[] fD_cmbSignatureProfile = this.grpSignatureProfile.getFont() + FontData[] fD_cmbSignatureProfile = this.cmbSingatureProfiles.getFont() .getFontData(); fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpSignatureProfile.setFont(new Font(Display.getCurrent(), + this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); String[] profiles = new String[PROFILE.length]; -- cgit v1.2.3 From 270ea55dd1d77f4bac549ddc2cfef00393744e7a Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 10 Nov 2020 11:51:36 +0100 Subject: Signature Profile selection in GUI --- .../main/java/at/asit/pdfover/gui/Constants.java | 34 +++++++++++++++++++++- .../composites/SimpleConfigurationComposite.java | 34 +++++++--------------- .../workflow/config/ConfigurationContainer.java | 9 +++++- .../config/ConfigurationContainerImpl.java | 10 +++++-- 4 files changed, 59 insertions(+), 28 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 98fac033..7cb58f74 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 @@ -23,6 +23,7 @@ import java.util.Properties; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; @@ -59,7 +60,7 @@ public class Constants { public static final String[] SUPPORTED_PROFILES_STRINGS = {"Signaturblock Normal", "Signaturblock Klein", "Amtssignaturblock", "Nur Bildmarke"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ public static enum PROFILE { - SIGNATUREBLOCK_NORMAL("Signaturblock Normal"), //$NON-NLS-1$ + SIGNATUREBLOCK_NORMAL("Signaturblock Normal") , //$NON-NLS-1$ SIGNATUREBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ AMTSSIGNATUREBLOCK("Amtssignaturblock"), //$NON-NLS-1$ LOGO_ONLY("Nur Bildmarke"); //$NON-NLS-1$ @@ -71,9 +72,40 @@ public class Constants { this.name = profile; } + public static String[] getProfileStrings() { + String[] profiles = new String[PROFILE.length]; + int i = 0; + for (PROFILE profile : PROFILE.values()) { + profiles[i] = profile.getName(); + i++; + } + return profiles; + } + + public static PROFILE getProfileByIndex(int index) { + String[] profiles = getProfileStrings(); + if (profiles.length < index) { + return null; + } + return getProfile(profiles[index]); + } + public String getName() { return this.name; } + + public static PROFILE getProfile(String profile) { + if (SIGNATUREBLOCK_NORMAL.getName().equals(profile)) { + return SIGNATUREBLOCK_NORMAL; + } else if (SIGNATUREBLOCK_SMALL.getName().equals(profile)) { + return SIGNATUREBLOCK_SMALL; + } else if (AMTSSIGNATUREBLOCK.getName().equals(profile)) { + return AMTSSIGNATUREBLOCK; + } else if (LOGO_ONLY.getName().equals(profile)) { + return LOGO_ONLY; + } + return null; + } } /** Configuration directory */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 00df4a99..6737c194 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -116,7 +116,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { Image logo = null; private final Group grpSignatureProfile; -// private final Label lblSignatureProfile; private final Combo cmbSingatureProfiles; @@ -216,7 +215,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_grpSingnatureProfile.left = new FormAttachment(0, 5); fd_grpSingnatureProfile.top = new FormAttachment(this.grpHandySignatur, 5); this.grpSignatureProfile.setLayoutData(fd_grpSingnatureProfile); -// this.grpSignatureProfile.setLayout(new GridLayout(2, false)); this.grpSignatureProfile.setText("Signature Profile"); //$NON-NLS-1$ this.grpSignatureProfile.setLayout(new FormLayout()); @@ -241,30 +239,20 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); - - String[] profiles = new String[PROFILE.length]; - int i = 0; - for (PROFILE profile : PROFILE.values()) { - profiles[i] = profile.name(); - i++; - } - - this.cmbSingatureProfiles.setItems(profiles); + this.cmbSingatureProfiles.setItems(PROFILE.getProfileStrings()); + this.configurationContainer.getSignatureProfile(); + this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal()); this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - String current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); - String selected = profiles[SimpleConfigurationComposite.this.cmbSingatureProfiles - .getSelectionIndex()]; + PROFILE current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); + PROFILE selected = PROFILE.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles + .getSelectionIndex()); if (!current.equals(selected)) { - preformProfileSelectionChanged(selected, current); + preformProfileSelectionChanged(selected); } } }); - - - //------------------------------------------------------------------------ - this.grpLogo = new Group(this, SWT.NONE); FormData fd_grpBildmarke = new FormData(); @@ -772,12 +760,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } } } - private void preformProfileSelectionChanged(String selected, String previous) { - - - - + void preformProfileSelectionChanged(PROFILE selected) { + log.debug("Signature Profile {0} was selected", selected.getName()); + this.configurationContainer.setSignatureProfile(selected); } /* 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 668c8cb7..18145d4f 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 @@ -19,6 +19,7 @@ import java.util.Locale; import org.eclipse.swt.graphics.Point; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -414,8 +415,14 @@ public interface ConfigurationContainer { public boolean getEnablePlaceholderUsage(); + /** + * @param profile set the selected profile + */ + public void setSignatureProfile(PROFILE profile); + + /** * @return selected signature profile as string */ - public String getSignatureProfile(); + public PROFILE getSignatureProfile(); } 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 be2444a0..b3232cfe 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 @@ -28,6 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; @@ -146,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected boolean useSignatureFields = false; /** The Signature Profile */ - protected String signatureProfile = "Normal"; //$NON-NLS-1$ + protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; //$NON-NLS-1$ /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() @@ -728,8 +729,13 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { @Override - public String getSignatureProfile() { + public PROFILE getSignatureProfile() { return this.signatureProfile; } + @Override + public void setSignatureProfile(PROFILE profile) { + this.signatureProfile = profile; + } + } -- cgit v1.2.3 From 17a8b0011e749af61fa41afdc221169a579ac688 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 10 Nov 2020 13:51:09 +0100 Subject: added signature profile to the config --- .../main/java/at/asit/pdfover/gui/Constants.java | 2 ++ .../composites/AdvancedConfigurationComposite.java | 2 ++ .../composites/SimpleConfigurationComposite.java | 2 ++ .../gui/workflow/config/ConfigManipulator.java | 5 ++++ .../workflow/config/ConfigOverlayManipulator.java | 6 +++++ .../gui/workflow/config/ConfigProvider.java | 13 ++++++++++ .../gui/workflow/config/ConfigProviderImpl.java | 30 ++++++++++++---------- .../workflow/config/ConfigurationContainer.java | 4 --- .../config/ConfigurationContainerImpl.java | 2 +- .../workflow/config/PersistentConfigProvider.java | 6 +++++ 10 files changed, 54 insertions(+), 18 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 7cb58f74..dd53b1d3 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 @@ -40,6 +40,8 @@ public class Constants { /** Application name + version */ public static final String APP_NAME_VERSION = (APP_VERSION == null ? APP_NAME : APP_NAME + " v" + APP_VERSION); //$NON-NLS-1$ + + public static final String SIGNATURE_PROFILE = "SIGNATURE_PROFILE"; //$NON-NLS-1$ static { // Has to be set before (implicitly) initializing Display 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 bbcf6b9c..fe4cfc28 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 @@ -1183,6 +1183,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { store.setLocale(this.configurationContainer.getLocale()); store.setUpdateCheck(this.configurationContainer.getUpdateCheck()); + + store.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); String hostOld = provider.getProxyHostPersistent(); String hostNew = this.configurationContainer.getProxyHost(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 6737c194..147f17eb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -886,6 +886,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { store.setSignatureLocale(this.configurationContainer.getSignatureLocale()); store.setSignatureNote(this.configurationContainer.getSignatureNote()); + + store.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); } /* 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 abed492a..3aba5075 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 @@ -197,6 +197,11 @@ public interface ConfigManipulator { * @return */ public boolean getEnablePlaceholderUsage(); + + /** + * @param profile + */ + void setSignatureProfile(String profile); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java index 44c4a9c9..9b54f4ee 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java @@ -131,4 +131,10 @@ public interface ConfigOverlayManipulator { * @param configurationFile */ public void setConfigurationFile(String configurationFile); + + /** + * + * @param profile + */ + public void setSignatureProfile(String profile); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index 4c674d17..efe0a83b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -265,4 +265,17 @@ public interface ConfigProvider { * @return */ public boolean getEnablePlaceholderUsage(); + + /** + * @param profile + */ + public void setSignatureProfile(String profile); + + + /** + * @return + */ + public String getSignatureProfile(); } + + 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 bd149cf7..b6acb392 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 @@ -30,6 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -112,11 +113,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, // Set Output Folder setDefaultOutputFolder(config .getProperty(Constants.CFG_OUTPUT_FOLDER)); - - // Set Default Certificate Download URL - // .getProperty(Constants.CFG_DOWNLOAD_URL)); - - String localeString = config.getProperty(Constants.CFG_LOCALE); @@ -146,6 +142,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setEnablePlaceholderUsage(enablePlaceholder.equalsIgnoreCase(Constants.TRUE)); } + String signatureProfile = config.getProperty(Constants.SIGNATURE_PROFILE); + if (signatureProfile != null) { + this.configuration.setSignatureProfile(PROFILE.getProfile(signatureProfile)); + } String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); if (compat != null) @@ -158,14 +158,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, this.configuration.setMobileBKUURL(bkuUrl); } - /*String downloadURL = config - .getProperty(Constants.CFG_DOWNLOAD_URL); - - if (downloadURL != null && !downloadURL.isEmpty()) { - this.configuration.setDownloadURL(downloadURL); - }*/ - - String bkuType = config .getProperty(Constants.CFG_MOBILE_BKU_TYPE); @@ -434,6 +426,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (!getUpdateCheck()) props.setProperty(Constants.CFG_UPDATE_CHECK, Constants.FALSE); + props.setProperty(Constants.SIGNATURE_PROFILE, getSignatureProfile()); + FileOutputStream outputstream = new FileOutputStream(configFile, false); @@ -1511,6 +1505,16 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (useFields) setUseMarker(false); } + @Override + public void setSignatureProfile(String profile) { + this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(profile)); + } + + @Override + public String getSignatureProfile() { + return this.configurationOverlay.getSignatureProfile().getName(); + } + @Override public void setEnablePlaceholderUsage(boolean 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 18145d4f..8b08ba9f 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 @@ -153,10 +153,6 @@ public interface ConfigurationContainer { * @return the default BKU */ public BKUs getDefaultBKU(); - - - - /** * Sets the default BKU 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 b3232cfe..3f0021f7 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 @@ -147,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected boolean useSignatureFields = false; /** The Signature Profile */ - protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; //$NON-NLS-1$ + protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java index e217b3c8..3304b6ca 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java @@ -199,4 +199,10 @@ public interface PersistentConfigProvider { * @return */ public boolean getEnablePlaceholderUsage(); + + /*** + * + * @return the signature profile + */ + public String getSignatureProfile(); } -- cgit v1.2.3 From 0b920b2d10e7844f4ba2f02e0191438808d8d4e0 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Wed, 11 Nov 2020 15:32:36 +0100 Subject: fixed bug in configuration --- .../composites/AdvancedConfigurationComposite.java | 180 ++------------------- .../composites/SimpleConfigurationComposite.java | 43 +++-- .../gui/workflow/config/ConfigProviderImpl.java | 1 + .../config/ConfigurationContainerImpl.java | 5 +- 4 files changed, 39 insertions(+), 190 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 fe4cfc28..e9ed5316 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 @@ -48,6 +48,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; @@ -113,12 +114,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { private Label lblProxyPort; private Text txtProxyPort; private ErrorMarker txtProxyPortErrorMarker; -// private Label lblProxyUser; -// private Text txtProxyUser; -// private ErrorMarker proxyUserErrorMarker; -// private Label lblProxyPass; -// private Text txtProxyPass; -// private ErrorMarker proxyPassErrorMarker; FormData fd_txtProxyPort; FormData fd_txtProxyPortErrorMarker; @@ -719,119 +714,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { processProxyPortChanged(); } }); - -// this.lblProxyUser = new Label(this.grpProxy, SWT.NONE); -// GridData gd_lblProxyUser = new GridData(SWT.LEFT, SWT.CENTER, false, -// false, 1, 1); -// gd_lblProxyUser.widthHint = 80; -// this.lblProxyUser.setLayoutData(gd_lblProxyUser); -// this.lblProxyUser.setBounds(0, 0, 57, 15); -// -// FontData[] fD_lblProxyUser = this.lblProxyUser.getFont().getFontData(); -// fD_lblProxyUser[0].setHeight(Constants.TEXT_SIZE_NORMAL); -// this.lblProxyUser.setFont(new Font(Display.getCurrent(), -// fD_lblProxyUser[0])); -// -// Composite compProxyUserContainer = new Composite(this.grpProxy, SWT.NONE); -// compProxyUserContainer.setLayout(new FormLayout()); -// compProxyUserContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, -// 1, 1)); -// this.txtProxyUser = new Text(compProxyUserContainer, SWT.BORDER); -// FormData fd_txtProxyUser = new FormData(); -// fd_txtProxyUser.right = new FormAttachment(100, -42); -// fd_txtProxyUser.top = new FormAttachment(0); -// fd_txtProxyUser.left = new FormAttachment(0, 5); -// -// FontData[] fD_txtProxyUser = this.txtProxyUser.getFont().getFontData(); -// fD_txtProxyUser[0].setHeight(Constants.TEXT_SIZE_NORMAL); -// this.txtProxyUser.setFont(new Font(Display.getCurrent(), -// fD_txtProxyUser[0])); -// -// this.proxyUserErrorMarker = new ErrorMarker(compProxyUserContainer, SWT.NONE, ""); //$NON-NLS-1$ -// -// FormData fd_proxyUserErrorMarker = new FormData(); -// fd_proxyUserErrorMarker.left = new FormAttachment(100, -32); -// fd_proxyUserErrorMarker.right = new FormAttachment(100); -// fd_proxyUserErrorMarker.top = new FormAttachment(0); -// fd_proxyUserErrorMarker.bottom = new FormAttachment(0, 32); -// -// this.proxyUserErrorMarker.setLayoutData(fd_proxyUserErrorMarker); -// this.proxyUserErrorMarker.setVisible(false); -// this.txtProxyUser.setLayoutData(fd_txtProxyUser); -// -// this.txtProxyUser.addFocusListener(new FocusAdapter() { -// -// @Override -// public void focusLost(FocusEvent e) { -// processProxyUserChanged(); -// } -// }); -// -// this.txtProxyUser.addTraverseListener(new TraverseListener() { -// -// @Override -// public void keyTraversed(TraverseEvent e) { -// if (e.detail == SWT.TRAVERSE_RETURN) { -// processProxyUserChanged(); -// } -// } -// }); -// -// this.lblProxyPass = new Label(this.grpProxy, SWT.NONE); -// this.lblProxyPass.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, -// false, false, 1, 1)); -// this.lblProxyPass.setBounds(0, 0, 57, 15); -// -// FontData[] fD_lblProxyPass = this.lblProxyPass.getFont().getFontData(); -// fD_lblProxyPass[0].setHeight(Constants.TEXT_SIZE_NORMAL); -// this.lblProxyPass.setFont(new Font(Display.getCurrent(), -// fD_lblProxyPass[0])); -// -// Composite compProxyPassContainer = new Composite(this.grpProxy, SWT.NONE); -// compProxyPassContainer.setLayout(new FormLayout()); -// compProxyPassContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, -// 1, 1)); -// this.txtProxyPass = new Text(compProxyPassContainer, SWT.PASSWORD | SWT.BORDER); -// FormData fd_txtProxyPass = new FormData(); -// fd_txtProxyPass.right = new FormAttachment(100, -42); -// fd_txtProxyPass.top = new FormAttachment(0); -// fd_txtProxyPass.left = new FormAttachment(0, 5); -// -// FontData[] fD_txtProxyPass = this.txtProxyPass.getFont().getFontData(); -// fD_txtProxyPass[0].setHeight(Constants.TEXT_SIZE_NORMAL); -// this.txtProxyPass.setFont(new Font(Display.getCurrent(), -// fD_txtProxyPass[0])); -// -// this.proxyPassErrorMarker = new ErrorMarker(compProxyPassContainer, SWT.NONE, ""); //$NON-NLS-1$ -// -// FormData fd_proxyPassErrorMarker = new FormData(); -// fd_proxyPassErrorMarker.left = new FormAttachment(100, -32); -// fd_proxyPassErrorMarker.right = new FormAttachment(100); -// fd_proxyPassErrorMarker.top = new FormAttachment(0); -// fd_proxyPassErrorMarker.bottom = new FormAttachment(0, 32); -// -// this.proxyPassErrorMarker.setLayoutData(fd_proxyPassErrorMarker); -// this.proxyPassErrorMarker.setVisible(false); -// this.txtProxyPass.setLayoutData(fd_txtProxyPass); -// -// this.txtProxyPass.addFocusListener(new FocusAdapter() { -// -// @Override -// public void focusLost(FocusEvent e) { -// processProxyPassChanged(); -// } -// }); -// -// this.txtProxyPass.addTraverseListener(new TraverseListener() { -// -// @Override -// public void keyTraversed(TraverseEvent e) { -// if (e.detail == SWT.TRAVERSE_RETURN) { -// processProxyPassChanged(); -// } -// } -// }); - reloadResources(); } @@ -990,44 +872,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setProxyHost(host); } -// void processProxyUserChanged() { -// try { -// this.proxyUserErrorMarker.setVisible(false); -// plainProxyUserSetter(); -// } catch (Exception ex) { -// this.proxyUserErrorMarker.setVisible(true); -// this.proxyUserErrorMarker.setToolTipText(ex.getMessage()); -// log.error("processProxyUser: ", ex); //$NON-NLS-1$ -// } -// } -// -// /** -// * -// */ -// private void plainProxyUserSetter() { -// String user = this.txtProxyUser.getText(); -// this.configurationContainer.setProxyUser(user); -// } -// -// void processProxyPassChanged() { -// try { -// this.proxyPassErrorMarker.setVisible(false); -// plainProxyPassSetter(); -// } catch (Exception ex) { -// this.proxyPassErrorMarker.setVisible(true); -// this.proxyPassErrorMarker.setToolTipText(ex.getMessage()); -// log.error("processProxyPass: ", ex); //$NON-NLS-1$ -// } -// } -// -// /** -// * -// */ -// private void plainProxyPassSetter() { -// String pass = this.txtProxyPass.getText(); -// this.configurationContainer.setProxyPass(pass); -// } - void processProxyPortChanged() { try { this.txtProxyPortErrorMarker.setVisible(false); @@ -1109,6 +953,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { provider.getProxyUserPersistent()); this.configurationContainer.setProxyPass( provider.getProxyPassPersistent()); + this.configurationContainer.setSignatureProfile(PROFILE.getProfile(provider.getSignatureProfile())); } /* @@ -1136,6 +981,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { performPdfACompatSelection(this.configurationContainer.getSignaturePdfACompat()); performKeystoreEnabledSelection(this.configurationContainer.getKeyStoreEnabled()); performUpdateCheckSelection(this.configurationContainer.getUpdateCheck()); + performSetSignatureProfile(this.configurationContainer.getSignatureProfile()); + int port = this.configurationContainer.getProxyPort(); if (port > 0) { @@ -1146,19 +993,18 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { if (host != null) { this.txtProxyHost.setText(host); } - - /*String user = this.configurationContainer.getProxyUser(); - if (user != null) { - this.txtProxyUser.setText(user); - } - - String pass = this.configurationContainer.getProxyPass(); - if (pass != null) { - this.txtProxyPass.setText(pass); - }*/ + } + /** + * @param profile + * + */ + public void performSetSignatureProfile(PROFILE profile) { + this.configurationContainer.setSignatureProfile(profile); + } + /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration(at.asit.pdfover.gui.workflow.config.ConfigManipulator, at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 147f17eb..4e18cd52 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -91,32 +91,32 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { private Group grpHandySignatur; private Label lblMobileNumber; - Text txtMobileNumber; - FormData fd_txtMobileNumber; - ErrorMarker txtMobileNumberErrorMarker; - FormData fd_txtMobileNumberErrorMarker; + protected Text txtMobileNumber; + protected FormData fd_txtMobileNumber; + protected ErrorMarker txtMobileNumberErrorMarker; + protected FormData fd_txtMobileNumberErrorMarker; private Group grpLogo; private Canvas cLogo; private Label lblDropLogo; - Button btnClearImage; + protected Button btnClearImage; private Button btnBrowseLogo; - Canvas cSigPreview; + protected Canvas cSigPreview; private Group grpSignatureNote; private Label lblSignatureNote; - Text txtSignatureNote; + protected Text txtSignatureNote; private Button btnSignatureNoteDefault; - private Group grpSignatureLang; - Combo cmbSignatureLang; + protected final Group grpSignatureLang; + protected final Combo cmbSignatureLang; - String logoFile; - Image sigPreview = null; - Image logo = null; + protected String logoFile = null; + protected Image sigPreview = null; + protected Image logo = null; - private final Group grpSignatureProfile; - private final Combo cmbSingatureProfiles; + protected final Group grpSignatureProfile; + protected final Combo cmbSingatureProfiles; @@ -205,10 +205,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { processNumberChanged(); } }); - - - //----------------------------------------------------------------------- - + this.grpSignatureProfile = new Group(this, SWT.NONE); FormData fd_grpSingnatureProfile = new FormData(); fd_grpSingnatureProfile.right = new FormAttachment(100, -5); @@ -240,8 +237,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); this.cmbSingatureProfiles.setItems(PROFILE.getProfileStrings()); - this.configurationContainer.getSignatureProfile(); - this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal()); + //this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal()); this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -324,7 +320,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { FormData fd_lbl_drop = new FormData(); fd_lbl_drop.left = new FormAttachment(0, 20); fd_lbl_drop.right = new FormAttachment(100, -20); - // fd_lbl_drop.top = new FormAttachment(50, -20); fd_lbl_drop.bottom = new FormAttachment(this.btnBrowseLogo, -20); this.lblDropLogo.setLayoutData(fd_lbl_drop); @@ -762,8 +757,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } void preformProfileSelectionChanged(PROFILE selected) { - log.debug("Signature Profile {0} was selected", selected.getName()); + log.debug("Signature Profile {} was selected", selected.getName()); //$NON-NLS-1$ this.configurationContainer.setSignatureProfile(selected); + this.cmbSingatureProfiles.select(selected.ordinal()); } /* @@ -871,6 +867,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.setVisibleImage(); this.performSignatureLangSelectionChanged(this.configurationContainer.getSignatureLocale(), null); + + this.preformProfileSelectionChanged(this.configurationContainer.getSignatureProfile()); + } /* (non-Javadoc) 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 b6acb392..f1461809 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 @@ -145,6 +145,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, String signatureProfile = config.getProperty(Constants.SIGNATURE_PROFILE); if (signatureProfile != null) { this.configuration.setSignatureProfile(PROFILE.getProfile(signatureProfile)); + this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(signatureProfile)); } String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); 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 3f0021f7..32b5ece3 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 @@ -147,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected boolean useSignatureFields = false; /** The Signature Profile */ - protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; + protected PROFILE signatureProfile = null; /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() @@ -730,6 +730,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { @Override public PROFILE getSignatureProfile() { + if (this.signatureProfile == null) { + this.signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; + } return this.signatureProfile; } -- cgit v1.2.3 From a50acb0863935747edbf1ebccf000d28822dc2db Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 12 Nov 2020 09:54:44 +0100 Subject: settings --- pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java | 2 -- 1 file changed, 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 dd53b1d3..37e7ceb6 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 @@ -59,8 +59,6 @@ public class Constants { /** Supported locales */ public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH }; - public static final String[] SUPPORTED_PROFILES_STRINGS = {"Signaturblock Normal", "Signaturblock Klein", "Amtssignaturblock", "Nur Bildmarke"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - public static enum PROFILE { SIGNATUREBLOCK_NORMAL("Signaturblock Normal") , //$NON-NLS-1$ SIGNATUREBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ -- cgit v1.2.3 From 1eddc2b51034df2ce3e814c297311e27dccacee1 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 12 Nov 2020 14:13:18 +0100 Subject: fixed problem handing over the selected profile to pdf-as4 signer --- .../gui/composites/SimpleConfigurationComposite.java | 14 ++++++++++++-- .../pdfover/gui/workflow/states/PrepareSigningState.java | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 4e18cd52..26f67da3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -663,8 +663,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { try { if (this.signer != null) { - SignatureParameter param = this.signer.getPDFSigner() - .newParameter(); + SignatureParameter param = this.signer.getPDFSigner().newParameter(); if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$ } @@ -762,6 +761,16 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.cmbSingatureProfiles.select(selected.ordinal()); } + void setSignatureProfileSetting(){ + try { + SignatureParameter param = this.signer.getPDFSigner().newParameter(); + param.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); + + } catch (Exception e){ + log.debug("Cannot save siganture profile" + e.getMessage()); + } + } + /* * (non-Javadoc) * @@ -771,6 +780,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { @Override protected void signerChanged() { this.setVisibleImage(); + this.setSignatureProfileSetting(); } /** 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 f9827ba4..9d17a3e8 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 @@ -166,6 +166,8 @@ public class PrepareSigningState extends State { this.state.signatureParameter .setSignaturePdfACompat(configuration.getSignaturePdfACompat()); + this.state.signatureParameter.setSignatureProfile(configuration.getSignatureProfile()); + this.state.signingState = this.state.signer .prepare(this.state.signatureParameter); @@ -199,7 +201,7 @@ public class PrepareSigningState extends State { at.asit.pdfover.signator.SigningState signingState = null; - Signer signer; + Signer signer; Exception threadException = null; -- cgit v1.2.3 From be14be9262cfd2a5f4b811fcbc9f5dfa8b43c3f6 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 12 Nov 2020 14:25:36 +0100 Subject: Invisible signatures to availabel profiles added --- pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 37e7ceb6..cbfd8e24 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 @@ -62,10 +62,11 @@ public class Constants { public static enum PROFILE { SIGNATUREBLOCK_NORMAL("Signaturblock Normal") , //$NON-NLS-1$ SIGNATUREBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ - AMTSSIGNATUREBLOCK("Amtssignaturblock"), //$NON-NLS-1$ - LOGO_ONLY("Nur Bildmarke"); //$NON-NLS-1$ + AMTSSIGNATUREBLOCK("Amtssignatur"), //$NON-NLS-1$ + LOGO_ONLY("Nur Bildmarke"), //$NON-NLS-1$ + INVISIBLE("Unsichtbar"); - public static int length = 4; + public static int length = 5; private String name; PROFILE(String profile){ @@ -103,7 +104,9 @@ public class Constants { return AMTSSIGNATUREBLOCK; } else if (LOGO_ONLY.getName().equals(profile)) { return LOGO_ONLY; - } + } else if (INVISIBLE.getName().equals(profile)){ + return INVISIBLE; + } return null; } } -- cgit v1.2.3 From 1ccaee68474946e2509854a62b6d7e380bca6e7c Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 12 Nov 2020 16:19:52 +0100 Subject: Fixed Naming in Signature Profile Names --- .../src/main/java/at/asit/pdfover/gui/Constants.java | 18 +++++++++--------- .../workflow/config/ConfigurationContainerImpl.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 cbfd8e24..d6f83973 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 @@ -60,9 +60,9 @@ public class Constants { public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH }; public static enum PROFILE { - SIGNATUREBLOCK_NORMAL("Signaturblock Normal") , //$NON-NLS-1$ - SIGNATUREBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ - AMTSSIGNATUREBLOCK("Amtssignatur"), //$NON-NLS-1$ + SIGNATURBLOCK("Signaturblock Normal") , //$NON-NLS-1$ + SIGNATURBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ + AMTSSIGNATURBLOCK("Amtssignatur"), //$NON-NLS-1$ LOGO_ONLY("Nur Bildmarke"), //$NON-NLS-1$ INVISIBLE("Unsichtbar"); @@ -96,12 +96,12 @@ public class Constants { } public static PROFILE getProfile(String profile) { - if (SIGNATUREBLOCK_NORMAL.getName().equals(profile)) { - return SIGNATUREBLOCK_NORMAL; - } else if (SIGNATUREBLOCK_SMALL.getName().equals(profile)) { - return SIGNATUREBLOCK_SMALL; - } else if (AMTSSIGNATUREBLOCK.getName().equals(profile)) { - return AMTSSIGNATUREBLOCK; + if (SIGNATURBLOCK.getName().equals(profile)) { + return SIGNATURBLOCK; + } else if (SIGNATURBLOCK_SMALL.getName().equals(profile)) { + return SIGNATURBLOCK_SMALL; + } else if (AMTSSIGNATURBLOCK.getName().equals(profile)) { + return AMTSSIGNATURBLOCK; } else if (LOGO_ONLY.getName().equals(profile)) { return LOGO_ONLY; } else if (INVISIBLE.getName().equals(profile)){ 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 32b5ece3..300e2df1 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 @@ -731,7 +731,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { @Override public PROFILE getSignatureProfile() { if (this.signatureProfile == null) { - this.signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; + this.signatureProfile = PROFILE.SIGNATURBLOCK; } return this.signatureProfile; } -- cgit v1.2.3 From a43f3b3f266a63a505ae866a2378f01e5b508cc9 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 13 Nov 2020 12:18:13 +0100 Subject: new module pdf-over-commons added --- .../at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 26f67da3..d65c45a5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -767,7 +767,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { param.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); } catch (Exception e){ - log.debug("Cannot save siganture profile" + e.getMessage()); + log.debug("Cannot save signature profile" + e.getMessage()); } } -- cgit v1.2.3 From d658f95290ea03bd0ecdc01110b48244b28e6f19 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 13 Nov 2020 13:49:59 +0100 Subject: refactored Profile --- .../main/java/at/asit/pdfover/gui/Constants.java | 55 +--------------------- .../composites/AdvancedConfigurationComposite.java | 6 +-- .../composites/SimpleConfigurationComposite.java | 10 ++-- .../gui/workflow/config/ConfigProviderImpl.java | 8 ++-- .../workflow/config/ConfigurationContainer.java | 6 +-- .../config/ConfigurationContainerImpl.java | 10 ++-- 6 files changed, 21 insertions(+), 74 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 d6f83973..ed007cb8 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 @@ -23,8 +23,7 @@ import java.util.Properties; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; -import at.asit.pdfover.gui.Constants.PROFILE; -import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; + import at.asit.pdfover.gui.bku.mobile.MobileBKUs; /** @@ -59,58 +58,6 @@ public class Constants { /** Supported locales */ public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH }; - public static enum PROFILE { - SIGNATURBLOCK("Signaturblock Normal") , //$NON-NLS-1$ - SIGNATURBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ - AMTSSIGNATURBLOCK("Amtssignatur"), //$NON-NLS-1$ - LOGO_ONLY("Nur Bildmarke"), //$NON-NLS-1$ - INVISIBLE("Unsichtbar"); - - public static int length = 5; - private String name; - - PROFILE(String profile){ - this.name = profile; - } - - public static String[] getProfileStrings() { - String[] profiles = new String[PROFILE.length]; - int i = 0; - for (PROFILE profile : PROFILE.values()) { - profiles[i] = profile.getName(); - i++; - } - return profiles; - } - - public static PROFILE getProfileByIndex(int index) { - String[] profiles = getProfileStrings(); - if (profiles.length < index) { - return null; - } - return getProfile(profiles[index]); - } - - public String getName() { - return this.name; - } - - public static PROFILE getProfile(String profile) { - if (SIGNATURBLOCK.getName().equals(profile)) { - return SIGNATURBLOCK; - } else if (SIGNATURBLOCK_SMALL.getName().equals(profile)) { - return SIGNATURBLOCK_SMALL; - } else if (AMTSSIGNATURBLOCK.getName().equals(profile)) { - return AMTSSIGNATURBLOCK; - } else if (LOGO_ONLY.getName().equals(profile)) { - return LOGO_ONLY; - } else if (INVISIBLE.getName().equals(profile)){ - return INVISIBLE; - } - return null; - } - } - /** Configuration directory */ public static final String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$ 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 e9ed5316..f4b3ae0b 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 @@ -48,7 +48,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; +import at.asit.pdfover.commons.Profile; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; @@ -953,7 +953,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { provider.getProxyUserPersistent()); this.configurationContainer.setProxyPass( provider.getProxyPassPersistent()); - this.configurationContainer.setSignatureProfile(PROFILE.getProfile(provider.getSignatureProfile())); + this.configurationContainer.setSignatureProfile(Profile.getProfile(provider.getSignatureProfile())); } /* @@ -1001,7 +1001,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { * @param profile * */ - public void performSetSignatureProfile(PROFILE profile) { + public void performSetSignatureProfile(Profile profile) { this.configurationContainer.setSignatureProfile(profile); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index d65c45a5..7941bc9a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -62,7 +62,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; +import at.asit.pdfover.commons.Profile; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; @@ -236,13 +236,13 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); - this.cmbSingatureProfiles.setItems(PROFILE.getProfileStrings()); + this.cmbSingatureProfiles.setItems(Profile.getProfileStrings()); //this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal()); this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PROFILE current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); - PROFILE selected = PROFILE.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles + Profile current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); + Profile selected = Profile.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles .getSelectionIndex()); if (!current.equals(selected)) { preformProfileSelectionChanged(selected); @@ -755,7 +755,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } } - void preformProfileSelectionChanged(PROFILE selected) { + void preformProfileSelectionChanged(Profile selected) { log.debug("Signature Profile {} was selected", selected.getName()); //$NON-NLS-1$ this.configurationContainer.setSignatureProfile(selected); this.cmbSingatureProfiles.select(selected.ordinal()); 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 f1461809..92a64103 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 @@ -25,12 +25,12 @@ import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; +import at.asit.pdfover.commons.Profile; import org.eclipse.swt.graphics.Point; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -144,8 +144,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, String signatureProfile = config.getProperty(Constants.SIGNATURE_PROFILE); if (signatureProfile != null) { - this.configuration.setSignatureProfile(PROFILE.getProfile(signatureProfile)); - this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(signatureProfile)); + this.configuration.setSignatureProfile(Profile.getProfile(signatureProfile)); + this.configurationOverlay.setSignatureProfile(Profile.getProfile(signatureProfile)); } String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); @@ -1508,7 +1508,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setSignatureProfile(String profile) { - this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(profile)); + this.configurationOverlay.setSignatureProfile(Profile.getProfile(profile)); } @Override 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 8b08ba9f..bed44da1 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 @@ -17,9 +17,9 @@ package at.asit.pdfover.gui.workflow.config; import java.util.Locale; +import at.asit.pdfover.commons.Profile; import org.eclipse.swt.graphics.Point; -import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -414,11 +414,11 @@ public interface ConfigurationContainer { /** * @param profile set the selected profile */ - public void setSignatureProfile(PROFILE profile); + public void setSignatureProfile(Profile profile); /** * @return selected signature profile as string */ - public PROFILE getSignatureProfile(); + public Profile getSignatureProfile(); } 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 300e2df1..7d2c77c4 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 @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.util.Locale; +import at.asit.pdfover.commons.Profile; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.Point; @@ -28,7 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; @@ -147,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected boolean useSignatureFields = false; /** The Signature Profile */ - protected PROFILE signatureProfile = null; + protected Profile signatureProfile = null; /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() @@ -729,15 +729,15 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { @Override - public PROFILE getSignatureProfile() { + public Profile getSignatureProfile() { if (this.signatureProfile == null) { - this.signatureProfile = PROFILE.SIGNATURBLOCK; + this.signatureProfile = Profile.SIGNATURBLOCK; } return this.signatureProfile; } @Override - public void setSignatureProfile(PROFILE profile) { + public void setSignatureProfile(Profile profile) { this.signatureProfile = profile; } -- cgit v1.2.3 From a3b052f565b4c54774f18745acad69fc6412d682 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 13 Nov 2020 14:19:40 +0100 Subject: Minimum Version of PDF-AS updated to 4.1.6 --- pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 ed007cb8..dcc7c1d3 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 @@ -80,7 +80,7 @@ public class Constants { * The minimum PDF-AS configuration version (older ones will be backed up * and updated */ - public static final String MIN_PDF_AS_CONFIG_VERSION = "4.1.0"; //$NON-NLS-1$ + public static final String MIN_PDF_AS_CONFIG_VERSION = "4.1.6"; //$NON-NLS-1$ /** The configuration backup filename */ public static final String PDF_AS_CONFIG_BACKUP_FILENAME = "cfg_backup"; //$NON-NLS-1$ -- cgit v1.2.3 From d13ffed00c2c97e5fd582f42c019b8833ac39c7c Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Mon, 16 Nov 2020 15:49:13 +0100 Subject: PDF-Over Version changed --- pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 dcc7c1d3..17a9a8d7 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 @@ -105,7 +105,7 @@ public class Constants { public static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15; /** PDF-Over User Agent string */ - public static final String USER_AGENT_STRING = "PDF-Over " + (APP_VERSION == null ? "4.1" : APP_VERSION); //$NON-NLS-1$ //$NON-NLS-2$ + public static final String USER_AGENT_STRING = "PDF-Over " + (APP_VERSION == null ? "4.3" : APP_VERSION); //$NON-NLS-1$ //$NON-NLS-2$ /** Current release file */ public static final String CURRENT_RELEASE_URL = "http://webstart.buergerkarte.at/PDF-Over/Release.txt"; //$NON-NLS-1$ -- cgit v1.2.3 From af14459241ed7c653531f769216d4e97d3c9ef2f Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Wed, 18 Nov 2020 13:54:40 +0100 Subject: changes in pom and SignatureProfle --- .../at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 7d2c77c4..e00e04d6 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 @@ -731,7 +731,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { @Override public Profile getSignatureProfile() { if (this.signatureProfile == null) { - this.signatureProfile = Profile.SIGNATURBLOCK; + this.signatureProfile = Profile.SIGNATURBLOCK_SMALL; } return this.signatureProfile; } -- cgit v1.2.3 From df362d82d20d0301099ff3b43517034b4880bd9c Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 09:24:38 +0100 Subject: Fixed smaller bugs and typos --- .../at/asit/pdfover/gui/cliarguments/InvisibleProfile.java | 2 +- .../gui/composites/AdvancedConfigurationComposite.java | 12 +++++++++++- .../pdfover/gui/composites/SimpleConfigurationComposite.java | 7 +++++++ 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java index b833ce9d..4bb3890f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java @@ -54,8 +54,8 @@ public class InvisibleProfile extends Argument { log.info("Set Profile Invisible"); if (args.length > argOffset + 1) { - PdfAs4SignatureParameter.PROFILE_VISIBILITY=false; + log.debug("We are setting the profile visibility to false"); return argOffset + 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 f4b3ae0b..27b0f135 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 @@ -1002,7 +1002,17 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { * */ public void performSetSignatureProfile(Profile profile) { - this.configurationContainer.setSignatureProfile(profile); + switch (profile){ + case INVISIBLE: + case AMTSSIGNATURBLOCK: + this.performPositionSelection(true); + this.btnAutomatischePositionierung.setEnabled(false); + this.grpPlaceholder.setEnabled(false); + break; + default: + this.btnAutomatischePositionierung.setEnabled(true); + this.grpPlaceholder.setEnabled(true); + } } /* (non-Javadoc) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 7941bc9a..ad0d5eb8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -22,6 +22,7 @@ import java.util.Locale; import javax.imageio.ImageIO; +import at.asit.pdfover.signator.SignaturePosition; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTarget; @@ -759,6 +760,12 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { log.debug("Signature Profile {} was selected", selected.getName()); //$NON-NLS-1$ this.configurationContainer.setSignatureProfile(selected); this.cmbSingatureProfiles.select(selected.ordinal()); + + if (selected.equals(Profile.AMTSSIGNATURBLOCK)){ + this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); + //TODO also set the radio button in advanced config + } + } void setSignatureProfileSetting(){ -- cgit v1.2.3 From 5ceb3061ada685cd02ae3f1236da108c88c953d2 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 09:53:08 +0100 Subject: Changed the GUI behaviour when selecting different profiles accordingly --- .../asit/pdfover/gui/composites/AdvancedConfigurationComposite.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 27b0f135..b03451b5 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 @@ -1007,11 +1007,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { case AMTSSIGNATURBLOCK: this.performPositionSelection(true); this.btnAutomatischePositionierung.setEnabled(false); - this.grpPlaceholder.setEnabled(false); + this.btnEnablePlaceholderUsage.setEnabled(true); + this.performEnableUsePlaceholder(false); break; default: this.btnAutomatischePositionierung.setEnabled(true); - this.grpPlaceholder.setEnabled(true); + this.btnEnablePlaceholderUsage.setEnabled(true); } } -- cgit v1.2.3 From 1feb15655af5bdd685afa814832aaf5d3e522409 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 09:58:37 +0100 Subject: Improved code quality according to SonarLint --- .../composites/AdvancedConfigurationComposite.java | 42 ++++++++-------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 b03451b5..3d8d7726 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 @@ -26,8 +26,6 @@ import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.layout.FormAttachment; @@ -363,7 +361,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fD_cmbBKUAuswahl[0])); int blen = BKUs.values().length; - this.bkuStrings = new ArrayList(blen); + this.bkuStrings = new ArrayList<>(blen); for (int i = 0; i < blen; i++) { String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$ String text = Messages.getString(lookup); @@ -651,13 +649,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); - this.txtProxyHost.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processProxyHostChanged(); - } + this.txtProxyHost.addTraverseListener(e -> { + if (e.detail == SWT.TRAVERSE_RETURN) { + processProxyHostChanged(); } }); @@ -687,13 +681,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.txtProxyPort.setFont(new Font(Display.getCurrent(), fD_txtProxyPort[0])); - this.txtProxyPort.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processProxyPortChanged(); - } + this.txtProxyPort.addTraverseListener(e -> { + if (e.detail == SWT.TRAVERSE_RETURN) { + processProxyPortChanged(); } }); @@ -729,7 +719,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } void performOutputFolderChanged(String foldername) { - log.debug("Selected Output folder: " + foldername); //$NON-NLS-1$ + log.debug("Selected Output folder: {}", foldername); //$NON-NLS-1$ this.configurationContainer.setOutputFolder(foldername); AdvancedConfigurationComposite.this.txtOutputFolder.setText(foldername); } @@ -740,14 +730,14 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { int i = this.bkuStrings.indexOf(bkuName); if (i == -1) { - log.warn("NO BKU match for " + bkuName); //$NON-NLS-1$ + log.warn("NO BKU match for {}", bkuName); //$NON-NLS-1$ return 0; } return i; } void performBKUSelectionChanged(BKUs selected) { - log.debug("Selected BKU: " + selected.toString()); //$NON-NLS-1$ + log.debug("Selected BKU: {}", selected); //$NON-NLS-1$ this.configurationContainer.setDefaultBKU(selected); this.cmbBKUAuswahl.select(this.getBKUElementIndex(selected)); } @@ -757,7 +747,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { BKUs bkuvalue = resolveBKU(selected); this.performBKUSelectionChanged(bkuvalue); } catch (Exception ex) { - log.error("Failed to parse BKU value: " + selected, ex); //$NON-NLS-1$ + log.error("Failed to parse BKU value: {} {}", selected, ex); //$NON-NLS-1$ ErrorDialog dialog = new ErrorDialog(getShell(), Messages.getString("error.InvalidBKU"), BUTTONS.OK); //$NON-NLS-1$ dialog.open(); @@ -780,23 +770,23 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { int getLocaleElementIndex(Locale locale) { for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; i++) { if (Constants.SUPPORTED_LOCALES[i].equals(locale)) { - log.debug("Locale: " + locale + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$ + log.debug("Locale: {} IDX: {}", locale, i); //$NON-NLS-1$ //$NON-NLS-2$ return i; } } - log.warn("NO Locale match for " + locale); //$NON-NLS-1$ + log.warn("NO Locale match for {}", locale); //$NON-NLS-1$ return 0; } void performLocaleSelectionChanged(Locale selected) { - log.debug("Selected Locale: " + selected); //$NON-NLS-1$ + log.debug("Selected Locale: {}", selected); //$NON-NLS-1$ this.configurationContainer.setLocale(selected); this.cmbLocaleAuswahl.select(this.getLocaleElementIndex(selected)); } void performPositionSelection(boolean automatic) { - log.debug("Selected Position: " + automatic); //$NON-NLS-1$ + log.debug("Selected Position: {}", automatic); //$NON-NLS-1$ SignaturePosition pos = automatic ? new SignaturePosition() : null; this.configurationContainer.setDefaultSignaturePosition(pos); this.btnAutomatischePositionierung.setSelection(automatic); @@ -921,8 +911,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setUseMarker(provider.getUseMarker()); this.configurationContainer.setUseSignatureFields(provider.getUseSignatureFields()); this.configurationContainer.setEnablePlaceholderUsage(provider.getEnablePlaceholderUsage()); - /*this.configurationContainer.setDownloadURL( - provider.getDownloadURL());*/ this.configurationContainer.setSignaturePdfACompat( provider.getSignaturePdfACompat()); this.configurationContainer.setPlaceholderTransparency( -- cgit v1.2.3 From 636a0d443e8a257879b8a6199d4de79cba88abfa Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 10:06:48 +0100 Subject: Improved code quality according to SonarLint --- .../composites/SimpleConfigurationComposite.java | 80 +++++++--------------- 1 file changed, 26 insertions(+), 54 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index ad0d5eb8..38f3967b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -33,7 +33,6 @@ import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.TraverseEvent; @@ -189,13 +188,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.txtMobileNumber.setFont(new Font(Display.getCurrent(), fD_txtMobileNumber[0])); - this.txtMobileNumber.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processNumberChanged(); - } + this.txtMobileNumber.addTraverseListener(e -> { + if (e.detail == SWT.TRAVERSE_RETURN) { + processNumberChanged(); } }); @@ -238,7 +233,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); this.cmbSingatureProfiles.setItems(Profile.getProfileStrings()); - //this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal()); this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -282,16 +276,13 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_controlComposite.top = new FormAttachment(0, 20); fd_controlComposite.bottom = new FormAttachment(100, -20); controlComposite.setLayoutData(fd_controlComposite); - controlComposite.addPaintListener(new PaintListener() { - @Override - public void paintControl(PaintEvent e) { - e.gc.setForeground(Constants.DROP_BORDER_COLOR); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_DASH); - Point size = controlComposite.getSize(); - e.gc.drawRoundRectangle(0, 0, size.x - 2, size.y - 2, - 10, 10); - } + controlComposite.addPaintListener(e -> { + e.gc.setForeground(Constants.DROP_BORDER_COLOR); + e.gc.setLineWidth(3); + e.gc.setLineStyle(SWT.LINE_DASH); + Point size = controlComposite.getSize(); + e.gc.drawRoundRectangle(0, 0, size.x - 2, size.y - 2, + 10, 10); }); this.cSigPreview = new Canvas(containerComposite, SWT.RESIZE); @@ -309,12 +300,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_cLogo.height = 40; fd_cLogo.width = 40; this.cLogo.setLayoutData(fd_cLogo); - this.cLogo.addPaintListener(new PaintListener() { - @Override - public void paintControl(PaintEvent e) { - imagePaintControl(e, SimpleConfigurationComposite.this.logo); - } - }); + this.cLogo.addPaintListener(e -> imagePaintControl(e, SimpleConfigurationComposite.this.logo)); this.btnClearImage = new Button(controlComposite, SWT.NATIVE); @@ -332,12 +318,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_cSigPreview.bottom = new FormAttachment(100, -20); this.cSigPreview.setLayoutData(fd_cSigPreview); - this.cSigPreview.addPaintListener(new PaintListener() { - @Override - public void paintControl(PaintEvent e) { - imagePaintControl(e, SimpleConfigurationComposite.this.sigPreview); - } - }); + this.cSigPreview.addPaintListener(e -> imagePaintControl(e, SimpleConfigurationComposite.this.sigPreview)); FontData[] fD_cSigPreview = this.cSigPreview.getFont().getFontData(); fD_cSigPreview[0].setHeight(Constants.TEXT_SIZE_NORMAL); @@ -358,7 +339,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { // Only taking first file ... File file = new File(files[0]); if (!file.exists()) { - log.error("File: " + files[0] + " does not exist!"); //$NON-NLS-1$//$NON-NLS-2$ + log.error("File: {} does not exist!", files[0]); //$NON-NLS-1$//$NON-NLS-2$ return; } processEmblemChanged(file.getAbsolutePath()); @@ -540,12 +521,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } }); - this.txtSignatureNote.addTraverseListener(new TraverseListener() { - @Override - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - processSignatureNoteChanged(); - } + this.txtSignatureNote.addTraverseListener(e -> { + if (e.detail == SWT.TRAVERSE_RETURN) { + processSignatureNoteChanged(); } }); @@ -628,10 +606,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { if (fileName != null) { file = new File(fileName); if (file.exists()) { - /* - * SimpleConfigurationComposite.this.txtEmblemFile - * .setText(fileName); - */ processEmblemChanged(fileName); } } @@ -644,11 +618,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { private void setEmblemFileInternal(final String filename, boolean force) throws Exception { - if (!force) { - if (this.configurationContainer.getEmblem() != null) { - if (this.configurationContainer.getEmblem().equals(filename)) { - return; // Ignore ... - } + if (!force && this.configurationContainer.getEmblem() != null) { + if (this.configurationContainer.getEmblem().equals(filename)) { + return; // Ignore ... } } @@ -734,17 +706,17 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { int getLocaleElementIndex(Locale locale) { for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; i++) { if (Constants.SUPPORTED_LOCALES[i].equals(locale)) { - log.debug("Locale: " + locale + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$ + log.debug("Locale: {} IDX: {}",locale, i); //$NON-NLS-1$ //$NON-NLS-2$ return i; } } - log.warn("NO Locale match for " + locale); //$NON-NLS-1$ + log.warn("NO Locale match for {}", locale); //$NON-NLS-1$ return 0; } void performSignatureLangSelectionChanged(Locale selected, Locale previous) { - log.debug("Selected Sign Locale: " + selected); //$NON-NLS-1$ + log.debug("Selected Sign Locale: {}", selected); //$NON-NLS-1$ this.configurationContainer.setSignatureLocale(selected); this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); if (previous != null) { @@ -763,7 +735,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { if (selected.equals(Profile.AMTSSIGNATURBLOCK)){ this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); - //TODO also set the radio button in advanced config } } @@ -774,7 +745,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { param.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); } catch (Exception e){ - log.debug("Cannot save signature profile" + e.getMessage()); + log.debug("Cannot save signature profile {}", e.getMessage()); } } @@ -861,7 +832,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { String emblemFile = this.configurationContainer.getEmblem(); if (emblemFile != null && !emblemFile.trim().isEmpty()) { - // this.txtEmblemFile.setText(emblemFile); this.logoFile = emblemFile; try { setEmblemFileInternal(emblemFile, true); @@ -921,8 +891,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { // Fall through case 1: this.processSignatureNoteChanged(); + break; + default: + //Fall through } - // this.plainEmblemSetter(this.emblemFile); } /* -- cgit v1.2.3 From d3b5b119873b9186857a8c324362437ce3828848 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 10:15:58 +0100 Subject: Improved code quality according to SonarLint --- .../src/main/java/at/asit/pdfover/gui/utils/Messages.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java index 6271656c..c48337e6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java @@ -38,10 +38,7 @@ public class Messages { private static final String BUNDLE_NAME = "at.asit.pdfover.gui.messages"; //$NON-NLS-1$ - private static HashMap bundles = new HashMap(); - - //private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - // .getBundle(BUNDLE_NAME); + private static HashMap bundles = new HashMap<>(); private static Locale currentLocale = getDefaultLocale(); @@ -71,17 +68,17 @@ public class Messages { private static ResourceBundle getBundle(Locale locale) { if(!bundles.containsKey(locale)) { - log.debug("Loading resource bundle for " + locale); //$NON-NLS-1$ + log.debug("Loading resource bundle for {}", locale); //$NON-NLS-1$ ResourceBundle tmp = null; try { tmp = ResourceBundle.getBundle(BUNDLE_NAME, locale); - log.debug("Received bundle for " + tmp.getLocale()); //$NON-NLS-1$ + log.debug("Received bundle for {}", tmp.getLocale()); //$NON-NLS-1$ } catch(Exception e) { - log.error("NO RESOURCE BUNDLE FOR " + locale.toString(), e); //$NON-NLS-1$ + log.error("NO RESOURCE BUNDLE FOR {} {}", locale, e); //$NON-NLS-1$ tmp = ResourceBundle.getBundle(BUNDLE_NAME); } if(tmp == null) { - log.error("NO RESOURCE BUNDLE FOR " + locale.toString()); //$NON-NLS-1$ + log.error("NO RESOURCE BUNDLE FOR {}", locale); //$NON-NLS-1$ tmp = ResourceBundle.getBundle(BUNDLE_NAME); } bundles.put(locale, tmp); @@ -98,7 +95,6 @@ public class Messages { public static String getString(String key) { try { return getBundle(currentLocale).getString(key); - //return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } @@ -113,7 +109,6 @@ public class Messages { public static String getString(String key, Locale locale) { try { return getBundle(locale).getString(key); - //return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } -- cgit v1.2.3 From ebade6f73b9e3c1f5c93bb0e1c7b48c47061d104 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 10:44:50 +0100 Subject: Added English and German values for Signature Profile description --- .../composites/SimpleConfigurationComposite.java | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 38f3967b..84078fbf 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -35,8 +35,6 @@ import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; @@ -116,7 +114,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { protected Image logo = null; protected final Group grpSignatureProfile; - protected final Combo cmbSingatureProfiles; + protected final Combo cmbSignatureProfiles; @@ -218,26 +216,34 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fD_grpSignatureProfile[0])); - this.cmbSingatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); + this.cmbSignatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); FormData fd_cmbSingatureProfiles = new FormData(); fd_cmbSingatureProfiles.left = new FormAttachment(0, 10); fd_cmbSingatureProfiles.right = new FormAttachment(100, -10); fd_cmbSingatureProfiles.top = new FormAttachment(0, 10); fd_cmbSingatureProfiles.bottom = new FormAttachment(100, -10); - this.cmbSingatureProfiles.setLayoutData(fd_cmbSingatureProfiles); + this.cmbSignatureProfiles.setLayoutData(fd_cmbSingatureProfiles); - FontData[] fD_cmbSignatureProfile = this.cmbSingatureProfiles.getFont() + FontData[] fD_cmbSignatureProfile = this.cmbSignatureProfiles.getFont() .getFontData(); fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), + this.cmbSignatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); - this.cmbSingatureProfiles.setItems(Profile.getProfileStrings()); - this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { + + String[] items = new String[Profile.values().length]; + int i = 0; + for (Profile profile : Profile.values()) { + items[i] = Messages.getString("simple_config." + profile.name()); + i++; + } + + this.cmbSignatureProfiles.setItems(items); + this.cmbSignatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Profile current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); - Profile selected = Profile.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles + Profile selected = Profile.getProfileByIndex(SimpleConfigurationComposite.this.cmbSignatureProfiles .getSelectionIndex()); if (!current.equals(selected)) { preformProfileSelectionChanged(selected); @@ -731,7 +737,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { void preformProfileSelectionChanged(Profile selected) { log.debug("Signature Profile {} was selected", selected.getName()); //$NON-NLS-1$ this.configurationContainer.setSignatureProfile(selected); - this.cmbSingatureProfiles.select(selected.ordinal()); + this.cmbSignatureProfiles.select(selected.ordinal()); if (selected.equals(Profile.AMTSSIGNATURBLOCK)){ this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); -- cgit v1.2.3 From 21540b68c6e2088435bd1aa643d1ae543c5e5337 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 11:30:08 +0100 Subject: AdvancedConfig extended --- .../composites/AdvancedConfigurationComposite.java | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 3d8d7726..c29abb33 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 @@ -94,12 +94,14 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { List bkuStrings; Button btnKeystoreEnabled; - private Group grpSpeicherort; - private Label lblDefaultOutputFolder; + private final Group grpSpeicherort; + private final Label lblDefaultOutputFolder; Text txtOutputFolder; - private Button btnBrowse; + private final Button btnBrowse; + private final Label lblSaveFilePostFix; + private final Text txtSaveFilePostFix; - private Group grpLocaleAuswahl; + private final Group grpLocaleAuswahl; Combo cmbLocaleAuswahl; private Group grpUpdateCheck; @@ -500,6 +502,41 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } } }); + + + this.lblSaveFilePostFix = new Label(this.grpSpeicherort, SWT.NONE); + FormData fd_lblSaveFilePostFix = new FormData(); + fd_lblSaveFilePostFix.top = new FormAttachment(this.lblDefaultOutputFolder); + fd_lblSaveFilePostFix.left = new FormAttachment(0, 5); + this.lblSaveFilePostFix.setLayoutData(fd_lblSaveFilePostFix); + + FontData[] fD_lblSaveFilePostFix = this.lblSaveFilePostFix.getFont() + .getFontData(); + fD_lblSaveFilePostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblSaveFilePostFix.setFont(new Font(Display.getCurrent(), + fD_lblSaveFilePostFix[0])); + + this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.NONE); + FormData fd_PostFix = new FormData(); + fd_PostFix.top = new FormAttachment(this.lblSaveFilePostFix, 5); + fd_PostFix.left = new FormAttachment(0, 15); + this.txtSaveFilePostFix.setLayoutData(fd_text); + + FontData[] fD_txtPostFix = this.txtSaveFilePostFix.getFont() + .getFontData(); + fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.txtSaveFilePostFix.setFont(new Font(Display.getCurrent(), + fD_txtOutputFolder[0])); + + this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + //performOutputFolderChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix + //.getText()); + } + }); + this.grpLocaleAuswahl = new Group(this, SWT.NONE); FormLayout layout_grpLocaleAuswahl = new FormLayout(); -- cgit v1.2.3 From ba13450bf503469436b63789553163746bab7e43 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 13:53:31 +0100 Subject: New grid layout implemented to support postfix file names --- .../composites/AdvancedConfigurationComposite.java | 197 ++++++++++----------- 1 file changed, 91 insertions(+), 106 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 c29abb33..34b6535a 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 @@ -412,13 +412,11 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { }); this.grpSpeicherort = new Group(this, SWT.NONE); - layout = new FormLayout(); - layout.marginHeight = 10; - layout.marginWidth = 5; - this.grpSpeicherort.setLayout(layout); + GridLayout gl_grpSpeicherort = new GridLayout(3, false); + grpSpeicherort.setLayout(gl_grpSpeicherort); FormData fd_grpSpeicherort = new FormData(); + fd_grpSpeicherort.left = new FormAttachment(100, -499); fd_grpSpeicherort.top = new FormAttachment(this.grpBkuAuswahl, 5); - fd_grpSpeicherort.left = new FormAttachment(0, 5); fd_grpSpeicherort.right = new FormAttachment(100, -5); this.grpSpeicherort.setLayoutData(fd_grpSpeicherort); @@ -428,114 +426,101 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fD_grpSpeicherort[0])); this.lblDefaultOutputFolder = new Label(this.grpSpeicherort, SWT.NONE); - FormData fd_lblDefaultOutputFolder = new FormData(); - fd_lblDefaultOutputFolder.top = new FormAttachment(0); - fd_lblDefaultOutputFolder.left = new FormAttachment(0, 5); - this.lblDefaultOutputFolder.setLayoutData(fd_lblDefaultOutputFolder); FontData[] fD_lblDefaultOutputFolder = this.lblDefaultOutputFolder.getFont() .getFontData(); fD_lblDefaultOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0])); - - this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); - FormData fd_text = new FormData(); - fd_text.top = new FormAttachment(this.lblDefaultOutputFolder, 5); - fd_text.left = new FormAttachment(0, 15); - this.txtOutputFolder.setLayoutData(fd_text); - - FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont() - .getFontData(); + + this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); + GridData gd_txtOutputFolder = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gd_txtOutputFolder.widthHint = 291; + txtOutputFolder.setLayoutData(gd_txtOutputFolder); + + FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont() + .getFontData(); + this.txtOutputFolder.setFont(new Font(Display.getCurrent(), + fD_txtOutputFolder[0])); + + this.txtOutputFolder.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + performOutputFolderChanged(AdvancedConfigurationComposite.this.txtOutputFolder + .getText()); + } + }); fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtOutputFolder.setFont(new Font(Display.getCurrent(), - fD_txtOutputFolder[0])); - - this.txtOutputFolder.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { - performOutputFolderChanged(AdvancedConfigurationComposite.this.txtOutputFolder - .getText()); - } - }); - - this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); - fd_text.right = new FormAttachment(this.btnBrowse, -5); - - FontData[] fD_btnBrowse = this.btnBrowse.getFont().getFontData(); - fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); - - FormData fd_btnBrowse = new FormData(); - fd_btnBrowse.top = new FormAttachment(this.lblDefaultOutputFolder, 5); - fd_btnBrowse.right = new FormAttachment(100, -5); - this.btnBrowse.setLayoutData(fd_btnBrowse); - - this.btnBrowse.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - DirectoryDialog dlg = new DirectoryDialog( - AdvancedConfigurationComposite.this.getShell()); - - // Set the initial filter path according - // to anything they've selected or typed in - dlg.setFilterPath(AdvancedConfigurationComposite.this.txtOutputFolder - .getText()); - - // Change the title bar text - dlg.setText(Messages - .getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$ - - // Customizable message displayed in the dialog - dlg.setMessage(Messages - .getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$ - - // Calling open() will open and run the dialog. - // It will return the selected directory, or - // null if user cancels - String dir = dlg.open(); - if (dir != null) { - // Set the text box to the new selection - performOutputFolderChanged(dir); - } - } - }); - - - this.lblSaveFilePostFix = new Label(this.grpSpeicherort, SWT.NONE); - FormData fd_lblSaveFilePostFix = new FormData(); - fd_lblSaveFilePostFix.top = new FormAttachment(this.lblDefaultOutputFolder); - fd_lblSaveFilePostFix.left = new FormAttachment(0, 5); - this.lblSaveFilePostFix.setLayoutData(fd_lblSaveFilePostFix); - - FontData[] fD_lblSaveFilePostFix = this.lblSaveFilePostFix.getFont() - .getFontData(); +// fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); + + this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); + btnBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + + FontData[] fD_btnBrowse = this.btnBrowse.getFont().getFontData(); + this.btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); + + this.btnBrowse.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dlg = new DirectoryDialog( + AdvancedConfigurationComposite.this.getShell()); + + // Set the initial filter path according + // to anything they've selected or typed in + dlg.setFilterPath(AdvancedConfigurationComposite.this.txtOutputFolder + .getText()); + + // Change the title bar text + dlg.setText(Messages + .getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$ + + // Customizable message displayed in the dialog + dlg.setMessage(Messages + .getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$ + + // Calling open() will open and run the dialog. + // It will return the selected directory, or + // null if user cancels + String dir = dlg.open(); + if (dir != null) { + // Set the text box to the new selection + performOutputFolderChanged(dir); + } + } + }); + + + this.lblSaveFilePostFix = new Label(this.grpSpeicherort, SWT.NONE); + lblSaveFilePostFix.setText(Messages.getString("AdvancedConfigurationComposite.lblSaveFilePostFix.text")); + + FontData[] fD_lblSaveFilePostFix = this.lblSaveFilePostFix.getFont() + .getFontData(); + this.lblSaveFilePostFix.setFont(new Font(Display.getCurrent(), + fD_lblSaveFilePostFix[0])); + + this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.BORDER); + GridData gd_txtSaveFilePostFix = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gd_txtSaveFilePostFix.widthHint = 256; + txtSaveFilePostFix.setLayoutData(gd_txtSaveFilePostFix); + + FontData[] fD_txtPostFix = this.txtSaveFilePostFix.getFont() + .getFontData(); + this.txtSaveFilePostFix.setFont(new Font(Display.getCurrent(), + fD_txtPostFix[0])); + + this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + //performOutputFolderChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix + //.getText()); + } + }); + new Label(grpSpeicherort, SWT.NONE); fD_lblSaveFilePostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblSaveFilePostFix.setFont(new Font(Display.getCurrent(), - fD_lblSaveFilePostFix[0])); - - this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.NONE); - FormData fd_PostFix = new FormData(); - fd_PostFix.top = new FormAttachment(this.lblSaveFilePostFix, 5); - fd_PostFix.left = new FormAttachment(0, 15); - this.txtSaveFilePostFix.setLayoutData(fd_text); - - FontData[] fD_txtPostFix = this.txtSaveFilePostFix.getFont() - .getFontData(); - fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtSaveFilePostFix.setFont(new Font(Display.getCurrent(), - fD_txtOutputFolder[0])); - - this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { - //performOutputFolderChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix - //.getText()); - } - }); + fD_txtPostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.grpLocaleAuswahl = new Group(this, SWT.NONE); @@ -544,7 +529,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { layout_grpLocaleAuswahl.marginWidth = 5; this.grpLocaleAuswahl.setLayout(layout_grpLocaleAuswahl); FormData fd_grpLocaleAuswahl = new FormData(); - fd_grpLocaleAuswahl.top = new FormAttachment(this.grpSpeicherort, 5); + fd_grpLocaleAuswahl.top = new FormAttachment(grpSpeicherort, 5); fd_grpLocaleAuswahl.left = new FormAttachment(0, 5); fd_grpLocaleAuswahl.right = new FormAttachment(100, -5); this.grpLocaleAuswahl.setLayoutData(fd_grpLocaleAuswahl); -- cgit v1.2.3 From 4a77926f1ccfe2aed8c04dc7eb6180511e9920a3 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 14:07:46 +0100 Subject: Small improvement in Advanced GUI --- .../composites/AdvancedConfigurationComposite.java | 693 +++++++++------------ 1 file changed, 291 insertions(+), 402 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 34b6535a..94474c66 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 @@ -71,19 +71,17 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(AdvancedConfigurationComposite.class); - + private static final Logger log = LoggerFactory.getLogger(AdvancedConfigurationComposite.class); private ConfigurationComposite configurationComposite; private Group grpSignatur; - private Group grpPlaceholder; + private Group grpPlaceholder; Button btnAutomatischePositionierung; Button btnPdfACompat; Button btnPlatzhalterVerwenden; - Button btnSignatureFieldsUsage; - Button btnEnablePlaceholderUsage; + Button btnSignatureFieldsUsage; + Button btnEnablePlaceholderUsage; private Label lblTransparenz; private Label lblTransparenzLinks; private Label lblTransparenzRechts; @@ -117,7 +115,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FormData fd_txtProxyPort; FormData fd_txtProxyPortErrorMarker; - /** * @param parent * @param style @@ -125,8 +122,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { * @param container * @param config */ - public AdvancedConfigurationComposite(Composite parent, int style, - State state, ConfigurationContainer container, + public AdvancedConfigurationComposite(Composite parent, int style, State state, ConfigurationContainer container, ConfigurationComposite config) { super(parent, style, state, container); this.configurationComposite = config; @@ -145,73 +141,55 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_grpSignaturPosition = this.grpSignatur.getFont().getFontData(); fD_grpSignaturPosition[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpSignatur.setFont(new Font(Display.getCurrent(), - fD_grpSignaturPosition[0])); + this.grpSignatur.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0])); this.btnAutomatischePositionierung = new Button(this.grpSignatur, SWT.CHECK); FormData fd_btnAutomatischePositionierung = new FormData(); fd_btnAutomatischePositionierung.right = new FormAttachment(100, -5); fd_btnAutomatischePositionierung.top = new FormAttachment(0); fd_btnAutomatischePositionierung.left = new FormAttachment(0, 5); - this.btnAutomatischePositionierung - .setLayoutData(fd_btnAutomatischePositionierung); - - FontData[] fD_btnAutomatischePositionierung = this.btnAutomatischePositionierung - .getFont().getFontData(); - fD_btnAutomatischePositionierung[0] - .setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnAutomatischePositionierung.setFont(new Font(Display - .getCurrent(), fD_btnAutomatischePositionierung[0])); - - this.btnAutomatischePositionierung - .addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - AdvancedConfigurationComposite.this - .performPositionSelection(AdvancedConfigurationComposite.this.btnAutomatischePositionierung - .getSelection()); - } - }); - - + this.btnAutomatischePositionierung.setLayoutData(fd_btnAutomatischePositionierung); + + FontData[] fD_btnAutomatischePositionierung = this.btnAutomatischePositionierung.getFont().getFontData(); + fD_btnAutomatischePositionierung[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnAutomatischePositionierung.setFont(new Font(Display.getCurrent(), fD_btnAutomatischePositionierung[0])); + + this.btnAutomatischePositionierung.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AdvancedConfigurationComposite.this.performPositionSelection( + AdvancedConfigurationComposite.this.btnAutomatischePositionierung.getSelection()); + } + }); this.btnPdfACompat = new Button(this.grpSignatur, SWT.CHECK); FormData fd_btnPdfACompat = new FormData(); fd_btnPdfACompat.right = new FormAttachment(100, -5); - fd_btnPdfACompat.top = new FormAttachment( - this.btnAutomatischePositionierung, 5); + fd_btnPdfACompat.top = new FormAttachment(this.btnAutomatischePositionierung, 5); fd_btnPdfACompat.left = new FormAttachment(0, 5); - this.btnPdfACompat - .setLayoutData(fd_btnPdfACompat); - - FontData[] fD_btnPdfACompat = this.btnPdfACompat - .getFont().getFontData(); - fD_btnPdfACompat[0] - .setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnPdfACompat.setFont(new Font(Display - .getCurrent(), fD_btnPdfACompat[0])); - - this.btnPdfACompat - .addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - AdvancedConfigurationComposite.this - .performPdfACompatSelection(AdvancedConfigurationComposite.this.btnPdfACompat - .getSelection()); - } - }); + this.btnPdfACompat.setLayoutData(fd_btnPdfACompat); + + FontData[] fD_btnPdfACompat = this.btnPdfACompat.getFont().getFontData(); + fD_btnPdfACompat[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnPdfACompat.setFont(new Font(Display.getCurrent(), fD_btnPdfACompat[0])); + + this.btnPdfACompat.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AdvancedConfigurationComposite.this + .performPdfACompatSelection(AdvancedConfigurationComposite.this.btnPdfACompat.getSelection()); + } + }); this.lblTransparenz = new Label(this.grpSignatur, SWT.HORIZONTAL); FormData fd_lblTransparenz = new FormData(); - fd_lblTransparenz.top = new FormAttachment( - this.btnPdfACompat, 5); + fd_lblTransparenz.top = new FormAttachment(this.btnPdfACompat, 5); fd_lblTransparenz.left = new FormAttachment(0, 5); this.lblTransparenz.setLayoutData(fd_lblTransparenz); FontData[] fD_lblTransparenz = this.lblTransparenz.getFont().getFontData(); fD_lblTransparenz[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblTransparenz.setFont(new Font(Display.getCurrent(), - fD_lblTransparenz[0])); + this.lblTransparenz.setFont(new Font(Display.getCurrent(), fD_lblTransparenz[0])); this.lblTransparenzLinks = new Label(this.grpSignatur, SWT.HORIZONTAL); FormData fd_lblTransparenzLinks = new FormData(); @@ -219,11 +197,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_lblTransparenzLinks.left = new FormAttachment(0, 15); this.lblTransparenzLinks.setLayoutData(fd_lblTransparenzLinks); - FontData[] fD_lblTransparenzLinks = this.lblTransparenzLinks.getFont() - .getFontData(); + FontData[] fD_lblTransparenzLinks = this.lblTransparenzLinks.getFont().getFontData(); fD_lblTransparenzLinks[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblTransparenzLinks.setFont(new Font(Display.getCurrent(), - fD_lblTransparenzLinks[0])); + this.lblTransparenzLinks.setFont(new Font(Display.getCurrent(), fD_lblTransparenzLinks[0])); this.lblTransparenzRechts = new Label(this.grpSignatur, SWT.HORIZONTAL); FormData fd_lblTransparenzRechts = new FormData(); @@ -231,11 +207,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_lblTransparenzRechts.right = new FormAttachment(100, -5); this.lblTransparenzRechts.setLayoutData(fd_lblTransparenzRechts); - FontData[] fD_lblTransparenzRechts = this.lblTransparenzRechts.getFont() - .getFontData(); + FontData[] fD_lblTransparenzRechts = this.lblTransparenzRechts.getFont().getFontData(); fD_lblTransparenzRechts[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblTransparenzRechts.setFont(new Font(Display.getCurrent(), - fD_lblTransparenzRechts[0])); + this.lblTransparenzRechts.setFont(new Font(Display.getCurrent(), fD_lblTransparenzRechts[0])); this.sclTransparenz = new Scale(this.grpSignatur, SWT.HORIZONTAL); FormData fd_sldTransparenz = new FormData(); @@ -250,30 +224,26 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.sclTransparenz.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - performPlaceholderTransparency(AdvancedConfigurationComposite.this.sclTransparenz - .getSelection()); + performPlaceholderTransparency(AdvancedConfigurationComposite.this.sclTransparenz.getSelection()); } }); - - + this.grpPlaceholder = new Group(this, SWT.NONE); FormLayout layout_grpPlaceholder = new FormLayout(); layout_grpPlaceholder.marginHeight = 10; layout_grpPlaceholder.marginWidth = 5; this.grpPlaceholder.setLayout(layout_grpPlaceholder); - + FormData fd_grpPlaceholder = new FormData(); fd_grpPlaceholder.top = new FormAttachment(this.grpSignatur, 5); fd_grpPlaceholder.right = new FormAttachment(100, -5); fd_grpPlaceholder.left = new FormAttachment(0, 5); this.grpPlaceholder.setLayoutData(fd_grpPlaceholder); - + FontData[] fD_grpPlaceholder = this.grpPlaceholder.getFont().getFontData(); fD_grpPlaceholder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpPlaceholder.setFont(new Font(Display.getCurrent(), - fD_grpPlaceholder[0])); - - + 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); @@ -311,19 +281,18 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { AdvancedConfigurationComposite.this.btnPlatzhalterVerwenden.getSelection()); } }); - + this.btnSignatureFieldsUsage = new Button(this.grpPlaceholder, SWT.RADIO); FormData fd_btnSignatureFieldsUsage = new FormData(); fd_btnSignatureFieldsUsage.right = new FormAttachment(100, -5); fd_btnSignatureFieldsUsage.top = new FormAttachment(this.btnPlatzhalterVerwenden, 5); fd_btnSignatureFieldsUsage.left = new FormAttachment(0, 5); this.btnSignatureFieldsUsage.setLayoutData(fd_btnSignatureFieldsUsage); - - + FontData[] fD_btnSignatureFieldsUsage = this.btnSignatureFieldsUsage.getFont().getFontData(); fD_btnSignatureFieldsUsage[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btnSignatureFieldsUsage.setFont(new Font(Display.getCurrent(), fD_btnSignatureFieldsUsage[0])); - + this.btnSignatureFieldsUsage.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -331,7 +300,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { AdvancedConfigurationComposite.this.btnSignatureFieldsUsage.getSelection()); } }); - this.grpBkuAuswahl = new Group(this, SWT.NONE); layout = new FormLayout(); @@ -346,8 +314,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_grpBkuAuswahl = this.grpBkuAuswahl.getFont().getFontData(); fD_grpBkuAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpBkuAuswahl.setFont(new Font(Display.getCurrent(), - fD_grpBkuAuswahl[0])); + this.grpBkuAuswahl.setFont(new Font(Display.getCurrent(), fD_grpBkuAuswahl[0])); this.cmbBKUAuswahl = new Combo(this.grpBkuAuswahl, SWT.READ_ONLY); FormData fd_cmbBKUAuswahl = new FormData(); @@ -356,11 +323,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_cmbBKUAuswahl.left = new FormAttachment(0, 5); this.cmbBKUAuswahl.setLayoutData(fd_cmbBKUAuswahl); - FontData[] fD_cmbBKUAuswahl = this.cmbBKUAuswahl.getFont() - .getFontData(); + FontData[] fD_cmbBKUAuswahl = this.cmbBKUAuswahl.getFont().getFontData(); fD_cmbBKUAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.cmbBKUAuswahl.setFont(new Font(Display.getCurrent(), - fD_cmbBKUAuswahl[0])); + this.cmbBKUAuswahl.setFont(new Font(Display.getCurrent(), fD_cmbBKUAuswahl[0])); int blen = BKUs.values().length; this.bkuStrings = new ArrayList<>(blen); @@ -374,15 +339,11 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { @Override public void widgetSelected(SelectionEvent e) { int selectionIndex = getBKUElementIndex( - AdvancedConfigurationComposite.this.configurationContainer - .getDefaultBKU()); - if (AdvancedConfigurationComposite.this.cmbBKUAuswahl - .getSelectionIndex() != selectionIndex) { - selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl - .getSelectionIndex(); + AdvancedConfigurationComposite.this.configurationContainer.getDefaultBKU()); + if (AdvancedConfigurationComposite.this.cmbBKUAuswahl.getSelectionIndex() != selectionIndex) { + selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl.getSelectionIndex(); performBKUSelectionChanged( - AdvancedConfigurationComposite.this.cmbBKUAuswahl - .getItem(selectionIndex)); + AdvancedConfigurationComposite.this.cmbBKUAuswahl.getItem(selectionIndex)); } } }); @@ -390,18 +351,13 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.btnKeystoreEnabled = new Button(this.grpBkuAuswahl, SWT.CHECK); FormData fd_btnKeystoreEnabled = new FormData(); fd_btnKeystoreEnabled.right = new FormAttachment(100, -5); - fd_btnKeystoreEnabled.top = new FormAttachment( - this.cmbBKUAuswahl, 5); + fd_btnKeystoreEnabled.top = new FormAttachment(this.cmbBKUAuswahl, 5); fd_btnKeystoreEnabled.left = new FormAttachment(0, 5); - this.btnKeystoreEnabled - .setLayoutData(fd_btnKeystoreEnabled); + this.btnKeystoreEnabled.setLayoutData(fd_btnKeystoreEnabled); - FontData[] fD_btnKeystoreEnabled = this.btnKeystoreEnabled - .getFont().getFontData(); - fD_btnKeystoreEnabled[0] - .setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnKeystoreEnabled.setFont(new Font(Display - .getCurrent(), fD_btnKeystoreEnabled[0])); + FontData[] fD_btnKeystoreEnabled = this.btnKeystoreEnabled.getFont().getFontData(); + fD_btnKeystoreEnabled[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnKeystoreEnabled.setFont(new Font(Display.getCurrent(), fD_btnKeystoreEnabled[0])); this.btnKeystoreEnabled.addSelectionListener(new SelectionAdapter() { @Override @@ -422,107 +378,92 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_grpSpeicherort = this.grpSpeicherort.getFont().getFontData(); fD_grpSpeicherort[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpSpeicherort.setFont(new Font(Display.getCurrent(), - fD_grpSpeicherort[0])); + this.grpSpeicherort.setFont(new Font(Display.getCurrent(), fD_grpSpeicherort[0])); this.lblDefaultOutputFolder = new Label(this.grpSpeicherort, SWT.NONE); - FontData[] fD_lblDefaultOutputFolder = this.lblDefaultOutputFolder.getFont() - .getFontData(); + FontData[] fD_lblDefaultOutputFolder = this.lblDefaultOutputFolder.getFont().getFontData(); fD_lblDefaultOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), - fD_lblDefaultOutputFolder[0])); - - this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); - GridData gd_txtOutputFolder = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); - gd_txtOutputFolder.widthHint = 291; - txtOutputFolder.setLayoutData(gd_txtOutputFolder); - - FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont() - .getFontData(); - this.txtOutputFolder.setFont(new Font(Display.getCurrent(), - fD_txtOutputFolder[0])); - - this.txtOutputFolder.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { - performOutputFolderChanged(AdvancedConfigurationComposite.this.txtOutputFolder - .getText()); - } - }); + this.lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0])); + + this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); + GridData gd_txtOutputFolder = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gd_txtOutputFolder.widthHint = 291; + txtOutputFolder.setLayoutData(gd_txtOutputFolder); + + FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont().getFontData(); + this.txtOutputFolder.setFont(new Font(Display.getCurrent(), fD_txtOutputFolder[0])); + + this.txtOutputFolder.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + performOutputFolderChanged(AdvancedConfigurationComposite.this.txtOutputFolder.getText()); + } + }); fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); -// fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); - - this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); - btnBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - - FontData[] fD_btnBrowse = this.btnBrowse.getFont().getFontData(); - this.btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); - - this.btnBrowse.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - DirectoryDialog dlg = new DirectoryDialog( - AdvancedConfigurationComposite.this.getShell()); - - // Set the initial filter path according - // to anything they've selected or typed in - dlg.setFilterPath(AdvancedConfigurationComposite.this.txtOutputFolder - .getText()); - - // Change the title bar text - dlg.setText(Messages - .getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$ - - // Customizable message displayed in the dialog - dlg.setMessage(Messages - .getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$ - - // Calling open() will open and run the dialog. - // It will return the selected directory, or - // null if user cancels - String dir = dlg.open(); - if (dir != null) { - // Set the text box to the new selection - performOutputFolderChanged(dir); - } - } - }); - - - this.lblSaveFilePostFix = new Label(this.grpSpeicherort, SWT.NONE); - lblSaveFilePostFix.setText(Messages.getString("AdvancedConfigurationComposite.lblSaveFilePostFix.text")); - - FontData[] fD_lblSaveFilePostFix = this.lblSaveFilePostFix.getFont() - .getFontData(); - this.lblSaveFilePostFix.setFont(new Font(Display.getCurrent(), - fD_lblSaveFilePostFix[0])); - - this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.BORDER); - GridData gd_txtSaveFilePostFix = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); - gd_txtSaveFilePostFix.widthHint = 256; - txtSaveFilePostFix.setLayoutData(gd_txtSaveFilePostFix); - - FontData[] fD_txtPostFix = this.txtSaveFilePostFix.getFont() - .getFontData(); - this.txtSaveFilePostFix.setFont(new Font(Display.getCurrent(), - fD_txtPostFix[0])); - - this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { - //performOutputFolderChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix - //.getText()); - } - }); + // fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); + + this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); + btnBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + + FontData[] fD_btnBrowse = this.btnBrowse.getFont().getFontData(); + this.btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); + + this.btnBrowse.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dlg = new DirectoryDialog(AdvancedConfigurationComposite.this.getShell()); + + // Set the initial filter path according + // to anything they've selected or typed in + dlg.setFilterPath(AdvancedConfigurationComposite.this.txtOutputFolder.getText()); + + // Change the title bar text + dlg.setText(Messages.getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$ + + // Customizable message displayed in the dialog + dlg.setMessage(Messages.getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$ + + // Calling open() will open and run the dialog. + // It will return the selected directory, or + // null if user cancels + String dir = dlg.open(); + if (dir != null) { + // Set the text box to the new selection + performOutputFolderChanged(dir); + } + } + }); + + this.lblSaveFilePostFix = new Label(this.grpSpeicherort, SWT.NONE); + lblSaveFilePostFix.setText(Messages.getString("AdvancedConfigurationComposite.lblSaveFilePostFix.text")); + + FontData[] fD_lblSaveFilePostFix = this.lblSaveFilePostFix.getFont().getFontData(); + fD_lblSaveFilePostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lblSaveFilePostFix.setFont(new Font(Display.getCurrent(), fD_lblSaveFilePostFix[0])); + + this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.BORDER); + GridData gd_txtSaveFilePostFix = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); +// gd_txtSaveFilePostFix.widthHint = 256; + txtSaveFilePostFix.setLayoutData(gd_txtSaveFilePostFix); + + FontData[] fD_txtPostFix = this.txtSaveFilePostFix.getFont().getFontData(); + this.txtSaveFilePostFix.setFont(new Font(Display.getCurrent(), fD_txtPostFix[0])); + + this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + // performOutputFolderChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix + // .getText()); + } + }); new Label(grpSpeicherort, SWT.NONE); fD_lblSaveFilePostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); fD_txtPostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpLocaleAuswahl = new Group(this, SWT.NONE); FormLayout layout_grpLocaleAuswahl = new FormLayout(); layout_grpLocaleAuswahl.marginHeight = 10; @@ -536,8 +477,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_grpLocaleAuswahl = this.grpLocaleAuswahl.getFont().getFontData(); fD_grpLocaleAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpLocaleAuswahl.setFont(new Font(Display.getCurrent(), - fD_grpLocaleAuswahl[0])); + this.grpLocaleAuswahl.setFont(new Font(Display.getCurrent(), fD_grpLocaleAuswahl[0])); this.cmbLocaleAuswahl = new Combo(this.grpLocaleAuswahl, SWT.READ_ONLY); FormData fd_cmbLocaleAuswahl = new FormData(); @@ -546,11 +486,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_cmbLocaleAuswahl.left = new FormAttachment(0, 5); this.cmbLocaleAuswahl.setLayoutData(fd_cmbLocaleAuswahl); - FontData[] fD_cmbLocaleAuswahl = this.cmbLocaleAuswahl.getFont() - .getFontData(); + FontData[] fD_cmbLocaleAuswahl = this.cmbLocaleAuswahl.getFont().getFontData(); fD_cmbLocaleAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.cmbLocaleAuswahl.setFont(new Font(Display.getCurrent(), - fD_cmbLocaleAuswahl[0])); + this.cmbLocaleAuswahl.setFont(new Font(Display.getCurrent(), fD_cmbLocaleAuswahl[0])); String[] localeStrings = new String[Constants.SUPPORTED_LOCALES.length]; for (int i = 0; i < Constants.SUPPORTED_LOCALES.length; ++i) { @@ -560,11 +498,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer - .getLocale(); - Locale selectedLocale = Constants. - SUPPORTED_LOCALES[AdvancedConfigurationComposite.this.cmbLocaleAuswahl - .getSelectionIndex()]; + Locale currentLocale = AdvancedConfigurationComposite.this.configurationContainer.getLocale(); + Locale selectedLocale = Constants.SUPPORTED_LOCALES[AdvancedConfigurationComposite.this.cmbLocaleAuswahl + .getSelectionIndex()]; if (!currentLocale.equals(selectedLocale)) { performLocaleSelectionChanged(selectedLocale); } @@ -584,33 +520,26 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_grpUpdateCheck = this.grpUpdateCheck.getFont().getFontData(); fD_grpUpdateCheck[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.grpUpdateCheck.setFont(new Font(Display.getCurrent(), - fD_grpUpdateCheck[0])); + this.grpUpdateCheck.setFont(new Font(Display.getCurrent(), fD_grpUpdateCheck[0])); this.btnUpdateCheck = new Button(this.grpUpdateCheck, SWT.CHECK); FormData fd_btnUpdateCheck = new FormData(); fd_btnUpdateCheck.right = new FormAttachment(100, -5); fd_btnUpdateCheck.top = new FormAttachment(0); fd_btnUpdateCheck.left = new FormAttachment(0, 5); - this.btnUpdateCheck - .setLayoutData(fd_btnUpdateCheck); - - FontData[] fD_btnUpdateCheck = this.btnUpdateCheck - .getFont().getFontData(); - fD_btnUpdateCheck[0] - .setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnUpdateCheck.setFont(new Font(Display - .getCurrent(), fD_btnUpdateCheck[0])); - - this.btnUpdateCheck - .addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - AdvancedConfigurationComposite.this - .performUpdateCheckSelection(AdvancedConfigurationComposite.this.btnUpdateCheck - .getSelection()); - } - }); + this.btnUpdateCheck.setLayoutData(fd_btnUpdateCheck); + + FontData[] fD_btnUpdateCheck = this.btnUpdateCheck.getFont().getFontData(); + fD_btnUpdateCheck[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnUpdateCheck.setFont(new Font(Display.getCurrent(), fD_btnUpdateCheck[0])); + + this.btnUpdateCheck.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AdvancedConfigurationComposite.this + .performUpdateCheckSelection(AdvancedConfigurationComposite.this.btnUpdateCheck.getSelection()); + } + }); this.grpProxy = new Group(this, SWT.NONE); FormData fd_grpProxy = new FormData(); @@ -625,21 +554,18 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.grpProxy.setFont(new Font(Display.getCurrent(), fD_grpProxy[0])); this.lblProxyHost = new Label(this.grpProxy, SWT.NONE); - GridData gd_lblProxyHost = new GridData(SWT.LEFT, SWT.CENTER, false, - false, 1, 1); + GridData gd_lblProxyHost = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_lblProxyHost.widthHint = 66; this.lblProxyHost.setLayoutData(gd_lblProxyHost); this.lblProxyHost.setBounds(0, 0, 57, 15); FontData[] fD_lblProxyHost = this.lblProxyHost.getFont().getFontData(); fD_lblProxyHost[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblProxyHost.setFont(new Font(Display.getCurrent(), - fD_lblProxyHost[0])); + this.lblProxyHost.setFont(new Font(Display.getCurrent(), fD_lblProxyHost[0])); Composite compProxyHostContainer = new Composite(this.grpProxy, SWT.NONE); compProxyHostContainer.setLayout(new FormLayout()); - compProxyHostContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, - 1, 1)); + compProxyHostContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtProxyHost = new Text(compProxyHostContainer, SWT.BORDER); FormData fd_txtProxyHost = new FormData(); fd_txtProxyHost.right = new FormAttachment(100, -42); @@ -648,8 +574,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_txtProxyHost = this.txtProxyHost.getFont().getFontData(); fD_txtProxyHost[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtProxyHost.setFont(new Font(Display.getCurrent(), - fD_txtProxyHost[0])); + this.txtProxyHost.setFont(new Font(Display.getCurrent(), fD_txtProxyHost[0])); this.proxyHostErrorMarker = new ErrorMarker(compProxyHostContainer, SWT.NONE, ""); //$NON-NLS-1$ @@ -680,16 +605,13 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.lblProxyPort = new Label(this.grpProxy, SWT.NONE); this.lblProxyPort.setBounds(0, 0, 57, 15); - FontData[] fD_lblProxyPort = this.lblProxyPort.getFont() - .getFontData(); + FontData[] fD_lblProxyPort = this.lblProxyPort.getFont().getFontData(); fD_lblProxyPort[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lblProxyPort.setFont(new Font(Display.getCurrent(), - fD_lblProxyPort[0])); + this.lblProxyPort.setFont(new Font(Display.getCurrent(), fD_lblProxyPort[0])); Composite compProxyPortContainer = new Composite(this.grpProxy, SWT.NONE); compProxyPortContainer.setLayout(new FormLayout()); - compProxyPortContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, - 1, 1)); + compProxyPortContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.txtProxyPort = new Text(compProxyPortContainer, SWT.BORDER); this.fd_txtProxyPort = new FormData(); @@ -700,8 +622,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_txtProxyPort = this.txtProxyPort.getFont().getFontData(); fD_txtProxyPort[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.txtProxyPort.setFont(new Font(Display.getCurrent(), - fD_txtProxyPort[0])); + this.txtProxyPort.setFont(new Font(Display.getCurrent(), fD_txtProxyPort[0])); this.txtProxyPort.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN) { @@ -715,8 +636,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.fd_txtProxyPortErrorMarker.right = new FormAttachment(100); this.fd_txtProxyPortErrorMarker.top = new FormAttachment(0); this.fd_txtProxyPortErrorMarker.bottom = new FormAttachment(0, 32); - this.txtProxyPortErrorMarker - .setLayoutData(this.fd_txtProxyPortErrorMarker); + this.txtProxyPortErrorMarker.setLayoutData(this.fd_txtProxyPortErrorMarker); this.txtProxyPortErrorMarker.setVisible(false); this.txtProxyPort.addFocusListener(new FocusAdapter() { @@ -770,8 +690,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.performBKUSelectionChanged(bkuvalue); } catch (Exception ex) { log.error("Failed to parse BKU value: {} {}", selected, ex); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - Messages.getString("error.InvalidBKU"), BUTTONS.OK); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), Messages.getString("error.InvalidBKU"), BUTTONS.OK); //$NON-NLS-1$ dialog.open(); } } @@ -800,7 +719,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { log.warn("NO Locale match for {}", locale); //$NON-NLS-1$ return 0; } - + void performLocaleSelectionChanged(Locale selected) { log.debug("Selected Locale: {}", selected); //$NON-NLS-1$ this.configurationContainer.setLocale(selected); @@ -823,14 +742,14 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setUseSignatureFields(useFields); this.btnSignatureFieldsUsage.setSelection(useFields); } - + void performEnableUsePlaceholder(boolean enable) { this.btnPlatzhalterVerwenden.setEnabled(enable); this.btnSignatureFieldsUsage.setEnabled(enable); this.configurationContainer.setEnablePlaceholderUsage(enable); this.btnEnablePlaceholderUsage.setSelection(enable); } - + void performPdfACompatSelection(boolean compat) { this.configurationContainer.setSignaturePdfACompat(compat); this.btnPdfACompat.setSelection(compat); @@ -915,6 +834,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { /* * (non-Javadoc) + * * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() */ @Override @@ -922,78 +842,68 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { // Nothing to do here } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#initConfiguration(at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.composites.BaseConfigurationComposite#initConfiguration( + * at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) */ @Override public void initConfiguration(PersistentConfigProvider provider) { - this.configurationContainer.setDefaultSignaturePosition( - provider.getDefaultSignaturePositionPersistent()); + this.configurationContainer.setDefaultSignaturePosition(provider.getDefaultSignaturePositionPersistent()); this.configurationContainer.setUseMarker(provider.getUseMarker()); this.configurationContainer.setUseSignatureFields(provider.getUseSignatureFields()); this.configurationContainer.setEnablePlaceholderUsage(provider.getEnablePlaceholderUsage()); - this.configurationContainer.setSignaturePdfACompat( - provider.getSignaturePdfACompat()); - this.configurationContainer.setPlaceholderTransparency( - provider.getPlaceholderTransparency()); + this.configurationContainer.setSignaturePdfACompat(provider.getSignaturePdfACompat()); + this.configurationContainer.setPlaceholderTransparency(provider.getPlaceholderTransparency()); - this.configurationContainer.setDefaultBKU( - provider.getDefaultBKUPersistent()); - this.configurationContainer.setKeyStoreEnabled( - provider.getKeyStoreEnabledPersistent()); + this.configurationContainer.setDefaultBKU(provider.getDefaultBKUPersistent()); + this.configurationContainer.setKeyStoreEnabled(provider.getKeyStoreEnabledPersistent()); - this.configurationContainer.setOutputFolder( - provider.getDefaultOutputFolderPersistent()); + this.configurationContainer.setOutputFolder(provider.getDefaultOutputFolderPersistent()); this.configurationContainer.setLocale(provider.getLocale()); - this.configurationContainer.setUpdateCheck( - provider.getUpdateCheck()); + this.configurationContainer.setUpdateCheck(provider.getUpdateCheck()); - this.configurationContainer.setProxyHost( - provider.getProxyHostPersistent()); + this.configurationContainer.setProxyHost(provider.getProxyHostPersistent()); try { - this.configurationContainer.setProxyPort( - provider.getProxyPortPersistent()); + this.configurationContainer.setProxyPort(provider.getProxyPortPersistent()); } catch (InvalidPortException e) { log.error("Failed to set proxy port!", e); //$NON-NLS-1$ } - this.configurationContainer.setProxyUser( - provider.getProxyUserPersistent()); - this.configurationContainer.setProxyPass( - provider.getProxyPassPersistent()); + this.configurationContainer.setProxyUser(provider.getProxyUserPersistent()); + this.configurationContainer.setProxyPass(provider.getProxyPassPersistent()); this.configurationContainer.setSignatureProfile(Profile.getProfile(provider.getSignatureProfile())); } /* * (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#loadConfiguration() + * + * @see + * at.asit.pdfover.gui.composites.BaseConfigurationComposite#loadConfiguration() */ @Override public void loadConfiguration() { // load advanced settings - performBKUSelectionChanged(this.configurationContainer - .getDefaultBKU()); + performBKUSelectionChanged(this.configurationContainer.getDefaultBKU()); String outputFolder = this.configurationContainer.getOutputFolder(); if (outputFolder != null) { performOutputFolderChanged(outputFolder); } - SignaturePosition pos = this.configurationContainer - .getDefaultSignaturePosition(); + SignaturePosition pos = this.configurationContainer.getDefaultSignaturePosition(); performPositionSelection(pos != null && pos.useAutoPositioning()); performUseMarkerSelection(this.configurationContainer.getUseMarker()); performUseSignatureFieldsSelection(this.configurationContainer.getUseSignatureFields()); performEnableUsePlaceholder(this.configurationContainer.getEnablePlaceholderUsage()); - this.sclTransparenz.setSelection(this.configurationContainer - .getPlaceholderTransparency()); + this.sclTransparenz.setSelection(this.configurationContainer.getPlaceholderTransparency()); performLocaleSelectionChanged(this.configurationContainer.getLocale()); performPdfACompatSelection(this.configurationContainer.getSignaturePdfACompat()); performKeystoreEnabledSelection(this.configurationContainer.getKeyStoreEnabled()); performUpdateCheckSelection(this.configurationContainer.getUpdateCheck()); performSetSignatureProfile(this.configurationContainer.getSignatureProfile()); - int port = this.configurationContainer.getProxyPort(); if (port > 0) { this.txtProxyPort.setText(Integer.toString(port)); @@ -1003,44 +913,44 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { if (host != null) { this.txtProxyHost.setText(host); } - -} + } /** - * @param profile + * @param profile * */ public void performSetSignatureProfile(Profile profile) { - switch (profile){ - case INVISIBLE: - case AMTSSIGNATURBLOCK: - this.performPositionSelection(true); - this.btnAutomatischePositionierung.setEnabled(false); - this.btnEnablePlaceholderUsage.setEnabled(true); - this.performEnableUsePlaceholder(false); - break; - default: - this.btnAutomatischePositionierung.setEnabled(true); - this.btnEnablePlaceholderUsage.setEnabled(true); + switch (profile) { + case INVISIBLE: + case AMTSSIGNATURBLOCK: + this.performPositionSelection(true); + this.btnAutomatischePositionierung.setEnabled(false); + this.btnEnablePlaceholderUsage.setEnabled(true); + this.performEnableUsePlaceholder(false); + break; + default: + this.btnAutomatischePositionierung.setEnabled(true); + this.btnEnablePlaceholderUsage.setEnabled(true); } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration(at.asit.pdfover.gui.workflow.config.ConfigManipulator, at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration( + * at.asit.pdfover.gui.workflow.config.ConfigManipulator, + * at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) */ @Override - public void storeConfiguration(ConfigManipulator store, - PersistentConfigProvider provider) { - store.setDefaultSignaturePosition( - this.configurationContainer.getDefaultSignaturePosition()); + public void storeConfiguration(ConfigManipulator store, PersistentConfigProvider provider) { + store.setDefaultSignaturePosition(this.configurationContainer.getDefaultSignaturePosition()); store.setUseMarker(this.configurationContainer.getUseMarker()); store.setUseSignatureFields(this.configurationContainer.getUseSignatureFields()); store.setEnablePlaceholderUsage(this.configurationContainer.getEnablePlaceholderUsage()); - store.setSignaturePdfACompat( - this.configurationContainer.getSignaturePdfACompat()); - store.setPlaceholderTransparency( - this.configurationContainer.getPlaceholderTransparency()); + store.setSignaturePdfACompat(this.configurationContainer.getSignaturePdfACompat()); + store.setPlaceholderTransparency(this.configurationContainer.getPlaceholderTransparency()); store.setDefaultBKU(this.configurationContainer.getDefaultBKU()); store.setKeyStoreEnabled(this.configurationContainer.getKeyStoreEnabled()); @@ -1050,13 +960,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { store.setLocale(this.configurationContainer.getLocale()); store.setUpdateCheck(this.configurationContainer.getUpdateCheck()); - + store.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName()); String hostOld = provider.getProxyHostPersistent(); String hostNew = this.configurationContainer.getProxyHost(); - if (hostOld != null && !hostOld.isEmpty() && - (hostNew == null || hostNew.isEmpty())) { + if (hostOld != null && !hostOld.isEmpty() && (hostNew == null || hostNew.isEmpty())) { // Proxy has been removed, let's clear the system properties // Otherwise, the proxy settings wouldn't get removed System.clearProperty("http.proxyHost"); //$NON-NLS-1$ @@ -1075,8 +984,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { String userOld = provider.getProxyUserPersistent(); String userNew = this.configurationContainer.getProxyUser(); - if (userOld != null && !userOld.isEmpty() && - (userNew == null || userNew.isEmpty())) { + if (userOld != null && !userOld.isEmpty() && (userNew == null || userNew.isEmpty())) { // cf. above System.clearProperty("http.proxyUser"); //$NON-NLS-1$ System.clearProperty("https.proxyUser"); //$NON-NLS-1$ @@ -1092,121 +1000,102 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } store.setProxyPass(passNew); } + /* * (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#validateSettings() + * + * @see + * at.asit.pdfover.gui.composites.BaseConfigurationComposite#validateSettings() */ @Override public void validateSettings(int resumeIndex) throws Exception { - + String foldername = this.configurationContainer.getOutputFolder(); - + switch (resumeIndex) { - case 0: - if (foldername != null && !foldername.isEmpty()) { - File outputFolder = new File(foldername); - if (!outputFolder.exists()) { - throw new OutputfolderDoesntExistException(outputFolder, 1); - } - if (!outputFolder.isDirectory()) { - throw new OutputfolderNotADirectoryException(outputFolder); - } + case 0: + if (foldername != null && !foldername.isEmpty()) { + File outputFolder = new File(foldername); + if (!outputFolder.exists()) { + throw new OutputfolderDoesntExistException(outputFolder, 1); } - // Fall through - case 1: - this.plainProxyHostSetter(); - // Fall through - case 2: - this.plainProxyPortSetter(); - // Fall through -// case 3: -// this.plainProxyUserSetter(); -// // Fall through -// case 4: -// this.plainProxyPassSetter(); + if (!outputFolder.isDirectory()) { + throw new OutputfolderNotADirectoryException(outputFolder); + } + } + // Fall through + case 1: + this.plainProxyHostSetter(); + // Fall through + case 2: + this.plainProxyPortSetter(); + // Fall through + // case 3: + // this.plainProxyUserSetter(); + // // Fall through + // case 4: + // this.plainProxyPassSetter(); } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() */ @Override public void reloadResources() { - this.grpSignatur.setText(Messages - .getString("advanced_config.Signature_Title")); //$NON-NLS-1$ - this.btnAutomatischePositionierung.setText(Messages - .getString("advanced_config.AutoPosition")); //$NON-NLS-1$ - this.btnAutomatischePositionierung.setToolTipText(Messages - .getString("advanced_config.AutoPosition_ToolTip")); //$NON-NLS-1$ + this.grpSignatur.setText(Messages.getString("advanced_config.Signature_Title")); //$NON-NLS-1$ + this.btnAutomatischePositionierung.setText(Messages.getString("advanced_config.AutoPosition")); //$NON-NLS-1$ + this.btnAutomatischePositionierung.setToolTipText(Messages.getString("advanced_config.AutoPosition_ToolTip")); //$NON-NLS-1$ this.grpPlaceholder.setText(Messages.getString("advanced_config.Placeholder_Title")); //$NON-NLS-1$ this.btnPlatzhalterVerwenden.setText(Messages.getString("advanced_config.UseMarker")); //$NON-NLS-1$ 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 - .getString("advanced_config.PdfACompat_ToolTip")); //$NON-NLS-1$ - this.lblTransparenz.setText(Messages - .getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$ - this.lblTransparenzLinks.setText(Messages - .getString("advanced_config.SigPHTransparencyMin")); //$NON-NLS-1$ - this.lblTransparenzRechts.setText(Messages - .getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$ - this.sclTransparenz.setToolTipText(Messages - .getString("advanced_config.SigPHTransparencyTooltip")); //$NON-NLS-1$ - - this.grpBkuAuswahl.setText(Messages - .getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$ - this.cmbBKUAuswahl.setToolTipText(Messages - .getString("advanced_config.BKUSelection_ToolTip")); //$NON-NLS-1$ - this.btnKeystoreEnabled.setText(Messages - .getString("advanced_config.KeystoreEnabled")); //$NON-NLS-1$ - this.btnKeystoreEnabled.setToolTipText(Messages - .getString("advanced_config.KeystoreEnabled_ToolTip")); //$NON-NLS-1$ - - this.grpSpeicherort.setText(Messages - .getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$ - this.lblDefaultOutputFolder.setText(Messages - .getString("advanced_config.OutputFolder")); //$NON-NLS-1$ - this.txtOutputFolder.setToolTipText(Messages - .getString("advanced_config.OutputFolder_ToolTip")); //$NON-NLS-1$ + this.btnPdfACompat.setText(Messages.getString("advanced_config.PdfACompat")); //$NON-NLS-1$ + this.btnPdfACompat.setToolTipText(Messages.getString("advanced_config.PdfACompat_ToolTip")); //$NON-NLS-1$ + this.lblTransparenz.setText(Messages.getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$ + this.lblTransparenzLinks.setText(Messages.getString("advanced_config.SigPHTransparencyMin")); //$NON-NLS-1$ + this.lblTransparenzRechts.setText(Messages.getString("advanced_config.SigPHTransparencyMax")); //$NON-NLS-1$ + this.sclTransparenz.setToolTipText(Messages.getString("advanced_config.SigPHTransparencyTooltip")); //$NON-NLS-1$ + + this.grpBkuAuswahl.setText(Messages.getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$ + this.cmbBKUAuswahl.setToolTipText(Messages.getString("advanced_config.BKUSelection_ToolTip")); //$NON-NLS-1$ + this.btnKeystoreEnabled.setText(Messages.getString("advanced_config.KeystoreEnabled")); //$NON-NLS-1$ + this.btnKeystoreEnabled.setToolTipText(Messages.getString("advanced_config.KeystoreEnabled_ToolTip")); //$NON-NLS-1$ + + this.grpSpeicherort.setText(Messages.getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$ + this.lblDefaultOutputFolder.setText(Messages.getString("advanced_config.OutputFolder")); //$NON-NLS-1$ + this.txtOutputFolder.setToolTipText(Messages.getString("advanced_config.OutputFolder_ToolTip")); //$NON-NLS-1$ this.btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$ - this.grpLocaleAuswahl.setText(Messages - .getString("advanced_config.LocaleSelection_Title")); //$NON-NLS-1$ - this.cmbLocaleAuswahl.setToolTipText(Messages - .getString("advanced_config.LocaleSelection_ToolTip")); //$NON-NLS-1$ + this.grpLocaleAuswahl.setText(Messages.getString("advanced_config.LocaleSelection_Title")); //$NON-NLS-1$ + this.cmbLocaleAuswahl.setToolTipText(Messages.getString("advanced_config.LocaleSelection_ToolTip")); //$NON-NLS-1$ - this.grpUpdateCheck.setText(Messages - .getString("advanced_config.UpdateCheck_Title")); //$NON-NLS-1$ - this.btnUpdateCheck.setText(Messages - .getString("advanced_config.UpdateCheck")); //$NON-NLS-1$ - this.btnUpdateCheck.setToolTipText(Messages - .getString("advanced_config.UpdateCheck_ToolTip")); //$NON-NLS-1$ + this.grpUpdateCheck.setText(Messages.getString("advanced_config.UpdateCheck_Title")); //$NON-NLS-1$ + this.btnUpdateCheck.setText(Messages.getString("advanced_config.UpdateCheck")); //$NON-NLS-1$ + this.btnUpdateCheck.setToolTipText(Messages.getString("advanced_config.UpdateCheck_ToolTip")); //$NON-NLS-1$ this.grpProxy.setText(Messages.getString("advanced_config.Proxy_Title")); //$NON-NLS-1$ this.lblProxyHost.setText(Messages.getString("advanced_config.ProxyHost")); //$NON-NLS-1$ - this.txtProxyHost.setToolTipText(Messages - .getString("advanced_config.ProxyHost_ToolTip")); //$NON-NLS-1$ - this.txtProxyHost.setMessage(Messages - .getString("advanced_config.ProxyHost_Template")); //$NON-NLS-1$ - this.lblProxyPort.setText(Messages - .getString("advanced_config.ProxyPort")); //$NON-NLS-1$ - this.txtProxyPort.setToolTipText(Messages - .getString("advanced_config.ProxyPort_ToolTip")); //$NON-NLS-1$ - this.txtProxyPort.setMessage(Messages - .getString("advanced_config.ProxyPort_Template")); //$NON-NLS-1$ -// this.lblProxyUser.setText(Messages.getString("advanced_config.ProxyUser")); //$NON-NLS-1$ -// this.txtProxyUser.setToolTipText(Messages -// .getString("advanced_config.ProxyUser_ToolTip")); //$NON-NLS-1$ -// this.txtProxyUser.setMessage(Messages -// .getString("advanced_config.ProxyUser_Template")); //$NON-NLS-1$ -// this.lblProxyPass.setText(Messages.getString("advanced_config.ProxyPass")); //$NON-NLS-1$ -// this.txtProxyPass.setToolTipText(Messages -// .getString("advanced_config.ProxyPass_ToolTip")); //$NON-NLS-1$ -// this.txtProxyPass.setMessage(Messages -// .getString("advanced_config.ProxyPass_Template")); //$NON-NLS-1$ + this.txtProxyHost.setToolTipText(Messages.getString("advanced_config.ProxyHost_ToolTip")); //$NON-NLS-1$ + this.txtProxyHost.setMessage(Messages.getString("advanced_config.ProxyHost_Template")); //$NON-NLS-1$ + this.lblProxyPort.setText(Messages.getString("advanced_config.ProxyPort")); //$NON-NLS-1$ + this.txtProxyPort.setToolTipText(Messages.getString("advanced_config.ProxyPort_ToolTip")); //$NON-NLS-1$ + this.txtProxyPort.setMessage(Messages.getString("advanced_config.ProxyPort_Template")); //$NON-NLS-1$ + // this.lblProxyUser.setText(Messages.getString("advanced_config.ProxyUser")); + // //$NON-NLS-1$ + // this.txtProxyUser.setToolTipText(Messages + // .getString("advanced_config.ProxyUser_ToolTip")); //$NON-NLS-1$ + // this.txtProxyUser.setMessage(Messages + // .getString("advanced_config.ProxyUser_Template")); //$NON-NLS-1$ + // this.lblProxyPass.setText(Messages.getString("advanced_config.ProxyPass")); + // //$NON-NLS-1$ + // this.txtProxyPass.setToolTipText(Messages + // .getString("advanced_config.ProxyPass_ToolTip")); //$NON-NLS-1$ + // this.txtProxyPass.setMessage(Messages + // .getString("advanced_config.ProxyPass_Template")); //$NON-NLS-1$ } } -- cgit v1.2.3 From 6bb81343ac29b50a4dd3539ec2ceb007a732954c Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 15:29:31 +0100 Subject: AdvancedConfig extended --- .../composites/AdvancedConfigurationComposite.java | 21 ++++++++++++++------- .../gui/workflow/config/ConfigurationContainer.java | 5 +++++ .../workflow/config/ConfigurationContainerImpl.java | 17 +++++++++++++++-- 3 files changed, 34 insertions(+), 9 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 94474c66..4b32f59f 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 @@ -371,11 +371,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { GridLayout gl_grpSpeicherort = new GridLayout(3, false); grpSpeicherort.setLayout(gl_grpSpeicherort); FormData fd_grpSpeicherort = new FormData(); - fd_grpSpeicherort.left = new FormAttachment(100, -499); + fd_grpSpeicherort.left = new FormAttachment(0,5); fd_grpSpeicherort.top = new FormAttachment(this.grpBkuAuswahl, 5); fd_grpSpeicherort.right = new FormAttachment(100, -5); this.grpSpeicherort.setLayoutData(fd_grpSpeicherort); + FontData[] fD_grpSpeicherort = this.grpSpeicherort.getFont().getFontData(); fD_grpSpeicherort[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.grpSpeicherort.setFont(new Font(Display.getCurrent(), fD_grpSpeicherort[0])); @@ -388,10 +389,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); GridData gd_txtOutputFolder = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); - gd_txtOutputFolder.widthHint = 291; txtOutputFolder.setLayoutData(gd_txtOutputFolder); FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont().getFontData(); + fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.txtOutputFolder.setFont(new Font(Display.getCurrent(), fD_txtOutputFolder[0])); this.txtOutputFolder.addFocusListener(new FocusAdapter() { @@ -402,14 +403,13 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - // fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btnBrowse = new Button(this.grpSpeicherort, SWT.NONE); btnBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); FontData[] fD_btnBrowse = this.btnBrowse.getFont().getFontData(); + fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); - this.btnBrowse.addSelectionListener(new SelectionAdapter() { @Override @@ -446,18 +446,18 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.BORDER); GridData gd_txtSaveFilePostFix = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); -// gd_txtSaveFilePostFix.widthHint = 256; + txtSaveFilePostFix.setLayoutData(gd_txtSaveFilePostFix); FontData[] fD_txtPostFix = this.txtSaveFilePostFix.getFont().getFontData(); + fD_txtPostFix[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.txtSaveFilePostFix.setFont(new Font(Display.getCurrent(), fD_txtPostFix[0])); this.txtSaveFilePostFix.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { - // performOutputFolderChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix - // .getText()); + performPostFixChanged(AdvancedConfigurationComposite.this.txtSaveFilePostFix.getText()); } }); new Label(grpSpeicherort, SWT.NONE); @@ -649,6 +649,13 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { reloadResources(); } + private void performPostFixChanged(String postfix) { + + log.debug("Save file postfix changed to : {}", postfix); //$NON-NLS-1$ + this.configurationContainer.setSaveFilePostFix(postfix); + AdvancedConfigurationComposite.this.txtSaveFilePostFix.setText(postfix); + } + /* * (non-Javadoc) * 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 bed44da1..4c634fd6 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 @@ -421,4 +421,9 @@ public interface ConfigurationContainer { * @return selected signature profile as string */ public Profile getSignatureProfile(); + + + public void setSaveFilePostFix(String postFix); + + public String getSaveFilePostFix(); } 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 e00e04d6..47094aa7 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 @@ -149,6 +149,8 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** The Signature Profile */ protected Profile signatureProfile = null; + protected String saveFilePostFix = "_signed"; + /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() */ @@ -735,8 +737,19 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { } return this.signatureProfile; } - - @Override + + @Override + public String getSaveFilePostFix() { + return this.saveFilePostFix; + } + + @Override + public void setSaveFilePostFix(String postfix){ + this.saveFilePostFix = postfix; + } + + + @Override public void setSignatureProfile(Profile profile) { this.signatureProfile = profile; } -- cgit v1.2.3 From 0ac178bebfeed95af88de462f2c463f7569be9dd Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 15:42:02 +0100 Subject: Fixed GUI --- .../asit/pdfover/gui/composites/AdvancedConfigurationComposite.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 4b32f59f..0cb26983 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 @@ -388,7 +388,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0])); this.txtOutputFolder = new Text(this.grpSpeicherort, SWT.BORDER); - GridData gd_txtOutputFolder = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + GridData gd_txtOutputFolder = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); txtOutputFolder.setLayoutData(gd_txtOutputFolder); FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont().getFontData(); @@ -445,7 +445,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.lblSaveFilePostFix.setFont(new Font(Display.getCurrent(), fD_lblSaveFilePostFix[0])); this.txtSaveFilePostFix = new Text(this.grpSpeicherort, SWT.BORDER); - GridData gd_txtSaveFilePostFix = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + GridData gd_txtSaveFilePostFix = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); txtSaveFilePostFix.setLayoutData(gd_txtSaveFilePostFix); -- cgit v1.2.3 From 402805f8485a926a8efd8d01de9af98824941140 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 16:30:36 +0100 Subject: Added Postfix option to the configuration --- .../main/java/at/asit/pdfover/gui/Constants.java | 5 +++- .../composites/AdvancedConfigurationComposite.java | 9 +++++++- .../gui/workflow/config/ConfigManipulator.java | 4 +++- .../gui/workflow/config/ConfigProvider.java | 2 ++ .../gui/workflow/config/ConfigProviderImpl.java | 27 ++++++++++++---------- .../workflow/config/PersistentConfigProvider.java | 4 +++- 6 files changed, 35 insertions(+), 16 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 17a9a8d7..1fa31abb 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 @@ -41,8 +41,9 @@ public class Constants { public static final String APP_NAME_VERSION = (APP_VERSION == null ? APP_NAME : APP_NAME + " v" + APP_VERSION); //$NON-NLS-1$ public static final String SIGNATURE_PROFILE = "SIGNATURE_PROFILE"; //$NON-NLS-1$ + public static final String DEFAULT_POSTFIX = "_signed"; - static { + static { // Has to be set before (implicitly) initializing Display Display.setAppName(APP_NAME); } @@ -209,6 +210,8 @@ public class Constants { /** The output folder config parameter */ public static final String CFG_OUTPUT_FOLDER = "OUTPUT_FOLDER"; //$NON-NLS-1$ + public static final String CFG_POSTFIX = "SAVE_FILE_POSTFIX"; + /** The main window size (Format: width,height) */ public static final String CFG_MAINWINDOW_SIZE = "MAINWINDOW_SIZE"; //$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 0cb26983..8ed1b640 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 @@ -869,6 +869,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setKeyStoreEnabled(provider.getKeyStoreEnabledPersistent()); this.configurationContainer.setOutputFolder(provider.getDefaultOutputFolderPersistent()); + this.configurationContainer.setSaveFilePostFix(provider.getSaveFilePostFix()); this.configurationContainer.setLocale(provider.getLocale()); @@ -899,6 +900,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { if (outputFolder != null) { performOutputFolderChanged(outputFolder); } + String postFix = this.configurationContainer.getSaveFilePostFix(); + if (postFix != null) { + performPostFixChanged(postFix); + } else { + performPostFixChanged(Constants.DEFAULT_POSTFIX); + } SignaturePosition pos = this.configurationContainer.getDefaultSignaturePosition(); performPositionSelection(pos != null && pos.useAutoPositioning()); performUseMarkerSelection(this.configurationContainer.getUseMarker()); @@ -963,7 +970,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { store.setKeyStoreEnabled(this.configurationContainer.getKeyStoreEnabled()); store.setDefaultOutputFolder(this.configurationContainer.getOutputFolder()); - + store.setSaveFilePostFix(this.configurationContainer.getSaveFilePostFix()); store.setLocale(this.configurationContainer.getLocale()); store.setUpdateCheck(this.configurationContainer.getUpdateCheck()); 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 3aba5075..befb244b 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 @@ -201,7 +201,9 @@ public interface ConfigManipulator { /** * @param profile */ - void setSignatureProfile(String profile); + public void setSignatureProfile(String profile); + + public void setSaveFilePostFix(String postFix); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index efe0a83b..b6935206 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -276,6 +276,8 @@ public interface ConfigProvider { * @return */ public String getSignatureProfile(); + + public String getSaveFilePostFix(); } 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 92a64103..9dc19be4 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 @@ -114,6 +114,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setDefaultOutputFolder(config .getProperty(Constants.CFG_OUTPUT_FOLDER)); + setSaveFilePostFix(config.getProperty(Constants.CFG_POSTFIX)); + String localeString = config.getProperty(Constants.CFG_LOCALE); Locale targetLocale = LocaleSerializer.parseFromString(localeString); @@ -351,6 +353,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, props.setProperty(Constants.CFG_SIGNATURE_NOTE, getSignatureNote()); props.setProperty(Constants.CFG_MOBILE_NUMBER, getDefaultMobileNumberPersistent()); props.setProperty(Constants.CFG_OUTPUT_FOLDER, getDefaultOutputFolderPersistent()); + props.setProperty(Constants.CFG_POSTFIX, getSaveFilePostFix()); props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY, Integer.toString(getPlaceholderTransparency())); @@ -985,16 +988,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - - /*@Override - public void setDefaultDownloadURL(String downloadURL) { - if (downloadURL == null || downloadURL.trim().isEmpty()) { - this.configuration.setDownloadURL(Constants.CERTIFICATE_DOWNLOAD_XML_URL+Constants.CERTIFICATE_XML_FILE); - } else { - this.configuration.setDownloadURL(downloadURL); - } - } - /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultOutputFolderOverlay(java.lang.String) */ @@ -1510,8 +1503,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, public void setSignatureProfile(String profile) { this.configurationOverlay.setSignatureProfile(Profile.getProfile(profile)); } - - @Override + + @Override + public void setSaveFilePostFix(String postFix) { + this.configurationOverlay.setSaveFilePostFix(postFix); + } + + @Override + public String getSaveFilePostFix(){ + return this.configurationOverlay.getSaveFilePostFix(); + } + + @Override public String getSignatureProfile() { return this.configurationOverlay.getSignatureProfile().getName(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java index 3304b6ca..1175ca9a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java @@ -204,5 +204,7 @@ public interface PersistentConfigProvider { * * @return the signature profile */ - public String getSignatureProfile(); + public String getSignatureProfile(); + + public String getSaveFilePostFix(); } -- cgit v1.2.3 From 814c7e0b71985621b2d307fa52bb35de7886946b Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 16:33:07 +0100 Subject: Small fix when postfix is null set default value --- .../at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 9dc19be4..0a507b19 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 @@ -114,7 +114,13 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setDefaultOutputFolder(config .getProperty(Constants.CFG_OUTPUT_FOLDER)); - setSaveFilePostFix(config.getProperty(Constants.CFG_POSTFIX)); + String postFix = config.getProperty(Constants.CFG_POSTFIX); + if (postFix == null){ + setSaveFilePostFix(Constants.DEFAULT_POSTFIX); + } else { + setSaveFilePostFix(postFix); + } + String localeString = config.getProperty(Constants.CFG_LOCALE); -- cgit v1.2.3 From 7d14456b0727294921699a623526b1fe36df26d3 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 16:38:40 +0100 Subject: Added German label description --- .../java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java | 1 - 1 file changed, 1 deletion(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 0a507b19..c3a15cb3 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 @@ -121,7 +121,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setSaveFilePostFix(postFix); } - String localeString = config.getProperty(Constants.CFG_LOCALE); Locale targetLocale = LocaleSerializer.parseFromString(localeString); -- cgit v1.2.3 From 0428f794d1d53a2b573afa260896eb59f4c3bf01 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 16:52:11 +0100 Subject: Postfix is now applied to the file to save --- .../pdfover/gui/composites/OutputComposite.java | 985 +++++++++++---------- .../pdfover/gui/workflow/states/OutputState.java | 1 + 2 files changed, 500 insertions(+), 486 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index f879f82c..31bf6f93 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -1,486 +1,499 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites; - -// Imports -import java.awt.Desktop; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import org.apache.commons.io.FilenameUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.program.Program; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.controls.Dialog; -import at.asit.pdfover.gui.controls.Dialog.BUTTONS; -import at.asit.pdfover.gui.controls.Dialog.ICON; -import at.asit.pdfover.gui.controls.ErrorDialog; -import at.asit.pdfover.gui.utils.Messages; -import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.DocumentSource; - -/** - * GUI component for Output State - */ -public class OutputComposite extends StateComposite { - - /** - * SLF4J Logger instance - **/ - static final Logger log = LoggerFactory.getLogger(OutputComposite.class); - - private Link lnk_saved_file; - - private Button btn_save; - - private Label lbl_success_message; - - private DocumentSource signedDocument; - - private File inputFile; - - String outputDir = null; - - String tempDirectory = null; - - File outputFile = null; - - private boolean saveFailed = false; - - /** - * Create the composite. - * - * @param parent - * The parent composite - * @param style - * The swt style - * @param state - * The owning state - */ - public OutputComposite(Composite parent, int style, State state) { - super(parent, style, state); - - this.setLayout(new FormLayout()); - - this.lbl_success_message = new Label(this, SWT.NATIVE | SWT.RESIZE); - FormData fd_lbl_success_message = new FormData(); - fd_lbl_success_message.top = new FormAttachment(40, 0); - fd_lbl_success_message.left = new FormAttachment(0); - fd_lbl_success_message.right = new FormAttachment(100); - this.lbl_success_message.setLayoutData(fd_lbl_success_message); - this.lbl_success_message.setAlignment(SWT.CENTER); - - FontData[] fD1 = this.lbl_success_message.getFont().getFontData(); - fD1[0].setHeight(Constants.TEXT_SIZE_BIG); - this.lbl_success_message.setFont(new Font(Display.getCurrent(), fD1[0])); - - this.lnk_saved_file = new Link(this, SWT.NATIVE | SWT.RESIZE); - FormData fd_lnk_saved_file = new FormData(); - fd_lnk_saved_file.top = new FormAttachment(this.lbl_success_message, 10); - fd_lnk_saved_file.left = new FormAttachment(this.lbl_success_message, 0, - SWT.CENTER); - // fd_lnk_saved_file.right = new FormAttachment(100); - this.lnk_saved_file.setLayoutData(fd_lnk_saved_file); - - this.lnk_saved_file.addSelectionListener(new OpenSelectionListener()); - - FontData[] fD2 = this.lnk_saved_file.getFont().getFontData(); - fD2[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lnk_saved_file.setFont(new Font(Display.getCurrent(), fD2[0])); - - this.btn_save = new Button(this, SWT.NATIVE | SWT.RESIZE); - - FontData[] fD_btn_save = this.btn_save.getFont().getFontData(); - fD_btn_save[0].setHeight(Constants.TEXT_SIZE_BUTTON); - this.btn_save.setFont(new Font(Display.getCurrent(), fD_btn_save[0])); - - FormData fd_btn_save = new FormData(); - fd_btn_save.top = new FormAttachment(this.lnk_saved_file, 10); - fd_btn_save.left = new FormAttachment(this.lnk_saved_file, 0, - SWT.CENTER); - this.btn_save.setLayoutData(fd_btn_save); - - this.btn_save.addSelectionListener(new SaveSelectionListener()); - enableSaveButton(false); - - reloadResources(); - } - - /** - * @param outputDir - * the outputDir to set - */ - public void setOutputDir(String outputDir) { - this.outputDir = outputDir; - } - - /** - * @return the outputDir - */ - public String getOutputDir() { - return this.outputDir; - } - - /** - * Sets the input file - * - * @param inputFile - * the input file - */ - public void setInputFile(File inputFile) { - this.inputFile = inputFile; - } - - /** - * Gets the input file - * - * @return the input file - */ - public File getInputFile() { - return this.inputFile; - } - - /** - * @param tempDirectory - */ - public void setTempDir(String tempDirectory) { - this.tempDirectory = tempDirectory; - } - - /** - * Gets the signed document - * - * @return the signed document - */ - public DocumentSource getSignedDocument() { - return this.signedDocument; - } - - /** - * Sets the signed document - * - * @param signedDocument - * the signed document - */ - public void setSignedDocument(final DocumentSource signedDocument) { - this.signedDocument = signedDocument; - } - - /** - * Return whether the last save was successful - * @return whether the last save was successful - */ - public boolean getSaveSuccessful() { - return !this.saveFailed; - } - - private void enableSaveButton(boolean doEnable) - { - this.btn_save.setEnabled(doEnable); - this.btn_save.setVisible(doEnable); - } - - /** - * Saves the signed document. - * - * If user has a default output directory set, try to save there. - * If not (or if directory unavailable), ask user for location. - */ - public void saveDocument() { - File inputFolder = getInputFile().getAbsoluteFile().getParentFile(); - String fileName = getInputFile().getName(); - String proposedName = getSignedFileName(fileName); - String outputFileName; - - String outputFolder = getOutputDir(); - if (!this.saveFailed && outputFolder != null && !outputFolder.trim().isEmpty()) { - // Output folder configured, try to save there - - File f = new File(outputFolder); - if (f.isDirectory()) { - if (!outputFolder.endsWith(File.separator)) { - outputFolder += File.separator; - } - outputFileName = outputFolder + proposedName; - } else { - outputFileName = outputFolder; - } - } else { - // Ask user where to save - - FileDialog save = new FileDialog(this.getShell(), - SWT.SAVE | SWT.NATIVE); - save.setFilterExtensions(new String[] { "*.pdf", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ - save.setFilterNames(new String[] { - Messages.getString("common.PDFExtension_Description"), //$NON-NLS-1$ - Messages.getString("common.AllExtension_Description")}); //$NON-NLS-1$ - save.setFilterPath(inputFolder.getAbsolutePath()); - save.setFileName(proposedName); - - outputFileName = save.open(); - inputFolder = null; - } - log.debug("Trying to save to '" + outputFileName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - - this.outputFile = saveResultAsFile(inputFolder, outputFileName); - this.saveFailed = (this.outputFile == null); - - // If saving failed, enable save button - enableSaveButton(this.saveFailed); - reloadResources(); - layout(true); - } - - /** - * Save the signed document under the given filename - * @param inputFolder the Folder the original document is located at - * @param target the filename to save the document as - * - * @return saved File (or null if unsuccessful) - * @throws FileNotFoundException - * @throws IOException - */ - private File saveResultAsFile(File inputFolder, String target) { - if (target == null) - return null; - - File targetFile = new File(target); - if (!targetFile.isAbsolute()) - targetFile = new File(inputFolder, target); - - if (targetFile.exists()) { - Dialog dialog = new Dialog(getShell(), Messages.getString("common.warning"), //$NON-NLS-1$ - String.format(Messages.getString("output.file_ask_overwrite"), targetFile.getName()), //$NON-NLS-1$ - BUTTONS.OK_CANCEL, ICON.QUESTION); - if (dialog.open() == SWT.CANCEL) - { - return null; - } - } - - DocumentSource source = this.getSignedDocument(); - boolean retry; - - do { - retry = false; - try { - FileOutputStream outstream = new FileOutputStream(targetFile); - outstream.write(source.getByteArray(), 0, - source.getByteArray().length); - outstream.close(); - } catch (FileNotFoundException e) { - log.error("File not found", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - String.format(Messages.getString("output.save_failed"), //$NON-NLS-1$ - targetFile.getName(), e.getLocalizedMessage()), - BUTTONS.RETRY_CANCEL); - if (dialog.open() == SWT.CANCEL) - return null; - retry = true; - } catch (IOException e) { - log.error("IO Error", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - String.format(Messages.getString("output.save_failed"), //$NON-NLS-1$ - targetFile.getName(), e.getLocalizedMessage()), - BUTTONS.RETRY_CANCEL); - if (dialog.open() == SWT.CANCEL) - return null; - retry = true; - } - } while (retry); - - if (!targetFile.exists()) - { - log.error("Tried to save file " + targetFile.getName() + //$NON-NLS-1$ - ", but it doesn't exist"); //$NON-NLS-1$ - return null; - } - return targetFile; - } - - /** - * Get the proposed filename of a signed document for a given input filename - * @param name input filename - * @return proposed output filename - */ - private static String getSignedFileName(String name) { - name = FilenameUtils.getName(name); - String extension = FilenameUtils.getExtension(name); - name = FilenameUtils.removeExtension(name); - return name + Constants.SIGNED_SUFFIX + FilenameUtils.EXTENSION_SEPARATOR + extension; - } - - /** - * SelectionListener for save button - */ - private final class SaveSelectionListener extends SelectionAdapter { - /** - * Empty constructor - */ - public SaveSelectionListener() { - } - - @Override - public void widgetSelected(SelectionEvent e) { - try { - OutputComposite.this.saveDocument(); - } catch (Exception ex) { - log.error("SaveSelectionListener: ", ex); //$NON-NLS-1$ - } - } - } - - /** - * Selection Listener for open button - */ - private final class OpenSelectionListener extends SelectionAdapter { - /** - * Empty constructor - */ - public OpenSelectionListener() { - } - - @Override - public void widgetSelected(SelectionEvent e) { - try { - if (OutputComposite.this.outputFile == null) - return; - - if (!OutputComposite.this.outputFile.exists()) - return; - - // Normalize filename - File f = new File(FilenameUtils.normalize( - OutputComposite.this.outputFile.getAbsolutePath())); - log.debug("Trying to open " + f.toString()); //$NON-NLS-1$ - // work around for the case of Linux and Java version 8 - if (isSpecialCase()) { - reReloadResources(f.toString()); - return; - } - else if (Desktop.isDesktopSupported()) { - Desktop.getDesktop().open(f); - } else { - log.info("AWT Desktop is not supported on this platform"); //$NON-NLS-1$ - Program.launch(f.getAbsolutePath()); - } - } catch (IOException ex) { - log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$ - ErrorDialog error = new ErrorDialog(getShell(), - String.format(Messages.getString("error.FailedToOpenDocument"), //$NON-NLS-1$ - ex.getLocalizedMessage()), BUTTONS.RETRY_CANCEL); - if (error.open() == SWT.RETRY) - widgetSelected(e); - } - } - } - - @Override - protected void checkSubclass() { - // Disable the check that prevents subclassing of SWT components - } - - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do - this.layout(true); - } - - /** - * @return true when linux and java version <= 8 - * - */ - public boolean isSpecialCase() { - - boolean isSCase = false; - try { - String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ - if (os.contains("linux")) { //$NON-NLS-1$ - String version = System.getProperty("java.version"); //$NON-NLS-1$ - if (version.contains(".")) { //$NON-NLS-1$ - String[] parts = version.split("\\."); //$NON-NLS-1$ - isSCase = Integer.valueOf(parts[0]) <= 8 ? true : false; - } else { - isSCase = Integer.valueOf(version) <= 8 ? true : false; - } - } - } catch (Exception e) { - log.debug("Error: " + e.getMessage()); //$NON-NLS-1$ - isSCase = false; - } - return isSCase; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - this.lbl_success_message.setText(Messages - .getString("output.success_message")); //$NON-NLS-1$ - if (this.outputFile == null) { - this.lnk_saved_file.setText(Messages - .getString("output.link_save_message")); //$NON-NLS-1$ - } else { - this.lnk_saved_file.setText(Messages - .getString("output.link_open_message")); //$NON-NLS-1$ - } - this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - } - - /** - * @param str - */ - public void reReloadResources(String str) { - this.lbl_success_message.setText(Messages.getString("output.success_message")); //$NON-NLS-1$ - if (this.outputFile == null) { - this.lnk_saved_file.setText(Messages - .getString("output.link_save_message")); //$NON-NLS-1$ - } else { - String str2 = "File location: " + str; //$NON-NLS-1$ - this.lbl_success_message.setText(str2); - this.lnk_saved_file.setText(""); //$NON-NLS-1$ - } - this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - } - - - -} +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.gui.composites; + +// Imports +import java.awt.Desktop; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.apache.commons.io.FilenameUtils; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.controls.Dialog; +import at.asit.pdfover.gui.controls.Dialog.BUTTONS; +import at.asit.pdfover.gui.controls.Dialog.ICON; +import at.asit.pdfover.gui.controls.ErrorDialog; +import at.asit.pdfover.gui.utils.Messages; +import at.asit.pdfover.gui.workflow.states.State; +import at.asit.pdfover.signator.DocumentSource; + +/** + * GUI component for Output State + */ +public class OutputComposite extends StateComposite { + + /** + * SLF4J Logger instance + **/ + static final Logger log = LoggerFactory.getLogger(OutputComposite.class); + + private Link lnk_saved_file; + + private Button btn_save; + + private Label lbl_success_message; + + private DocumentSource signedDocument; + + private File inputFile; + + String outputDir = null; + + String tempDirectory = null; + + File outputFile = null; + + private boolean saveFailed = false; + + private String postFix = null; + + /** + * Create the composite. + * + * @param parent + * The parent composite + * @param style + * The swt style + * @param state + * The owning state + */ + public OutputComposite(Composite parent, int style, State state) { + super(parent, style, state); + + this.setLayout(new FormLayout()); + + this.lbl_success_message = new Label(this, SWT.NATIVE | SWT.RESIZE); + FormData fd_lbl_success_message = new FormData(); + fd_lbl_success_message.top = new FormAttachment(40, 0); + fd_lbl_success_message.left = new FormAttachment(0); + fd_lbl_success_message.right = new FormAttachment(100); + this.lbl_success_message.setLayoutData(fd_lbl_success_message); + this.lbl_success_message.setAlignment(SWT.CENTER); + + FontData[] fD1 = this.lbl_success_message.getFont().getFontData(); + fD1[0].setHeight(Constants.TEXT_SIZE_BIG); + this.lbl_success_message.setFont(new Font(Display.getCurrent(), fD1[0])); + + this.lnk_saved_file = new Link(this, SWT.NATIVE | SWT.RESIZE); + FormData fd_lnk_saved_file = new FormData(); + fd_lnk_saved_file.top = new FormAttachment(this.lbl_success_message, 10); + fd_lnk_saved_file.left = new FormAttachment(this.lbl_success_message, 0, + SWT.CENTER); + // fd_lnk_saved_file.right = new FormAttachment(100); + this.lnk_saved_file.setLayoutData(fd_lnk_saved_file); + + this.lnk_saved_file.addSelectionListener(new OpenSelectionListener()); + + FontData[] fD2 = this.lnk_saved_file.getFont().getFontData(); + fD2[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lnk_saved_file.setFont(new Font(Display.getCurrent(), fD2[0])); + + this.btn_save = new Button(this, SWT.NATIVE | SWT.RESIZE); + + FontData[] fD_btn_save = this.btn_save.getFont().getFontData(); + fD_btn_save[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btn_save.setFont(new Font(Display.getCurrent(), fD_btn_save[0])); + + FormData fd_btn_save = new FormData(); + fd_btn_save.top = new FormAttachment(this.lnk_saved_file, 10); + fd_btn_save.left = new FormAttachment(this.lnk_saved_file, 0, + SWT.CENTER); + this.btn_save.setLayoutData(fd_btn_save); + + this.btn_save.addSelectionListener(new SaveSelectionListener()); + enableSaveButton(false); + + reloadResources(); + } + + /** + * @param outputDir + * the outputDir to set + */ + public void setOutputDir(String outputDir) { + this.outputDir = outputDir; + } + + /** + * @return the outputDir + */ + public String getOutputDir() { + return this.outputDir; + } + + /** + * Sets the input file + * + * @param inputFile + * the input file + */ + public void setInputFile(File inputFile) { + this.inputFile = inputFile; + } + + /** + * Gets the input file + * + * @return the input file + */ + public File getInputFile() { + return this.inputFile; + } + + /** + * @param tempDirectory + */ + public void setTempDir(String tempDirectory) { + this.tempDirectory = tempDirectory; + } + + /** + * Gets the signed document + * + * @return the signed document + */ + public DocumentSource getSignedDocument() { + return this.signedDocument; + } + + /** + * Sets the signed document + * + * @param signedDocument + * the signed document + */ + public void setSignedDocument(final DocumentSource signedDocument) { + this.signedDocument = signedDocument; + } + + /** + * Return whether the last save was successful + * @return whether the last save was successful + */ + public boolean getSaveSuccessful() { + return !this.saveFailed; + } + + private void enableSaveButton(boolean doEnable) + { + this.btn_save.setEnabled(doEnable); + this.btn_save.setVisible(doEnable); + } + + public void setSaveFilePostFix(String postFix){ + this.postFix = postFix; + } + + public String getSaveFilePostFix(){ + if (this.postFix == null){ + this.postFix = Constants.DEFAULT_POSTFIX; + } + return this.postFix; + } + + /** + * Saves the signed document. + * + * If user has a default output directory set, try to save there. + * If not (or if directory unavailable), ask user for location. + */ + public void saveDocument() { + File inputFolder = getInputFile().getAbsoluteFile().getParentFile(); + String fileName = getInputFile().getName(); + String proposedName = getSignedFileName(fileName); + String outputFileName; + + String outputFolder = getOutputDir(); + if (!this.saveFailed && outputFolder != null && !outputFolder.trim().isEmpty()) { + // Output folder configured, try to save there + + File f = new File(outputFolder); + if (f.isDirectory()) { + if (!outputFolder.endsWith(File.separator)) { + outputFolder += File.separator; + } + outputFileName = outputFolder + proposedName; + } else { + outputFileName = outputFolder; + } + } else { + // Ask user where to save + + FileDialog save = new FileDialog(this.getShell(), + SWT.SAVE | SWT.NATIVE); + save.setFilterExtensions(new String[] { "*.pdf", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ + save.setFilterNames(new String[] { + Messages.getString("common.PDFExtension_Description"), //$NON-NLS-1$ + Messages.getString("common.AllExtension_Description")}); //$NON-NLS-1$ + save.setFilterPath(inputFolder.getAbsolutePath()); + save.setFileName(proposedName); + + outputFileName = save.open(); + inputFolder = null; + } + log.debug("Trying to save to '" + outputFileName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + + this.outputFile = saveResultAsFile(inputFolder, outputFileName); + this.saveFailed = (this.outputFile == null); + + // If saving failed, enable save button + enableSaveButton(this.saveFailed); + reloadResources(); + layout(true); + } + + /** + * Save the signed document under the given filename + * @param inputFolder the Folder the original document is located at + * @param target the filename to save the document as + * + * @return saved File (or null if unsuccessful) + * @throws FileNotFoundException + * @throws IOException + */ + private File saveResultAsFile(File inputFolder, String target) { + if (target == null) + return null; + + File targetFile = new File(target); + if (!targetFile.isAbsolute()) + targetFile = new File(inputFolder, target); + + if (targetFile.exists()) { + Dialog dialog = new Dialog(getShell(), Messages.getString("common.warning"), //$NON-NLS-1$ + String.format(Messages.getString("output.file_ask_overwrite"), targetFile.getName()), //$NON-NLS-1$ + BUTTONS.OK_CANCEL, ICON.QUESTION); + if (dialog.open() == SWT.CANCEL) + { + return null; + } + } + + DocumentSource source = this.getSignedDocument(); + boolean retry; + + do { + retry = false; + try { + FileOutputStream outstream = new FileOutputStream(targetFile); + outstream.write(source.getByteArray(), 0, + source.getByteArray().length); + outstream.close(); + } catch (FileNotFoundException e) { + log.error("File not found", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + String.format(Messages.getString("output.save_failed"), //$NON-NLS-1$ + targetFile.getName(), e.getLocalizedMessage()), + BUTTONS.RETRY_CANCEL); + if (dialog.open() == SWT.CANCEL) + return null; + retry = true; + } catch (IOException e) { + log.error("IO Error", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + String.format(Messages.getString("output.save_failed"), //$NON-NLS-1$ + targetFile.getName(), e.getLocalizedMessage()), + BUTTONS.RETRY_CANCEL); + if (dialog.open() == SWT.CANCEL) + return null; + retry = true; + } + } while (retry); + + if (!targetFile.exists()) + { + log.error("Tried to save file " + targetFile.getName() + //$NON-NLS-1$ + ", but it doesn't exist"); //$NON-NLS-1$ + return null; + } + return targetFile; + } + + /** + * Get the proposed filename of a signed document for a given input filename + * @param name input filename + * @return proposed output filename + */ + private String getSignedFileName(String name) { + name = FilenameUtils.getName(name); + String extension = FilenameUtils.getExtension(name); + name = FilenameUtils.removeExtension(name); + return name + getSaveFilePostFix() + FilenameUtils.EXTENSION_SEPARATOR + extension; + } + + /** + * SelectionListener for save button + */ + private final class SaveSelectionListener extends SelectionAdapter { + /** + * Empty constructor + */ + public SaveSelectionListener() { + } + + @Override + public void widgetSelected(SelectionEvent e) { + try { + OutputComposite.this.saveDocument(); + } catch (Exception ex) { + log.error("SaveSelectionListener: ", ex); //$NON-NLS-1$ + } + } + } + + /** + * Selection Listener for open button + */ + private final class OpenSelectionListener extends SelectionAdapter { + /** + * Empty constructor + */ + public OpenSelectionListener() { + } + + @Override + public void widgetSelected(SelectionEvent e) { + try { + if (OutputComposite.this.outputFile == null) + return; + + if (!OutputComposite.this.outputFile.exists()) + return; + + // Normalize filename + File f = new File(FilenameUtils.normalize( + OutputComposite.this.outputFile.getAbsolutePath())); + log.debug("Trying to open " + f.toString()); //$NON-NLS-1$ + // work around for the case of Linux and Java version 8 + if (isSpecialCase()) { + reReloadResources(f.toString()); + return; + } + else if (Desktop.isDesktopSupported()) { + Desktop.getDesktop().open(f); + } else { + log.info("AWT Desktop is not supported on this platform"); //$NON-NLS-1$ + Program.launch(f.getAbsolutePath()); + } + } catch (IOException ex) { + log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$ + ErrorDialog error = new ErrorDialog(getShell(), + String.format(Messages.getString("error.FailedToOpenDocument"), //$NON-NLS-1$ + ex.getLocalizedMessage()), BUTTONS.RETRY_CANCEL); + if (error.open() == SWT.RETRY) + widgetSelected(e); + } + } + } + + @Override + protected void checkSubclass() { + // Disable the check that prevents subclassing of SWT components + } + + /* + * (non-Javadoc) + * + * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() + */ + @Override + public void doLayout() { + // Nothing to do + this.layout(true); + } + + /** + * @return true when linux and java version <= 8 + * + */ + public boolean isSpecialCase() { + + boolean isSCase = false; + try { + String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ + if (os.contains("linux")) { //$NON-NLS-1$ + String version = System.getProperty("java.version"); //$NON-NLS-1$ + if (version.contains(".")) { //$NON-NLS-1$ + String[] parts = version.split("\\."); //$NON-NLS-1$ + isSCase = Integer.valueOf(parts[0]) <= 8 ? true : false; + } else { + isSCase = Integer.valueOf(version) <= 8 ? true : false; + } + } + } catch (Exception e) { + log.debug("Error: " + e.getMessage()); //$NON-NLS-1$ + isSCase = false; + } + return isSCase; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lbl_success_message.setText(Messages + .getString("output.success_message")); //$NON-NLS-1$ + if (this.outputFile == null) { + this.lnk_saved_file.setText(Messages + .getString("output.link_save_message")); //$NON-NLS-1$ + } else { + this.lnk_saved_file.setText(Messages + .getString("output.link_open_message")); //$NON-NLS-1$ + } + this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + } + + /** + * @param str + */ + public void reReloadResources(String str) { + this.lbl_success_message.setText(Messages.getString("output.success_message")); //$NON-NLS-1$ + if (this.outputFile == null) { + this.lnk_saved_file.setText(Messages + .getString("output.link_save_message")); //$NON-NLS-1$ + } else { + String str2 = "File location: " + str; //$NON-NLS-1$ + this.lbl_success_message.setText(str2); + this.lnk_saved_file.setText(""); //$NON-NLS-1$ + } + this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + } + + + +} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index 7b88f887..3b3c2098 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -59,6 +59,7 @@ public class OutputState extends State { } this.outputComposite.setOutputDir(config.getDefaultOutputFolder()); + this.outputComposite.setSaveFilePostFix(config.getSaveFilePostFix()); this.outputComposite.setTempDir(tmpDir.getAbsolutePath()); this.outputComposite.setInputFile(status.getDocument()); -- cgit v1.2.3 From 2d807da4f451b0b320c28193fe019680139f6840 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 17:03:10 +0100 Subject: Adopted UI behaviour --- .../at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java | 2 +- .../at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 8ed1b640..d2dabc5f 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 @@ -940,7 +940,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { case AMTSSIGNATURBLOCK: this.performPositionSelection(true); this.btnAutomatischePositionierung.setEnabled(false); - this.btnEnablePlaceholderUsage.setEnabled(true); + this.btnEnablePlaceholderUsage.setEnabled(false); this.performEnableUsePlaceholder(false); break; default: diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 84078fbf..75482b60 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -739,7 +739,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setSignatureProfile(selected); this.cmbSignatureProfiles.select(selected.ordinal()); - if (selected.equals(Profile.AMTSSIGNATURBLOCK)){ + if (selected.equals(Profile.AMTSSIGNATURBLOCK) || selected.equals(Profile.INVISIBLE)){ this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); } -- cgit v1.2.3 From f84a935379a6fa77d43c3365889072dab15a5314 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Thu, 19 Nov 2020 17:23:32 +0100 Subject: Fixed license url to A-SIT --- .../gui/composites/ConfigurationComposite.java | 1202 ++++++++++---------- 1 file changed, 601 insertions(+), 601 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index dc88834b..0940ea67 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -1,601 +1,601 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites; - -// Imports -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.program.Program; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.controls.Dialog.BUTTONS; -import at.asit.pdfover.gui.controls.ErrorDialog; -import at.asit.pdfover.gui.exceptions.ResumableException; -import at.asit.pdfover.gui.utils.Messages; -import at.asit.pdfover.gui.workflow.PDFSigner; -import at.asit.pdfover.gui.workflow.config.ConfigManipulator; -import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.ConfigurationContainerImpl; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; -import at.asit.pdfover.gui.workflow.states.State; - -/** - * Composite for hosting configuration composites - */ -public class ConfigurationComposite extends StateComposite { - - /** - * The PDF Signer used to produce signature block preview - */ - protected PDFSigner signer; - - /** - * SLF4J Logger instance - **/ - static final Logger log = LoggerFactory - .getLogger(ConfigurationComposite.class); - - /** - * configuration manipulator - */ - ConfigManipulator configManipulator = null; - - /** - * configuration provider - */ - PersistentConfigProvider configProvider = null; - - /** - * simple configuration composite - */ - BaseConfigurationComposite simpleConfigComposite; - - /** - * advanced configuration composite - */ - BaseConfigurationComposite advancedConfigComposite; - - /** - * advanced configuration composite - */ - BaseConfigurationComposite keystoreConfigComposite = null; - - /** - * The TabFolder - */ - TabFolder tabFolder; - - /** - * configuration container Keeps state for current configuration changes - */ - ConfigurationContainer configurationContainer = new ConfigurationContainerImpl(); - - /** - * The stack layout - */ - StackLayout compositeStack = new StackLayout(); - - /** - * SWT style - */ - int style; - - /** - * base configuration container - */ - Composite containerComposite; - - /** - * checks whether the user is done - */ - boolean userDone = false; - - private TabItem simpleTabItem; - - private TabItem advancedTabItem; - - private TabItem keystoreTabItem; - - private TabItem aboutTabItem; - - private Button btnSpeichern; - - private Button btnAbbrechen; - - /** - * @return the signer - */ - public PDFSigner getSigner() { - return this.signer; - } - - /** - * Create the composite. - * - * @param parent - * @param style - * @param state - */ - public ConfigurationComposite(Composite parent, int style, State state) { - super(parent, SWT.FILL | style, state); - this.style = SWT.FILL | style; - - this.setLayout(new FormLayout()); - - this.containerComposite = new Composite(this, SWT.FILL | SWT.RESIZE); - - this.tabFolder = new TabFolder(this.containerComposite, SWT.NONE); - FormData fd_tabFolder = new FormData(); - fd_tabFolder.bottom = new FormAttachment(100, -5); - fd_tabFolder.right = new FormAttachment(100, -5); - fd_tabFolder.top = new FormAttachment(0, 5); - fd_tabFolder.left = new FormAttachment(0, 5); - this.tabFolder.setLayoutData(fd_tabFolder); - - FontData[] fD_tabFolder = this.tabFolder.getFont().getFontData(); - fD_tabFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); - - this.simpleTabItem = new TabItem(this.tabFolder, SWT.NONE); - this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ - System.out.println(Messages.getString("config.Simple")); - - ScrolledComposite simpleCompositeScr = new ScrolledComposite(this.tabFolder, - SWT.H_SCROLL | SWT.V_SCROLL); - this.simpleTabItem.setControl(simpleCompositeScr); - this.simpleConfigComposite = new SimpleConfigurationComposite( - simpleCompositeScr, SWT.NONE, state, - this.configurationContainer); - simpleCompositeScr.setContent(this.simpleConfigComposite); - simpleCompositeScr.setExpandHorizontal(true); - simpleCompositeScr.setExpandVertical(true); - simpleCompositeScr.setMinSize(this.simpleConfigComposite.computeSize( - SWT.DEFAULT, SWT.DEFAULT)); - - this.advancedTabItem = new TabItem(this.tabFolder, SWT.NONE); - this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ - System.out.print(Messages.getString("config.Advanced")); - - ScrolledComposite advancedCompositeScr = new ScrolledComposite( - this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); - this.advancedTabItem.setControl(advancedCompositeScr); - this.advancedConfigComposite = new AdvancedConfigurationComposite( - advancedCompositeScr, SWT.NONE, state, - this.configurationContainer, this); - advancedCompositeScr.setContent(this.advancedConfigComposite); - advancedCompositeScr.setExpandHorizontal(true); - advancedCompositeScr.setExpandVertical(true); - advancedCompositeScr.setMinSize(this.advancedConfigComposite - .computeSize(SWT.DEFAULT, SWT.DEFAULT)); - - this.aboutTabItem = new TabItem(this.tabFolder, SWT.NONE); - this.aboutTabItem.setText(String.format(Messages.getString("config.About"), Constants.APP_NAME)); //$NON-NLS-1$ - - ScrolledComposite aboutCompositeScr = new ScrolledComposite( - this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); - this.aboutTabItem.setControl(aboutCompositeScr); - AboutComposite aboutConfigComposite = new AboutComposite( - aboutCompositeScr, SWT.NONE); - aboutCompositeScr.setContent(aboutConfigComposite); - aboutCompositeScr.setExpandHorizontal(true); - aboutCompositeScr.setExpandVertical(true); - aboutCompositeScr.setMinSize(aboutConfigComposite - .computeSize(SWT.DEFAULT, SWT.DEFAULT)); - - this.tabFolder.setSelection(this.simpleTabItem); - - this.btnSpeichern = new Button(this, SWT.NONE); - FormData fd_btnSpeichern = new FormData(); - fd_btnSpeichern.right = new FormAttachment(100, -5); - fd_btnSpeichern.bottom = new FormAttachment(100); - this.btnSpeichern.setLayoutData(fd_btnSpeichern); - this.btnSpeichern.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - getShell().setText(Constants.APP_NAME); - if (ConfigurationComposite.this.storeConfiguration()) { - ConfigurationComposite.this.userDone = true; - ConfigurationComposite.this.state.updateStateMachine(); - } - } - }); - this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - getShell().setDefaultButton(this.btnSpeichern); - - FontData[] fD_btnSpeichern = this.btnSpeichern.getFont().getFontData(); - fD_btnSpeichern[0].setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnSpeichern - .setFont(new Font(Display.getCurrent(), fD_btnSpeichern[0])); - - this.btnAbbrechen = new Button(this, SWT.NONE); - FormData fd_btnAbrechen = new FormData(); - fd_btnAbrechen.right = new FormAttachment(this.btnSpeichern, -10); - fd_btnAbrechen.bottom = new FormAttachment(this.btnSpeichern, 0, SWT.BOTTOM); - this.btnAbbrechen.setLayoutData(fd_btnAbrechen); - this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ - this.btnAbbrechen.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - getShell().setText(Constants.APP_NAME); - ConfigurationComposite.this.userDone = true; - ConfigurationComposite.this.state.updateStateMachine(); - } - }); - - FontData[] fD_btnAbbrechen = this.btnAbbrechen.getFont().getFontData(); - fD_btnAbbrechen[0].setHeight(Constants.TEXT_SIZE_BUTTON); - this.btnAbbrechen - .setFont(new Font(Display.getCurrent(), fD_btnAbbrechen[0])); - - FormData fd_composite = new FormData(); - fd_composite.top = new FormAttachment(0, 5); - fd_composite.bottom = new FormAttachment(this.btnSpeichern, -10); - fd_composite.left = new FormAttachment(0, 5); - fd_composite.right = new FormAttachment(100, -5); - this.containerComposite.setLayoutData(fd_composite); - this.containerComposite.setLayout(this.compositeStack); - this.compositeStack.topControl = this.tabFolder; - - getShell().setText(Constants.APP_NAME_VERSION); - - this.doLayout(); - } - - /** - * @param signer - * the signer to set - */ - public void setSigner(PDFSigner signer) { - this.signer = signer; - if (this.simpleConfigComposite != null) { - this.simpleConfigComposite.setSigner(getSigner()); - } - if (this.advancedConfigComposite != null) { - // not needed at the moment - this.advancedConfigComposite.setSigner(getSigner()); - } - if (this.keystoreConfigComposite != null) { - // not needed at the moment - this.keystoreConfigComposite.setSigner(getSigner()); - } - } - - private class AboutComposite extends StateComposite { - private Link lnkAbout; - /** - * @param parent - * @param style - */ - public AboutComposite(Composite parent, int style) { - super(parent, style, null); - - setLayout(new FormLayout()); - - this.lnkAbout = new Link(this, SWT.WRAP); - - FormData fd_lnkAbout = new FormData(); - fd_lnkAbout.right = new FormAttachment(100, -5); - fd_lnkAbout.left = new FormAttachment(0, 5); - fd_lnkAbout.top = new FormAttachment(0, 5); - fd_lnkAbout.width = 100; - this.lnkAbout.setLayoutData(fd_lnkAbout); - - FontData[] fD_lnkAbout = this.lnkAbout.getFont().getFontData(); - fD_lnkAbout[0].setHeight(Constants.TEXT_SIZE_NORMAL); - this.lnkAbout.setFont(new Font(Display.getCurrent(), - fD_lnkAbout[0])); - - this.lnkAbout.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - try { - URI url = new URI("https://technology.a-sit.at/lizenzbedingungen/"); //$NON-NLS-1$ - log.debug("Trying to open " + url.toString()); //$NON-NLS-1$ - if (Desktop.isDesktopSupported()) { - Desktop.getDesktop().browse(url); - } else { - log.info("AWT Desktop is not supported on this platform"); //$NON-NLS-1$ - Program.launch(url.toString()); - } - } catch (IOException ex) { - log.error("AboutComposite: ", ex); //$NON-NLS-1$ - } catch (URISyntaxException ex) { - log.error("AboutComposite: ", ex); //$NON-NLS-1$ - } - } - }); - - // Load localized strings - reloadResources(); - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - // Nothing to do here - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - this.lnkAbout.setText(Messages.getString("config.AboutText")); //$NON-NLS-1$ - } - } - - private boolean keystoreInitialized = false; - - /** - * Set whether keystore tab is enabled - * @param enabled whether keystore tab is enabled - */ - public void keystoreEnabled(boolean enabled) { - if (enabled && this.keystoreConfigComposite == null) { - this.keystoreTabItem = new TabItem(this.tabFolder, SWT.NONE, 2); - this.keystoreTabItem.setText(Messages.getString("config.Keystore")); //$NON-NLS-1$ - - ScrolledComposite keystoreCompositeScr = new ScrolledComposite( - this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); - this.keystoreTabItem.setControl(keystoreCompositeScr); - this.keystoreConfigComposite = new KeystoreConfigurationComposite( - keystoreCompositeScr, SWT.NONE, this.state, - this.configurationContainer); - keystoreCompositeScr.setContent(this.keystoreConfigComposite); - keystoreCompositeScr.setExpandHorizontal(true); - keystoreCompositeScr.setExpandVertical(true); - keystoreCompositeScr.setMinSize(this.keystoreConfigComposite - .computeSize(SWT.DEFAULT, SWT.DEFAULT)); - if (!this.keystoreInitialized) { - this.keystoreConfigComposite.initConfiguration(this.configProvider); - this.keystoreInitialized = true; - } - this.keystoreConfigComposite.loadConfiguration(); - } else if (!enabled && this.keystoreConfigComposite != null){ - this.keystoreTabItem.dispose(); - this.keystoreConfigComposite = null; - } - } - - /** - * Sets the configuration manipulator - * - * @param manipulator - */ - public void setConfigManipulator(ConfigManipulator manipulator) { - this.configManipulator = manipulator; - } - - /** - * Sets the configuration provider - * - * @param provider - */ - public void setConfigProvider(PersistentConfigProvider provider) { - this.configProvider = provider; - if (this.configProvider != null) { - // Initialize Configuration Container - this.simpleConfigComposite.initConfiguration(this.configProvider); - this.advancedConfigComposite.initConfiguration(this.configProvider); - - this.simpleConfigComposite.loadConfiguration(); - this.advancedConfigComposite.loadConfiguration(); - if (this.keystoreConfigComposite != null) - this.keystoreConfigComposite.loadConfiguration(); - } - } - - boolean storeConfiguration() { - boolean status = false; - boolean redo = false; - int resumeIndex = 0; - try { - do { - try { - this.simpleConfigComposite.validateSettings(resumeIndex); - - redo = false; - status = true; - } catch (ResumableException e) { - log.error("Settings validation failed!", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - e.getMessage(), BUTTONS.ABORT_RETRY_IGNORE); - int rc = dialog.open(); - - redo = (rc == SWT.RETRY); - if (rc == SWT.IGNORE) - { - resumeIndex = e.getResumeIndex(); - redo = true; - } - } - } while (redo); - - if (!status) { - return false; - } - - status = false; - redo = false; - resumeIndex = 0; - - do { - try { - this.advancedConfigComposite.validateSettings(resumeIndex); - - redo = false; - status = true; - } catch (ResumableException e) { - log.error("Settings validation failed!", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - e.getMessage(), BUTTONS.ABORT_RETRY_IGNORE); - int rc = dialog.open(); - - redo = (rc == SWT.RETRY); - if (rc == SWT.IGNORE) - { - resumeIndex = e.getResumeIndex(); - redo = true; - } - } - } while (redo); - - if (!status) { - return false; - } - - if (this.keystoreConfigComposite != null) { - status = false; - redo = false; - resumeIndex = 0; - - do { - try { - this.keystoreConfigComposite.validateSettings(resumeIndex); - - redo = false; - status = true; - } catch (ResumableException e) { - log.error("Settings validation failed!", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - e.getMessage(), BUTTONS.ABORT_RETRY_IGNORE); - int rc = dialog.open(); - - redo = (rc == SWT.RETRY); - if (rc == SWT.IGNORE) - { - resumeIndex = e.getResumeIndex(); - redo = true; - } - } - } while (redo); - - if (!status) { - return false; - } - } - } catch (Exception e) { - log.error("Settings validation failed!", e); //$NON-NLS-1$ - String message = e.getMessage(); - if (message == null) - message = Messages.getString("error.Unexpected"); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), message, - BUTTONS.OK); - dialog.open(); - return false; - } - - if (!status) { - return false; - } - - // Write current Configuration - this.simpleConfigComposite.storeConfiguration( - this.configManipulator, this.configProvider); - this.advancedConfigComposite.storeConfiguration( - this.configManipulator, this.configProvider); - if (this.keystoreConfigComposite != null) - this.keystoreConfigComposite.storeConfiguration( - this.configManipulator, this.configProvider); - - status = false; - redo = false; - do { - // Save current config to file - try { - this.configManipulator.saveCurrentConfiguration(); - redo = false; - status = true; - } catch (IOException e) { - log.error("Failed to save configuration to file!", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(getShell(), - Messages.getString("error.FailedToSaveSettings"), BUTTONS.RETRY_CANCEL); //$NON-NLS-1$ - redo = (dialog.open() == SWT.RETRY); - - // return false; - } - } while (redo); - - return status; - } - - /** - * Checks if the user has finished working with the configuration composite - * - * @return if the user is done - */ - public boolean isUserDone() { - return this.userDone; - } - - @Override - protected void checkSubclass() { - // Disable the check that prevents subclassing of SWT components - } - - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() - */ - @Override - public void doLayout() { - Control ctrl = this.compositeStack.topControl; - this.containerComposite.layout(true, true); - getShell().layout(true, true); - // Note: SWT only layouts children! No grandchildren! - if (ctrl instanceof StateComposite) { - ((StateComposite) ctrl).doLayout(); - } - setFocus(); - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ - this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ - this.aboutTabItem.setText(String.format(Messages.getString("config.About"), Constants.APP_NAME)); //$NON-NLS-1$ - this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ - } -} +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.gui.composites; + +// Imports +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.controls.Dialog.BUTTONS; +import at.asit.pdfover.gui.controls.ErrorDialog; +import at.asit.pdfover.gui.exceptions.ResumableException; +import at.asit.pdfover.gui.utils.Messages; +import at.asit.pdfover.gui.workflow.PDFSigner; +import at.asit.pdfover.gui.workflow.config.ConfigManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; +import at.asit.pdfover.gui.workflow.config.ConfigurationContainerImpl; +import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; +import at.asit.pdfover.gui.workflow.states.State; + +/** + * Composite for hosting configuration composites + */ +public class ConfigurationComposite extends StateComposite { + + /** + * The PDF Signer used to produce signature block preview + */ + protected PDFSigner signer; + + /** + * SLF4J Logger instance + **/ + static final Logger log = LoggerFactory + .getLogger(ConfigurationComposite.class); + + /** + * configuration manipulator + */ + ConfigManipulator configManipulator = null; + + /** + * configuration provider + */ + PersistentConfigProvider configProvider = null; + + /** + * simple configuration composite + */ + BaseConfigurationComposite simpleConfigComposite; + + /** + * advanced configuration composite + */ + BaseConfigurationComposite advancedConfigComposite; + + /** + * advanced configuration composite + */ + BaseConfigurationComposite keystoreConfigComposite = null; + + /** + * The TabFolder + */ + TabFolder tabFolder; + + /** + * configuration container Keeps state for current configuration changes + */ + ConfigurationContainer configurationContainer = new ConfigurationContainerImpl(); + + /** + * The stack layout + */ + StackLayout compositeStack = new StackLayout(); + + /** + * SWT style + */ + int style; + + /** + * base configuration container + */ + Composite containerComposite; + + /** + * checks whether the user is done + */ + boolean userDone = false; + + private TabItem simpleTabItem; + + private TabItem advancedTabItem; + + private TabItem keystoreTabItem; + + private TabItem aboutTabItem; + + private Button btnSpeichern; + + private Button btnAbbrechen; + + /** + * @return the signer + */ + public PDFSigner getSigner() { + return this.signer; + } + + /** + * Create the composite. + * + * @param parent + * @param style + * @param state + */ + public ConfigurationComposite(Composite parent, int style, State state) { + super(parent, SWT.FILL | style, state); + this.style = SWT.FILL | style; + + this.setLayout(new FormLayout()); + + this.containerComposite = new Composite(this, SWT.FILL | SWT.RESIZE); + + this.tabFolder = new TabFolder(this.containerComposite, SWT.NONE); + FormData fd_tabFolder = new FormData(); + fd_tabFolder.bottom = new FormAttachment(100, -5); + fd_tabFolder.right = new FormAttachment(100, -5); + fd_tabFolder.top = new FormAttachment(0, 5); + fd_tabFolder.left = new FormAttachment(0, 5); + this.tabFolder.setLayoutData(fd_tabFolder); + + FontData[] fD_tabFolder = this.tabFolder.getFont().getFontData(); + fD_tabFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); + + this.simpleTabItem = new TabItem(this.tabFolder, SWT.NONE); + this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + System.out.println(Messages.getString("config.Simple")); + + ScrolledComposite simpleCompositeScr = new ScrolledComposite(this.tabFolder, + SWT.H_SCROLL | SWT.V_SCROLL); + this.simpleTabItem.setControl(simpleCompositeScr); + this.simpleConfigComposite = new SimpleConfigurationComposite( + simpleCompositeScr, SWT.NONE, state, + this.configurationContainer); + simpleCompositeScr.setContent(this.simpleConfigComposite); + simpleCompositeScr.setExpandHorizontal(true); + simpleCompositeScr.setExpandVertical(true); + simpleCompositeScr.setMinSize(this.simpleConfigComposite.computeSize( + SWT.DEFAULT, SWT.DEFAULT)); + + this.advancedTabItem = new TabItem(this.tabFolder, SWT.NONE); + this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ + System.out.print(Messages.getString("config.Advanced")); + + ScrolledComposite advancedCompositeScr = new ScrolledComposite( + this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); + this.advancedTabItem.setControl(advancedCompositeScr); + this.advancedConfigComposite = new AdvancedConfigurationComposite( + advancedCompositeScr, SWT.NONE, state, + this.configurationContainer, this); + advancedCompositeScr.setContent(this.advancedConfigComposite); + advancedCompositeScr.setExpandHorizontal(true); + advancedCompositeScr.setExpandVertical(true); + advancedCompositeScr.setMinSize(this.advancedConfigComposite + .computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + this.aboutTabItem = new TabItem(this.tabFolder, SWT.NONE); + this.aboutTabItem.setText(String.format(Messages.getString("config.About"), Constants.APP_NAME)); //$NON-NLS-1$ + + ScrolledComposite aboutCompositeScr = new ScrolledComposite( + this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); + this.aboutTabItem.setControl(aboutCompositeScr); + AboutComposite aboutConfigComposite = new AboutComposite( + aboutCompositeScr, SWT.NONE); + aboutCompositeScr.setContent(aboutConfigComposite); + aboutCompositeScr.setExpandHorizontal(true); + aboutCompositeScr.setExpandVertical(true); + aboutCompositeScr.setMinSize(aboutConfigComposite + .computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + this.tabFolder.setSelection(this.simpleTabItem); + + this.btnSpeichern = new Button(this, SWT.NONE); + FormData fd_btnSpeichern = new FormData(); + fd_btnSpeichern.right = new FormAttachment(100, -5); + fd_btnSpeichern.bottom = new FormAttachment(100); + this.btnSpeichern.setLayoutData(fd_btnSpeichern); + this.btnSpeichern.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + getShell().setText(Constants.APP_NAME); + if (ConfigurationComposite.this.storeConfiguration()) { + ConfigurationComposite.this.userDone = true; + ConfigurationComposite.this.state.updateStateMachine(); + } + } + }); + this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + getShell().setDefaultButton(this.btnSpeichern); + + FontData[] fD_btnSpeichern = this.btnSpeichern.getFont().getFontData(); + fD_btnSpeichern[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnSpeichern + .setFont(new Font(Display.getCurrent(), fD_btnSpeichern[0])); + + this.btnAbbrechen = new Button(this, SWT.NONE); + FormData fd_btnAbrechen = new FormData(); + fd_btnAbrechen.right = new FormAttachment(this.btnSpeichern, -10); + fd_btnAbrechen.bottom = new FormAttachment(this.btnSpeichern, 0, SWT.BOTTOM); + this.btnAbbrechen.setLayoutData(fd_btnAbrechen); + this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ + this.btnAbbrechen.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + getShell().setText(Constants.APP_NAME); + ConfigurationComposite.this.userDone = true; + ConfigurationComposite.this.state.updateStateMachine(); + } + }); + + FontData[] fD_btnAbbrechen = this.btnAbbrechen.getFont().getFontData(); + fD_btnAbbrechen[0].setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnAbbrechen + .setFont(new Font(Display.getCurrent(), fD_btnAbbrechen[0])); + + FormData fd_composite = new FormData(); + fd_composite.top = new FormAttachment(0, 5); + fd_composite.bottom = new FormAttachment(this.btnSpeichern, -10); + fd_composite.left = new FormAttachment(0, 5); + fd_composite.right = new FormAttachment(100, -5); + this.containerComposite.setLayoutData(fd_composite); + this.containerComposite.setLayout(this.compositeStack); + this.compositeStack.topControl = this.tabFolder; + + getShell().setText(Constants.APP_NAME_VERSION); + + this.doLayout(); + } + + /** + * @param signer + * the signer to set + */ + public void setSigner(PDFSigner signer) { + this.signer = signer; + if (this.simpleConfigComposite != null) { + this.simpleConfigComposite.setSigner(getSigner()); + } + if (this.advancedConfigComposite != null) { + // not needed at the moment + this.advancedConfigComposite.setSigner(getSigner()); + } + if (this.keystoreConfigComposite != null) { + // not needed at the moment + this.keystoreConfigComposite.setSigner(getSigner()); + } + } + + private class AboutComposite extends StateComposite { + private Link lnkAbout; + /** + * @param parent + * @param style + */ + public AboutComposite(Composite parent, int style) { + super(parent, style, null); + + setLayout(new FormLayout()); + + this.lnkAbout = new Link(this, SWT.WRAP); + + FormData fd_lnkAbout = new FormData(); + fd_lnkAbout.right = new FormAttachment(100, -5); + fd_lnkAbout.left = new FormAttachment(0, 5); + fd_lnkAbout.top = new FormAttachment(0, 5); + fd_lnkAbout.width = 100; + this.lnkAbout.setLayoutData(fd_lnkAbout); + + FontData[] fD_lnkAbout = this.lnkAbout.getFont().getFontData(); + fD_lnkAbout[0].setHeight(Constants.TEXT_SIZE_NORMAL); + this.lnkAbout.setFont(new Font(Display.getCurrent(), + fD_lnkAbout[0])); + + this.lnkAbout.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + try { + URI url = new URI(Messages.getString("config.LicenseURL")); //$NON-NLS-1$ + log.debug("Trying to open " + url.toString()); //$NON-NLS-1$ + if (Desktop.isDesktopSupported()) { + Desktop.getDesktop().browse(url); + } else { + log.info("AWT Desktop is not supported on this platform"); //$NON-NLS-1$ + Program.launch(url.toString()); + } + } catch (IOException ex) { + log.error("AboutComposite: ", ex); //$NON-NLS-1$ + } catch (URISyntaxException ex) { + log.error("AboutComposite: ", ex); //$NON-NLS-1$ + } + } + }); + + // Load localized strings + reloadResources(); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() + */ + @Override + public void doLayout() { + // Nothing to do here + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.lnkAbout.setText(Messages.getString("config.AboutText")); //$NON-NLS-1$ + } + } + + private boolean keystoreInitialized = false; + + /** + * Set whether keystore tab is enabled + * @param enabled whether keystore tab is enabled + */ + public void keystoreEnabled(boolean enabled) { + if (enabled && this.keystoreConfigComposite == null) { + this.keystoreTabItem = new TabItem(this.tabFolder, SWT.NONE, 2); + this.keystoreTabItem.setText(Messages.getString("config.Keystore")); //$NON-NLS-1$ + + ScrolledComposite keystoreCompositeScr = new ScrolledComposite( + this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); + this.keystoreTabItem.setControl(keystoreCompositeScr); + this.keystoreConfigComposite = new KeystoreConfigurationComposite( + keystoreCompositeScr, SWT.NONE, this.state, + this.configurationContainer); + keystoreCompositeScr.setContent(this.keystoreConfigComposite); + keystoreCompositeScr.setExpandHorizontal(true); + keystoreCompositeScr.setExpandVertical(true); + keystoreCompositeScr.setMinSize(this.keystoreConfigComposite + .computeSize(SWT.DEFAULT, SWT.DEFAULT)); + if (!this.keystoreInitialized) { + this.keystoreConfigComposite.initConfiguration(this.configProvider); + this.keystoreInitialized = true; + } + this.keystoreConfigComposite.loadConfiguration(); + } else if (!enabled && this.keystoreConfigComposite != null){ + this.keystoreTabItem.dispose(); + this.keystoreConfigComposite = null; + } + } + + /** + * Sets the configuration manipulator + * + * @param manipulator + */ + public void setConfigManipulator(ConfigManipulator manipulator) { + this.configManipulator = manipulator; + } + + /** + * Sets the configuration provider + * + * @param provider + */ + public void setConfigProvider(PersistentConfigProvider provider) { + this.configProvider = provider; + if (this.configProvider != null) { + // Initialize Configuration Container + this.simpleConfigComposite.initConfiguration(this.configProvider); + this.advancedConfigComposite.initConfiguration(this.configProvider); + + this.simpleConfigComposite.loadConfiguration(); + this.advancedConfigComposite.loadConfiguration(); + if (this.keystoreConfigComposite != null) + this.keystoreConfigComposite.loadConfiguration(); + } + } + + boolean storeConfiguration() { + boolean status = false; + boolean redo = false; + int resumeIndex = 0; + try { + do { + try { + this.simpleConfigComposite.validateSettings(resumeIndex); + + redo = false; + status = true; + } catch (ResumableException e) { + log.error("Settings validation failed!", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + e.getMessage(), BUTTONS.ABORT_RETRY_IGNORE); + int rc = dialog.open(); + + redo = (rc == SWT.RETRY); + if (rc == SWT.IGNORE) + { + resumeIndex = e.getResumeIndex(); + redo = true; + } + } + } while (redo); + + if (!status) { + return false; + } + + status = false; + redo = false; + resumeIndex = 0; + + do { + try { + this.advancedConfigComposite.validateSettings(resumeIndex); + + redo = false; + status = true; + } catch (ResumableException e) { + log.error("Settings validation failed!", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + e.getMessage(), BUTTONS.ABORT_RETRY_IGNORE); + int rc = dialog.open(); + + redo = (rc == SWT.RETRY); + if (rc == SWT.IGNORE) + { + resumeIndex = e.getResumeIndex(); + redo = true; + } + } + } while (redo); + + if (!status) { + return false; + } + + if (this.keystoreConfigComposite != null) { + status = false; + redo = false; + resumeIndex = 0; + + do { + try { + this.keystoreConfigComposite.validateSettings(resumeIndex); + + redo = false; + status = true; + } catch (ResumableException e) { + log.error("Settings validation failed!", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + e.getMessage(), BUTTONS.ABORT_RETRY_IGNORE); + int rc = dialog.open(); + + redo = (rc == SWT.RETRY); + if (rc == SWT.IGNORE) + { + resumeIndex = e.getResumeIndex(); + redo = true; + } + } + } while (redo); + + if (!status) { + return false; + } + } + } catch (Exception e) { + log.error("Settings validation failed!", e); //$NON-NLS-1$ + String message = e.getMessage(); + if (message == null) + message = Messages.getString("error.Unexpected"); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), message, + BUTTONS.OK); + dialog.open(); + return false; + } + + if (!status) { + return false; + } + + // Write current Configuration + this.simpleConfigComposite.storeConfiguration( + this.configManipulator, this.configProvider); + this.advancedConfigComposite.storeConfiguration( + this.configManipulator, this.configProvider); + if (this.keystoreConfigComposite != null) + this.keystoreConfigComposite.storeConfiguration( + this.configManipulator, this.configProvider); + + status = false; + redo = false; + do { + // Save current config to file + try { + this.configManipulator.saveCurrentConfiguration(); + redo = false; + status = true; + } catch (IOException e) { + log.error("Failed to save configuration to file!", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), + Messages.getString("error.FailedToSaveSettings"), BUTTONS.RETRY_CANCEL); //$NON-NLS-1$ + redo = (dialog.open() == SWT.RETRY); + + // return false; + } + } while (redo); + + return status; + } + + /** + * Checks if the user has finished working with the configuration composite + * + * @return if the user is done + */ + public boolean isUserDone() { + return this.userDone; + } + + @Override + protected void checkSubclass() { + // Disable the check that prevents subclassing of SWT components + } + + /* + * (non-Javadoc) + * + * @see at.asit.pdfover.gui.composites.StateComposite#doLayout() + */ + @Override + public void doLayout() { + Control ctrl = this.compositeStack.topControl; + this.containerComposite.layout(true, true); + getShell().layout(true, true); + // Note: SWT only layouts children! No grandchildren! + if (ctrl instanceof StateComposite) { + ((StateComposite) ctrl).doLayout(); + } + setFocus(); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() + */ + @Override + public void reloadResources() { + this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ + this.aboutTabItem.setText(String.format(Messages.getString("config.About"), Constants.APP_NAME)); //$NON-NLS-1$ + this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$ + } +} -- cgit v1.2.3 From a224ce26811102d97ab02a33f3befcba311e0a62 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 20 Nov 2020 07:40:57 +0100 Subject: Updated update URL and download url --- pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 1fa31abb..105eedd5 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 @@ -109,10 +109,10 @@ public class Constants { public static final String USER_AGENT_STRING = "PDF-Over " + (APP_VERSION == null ? "4.3" : APP_VERSION); //$NON-NLS-1$ //$NON-NLS-2$ /** Current release file */ - public static final String CURRENT_RELEASE_URL = "http://webstart.buergerkarte.at/PDF-Over/Release.txt"; //$NON-NLS-1$ + public static final String CURRENT_RELEASE_URL = "https://updates.a-sit.at/pdf-over/Release.txt"; //$NON-NLS-1$ /** Update URL */ - public static final String UPDATE_URL = "http://webstart.buergerkarte.at/PDF-Over/"; //$NON-NLS-1$ + public static final String UPDATE_URL = "https://technology.a-sit.at/en/pdf-over/"; //$NON-NLS-1$ /** True */ public static final String TRUE = "true"; //$NON-NLS-1$ -- cgit v1.2.3