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(-) 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