diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-10-08 18:25:26 +0200 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-10-09 11:33:03 +0200 |
commit | 76d1dd22a916ca17d18c73aca0adb5e334767189 (patch) | |
tree | fedb9ee9c3d5c62c6afd0248c4716429b13e64fe /pdf-over-gui/src/main/java/at/asit | |
parent | 86d2a12c001e74a1a549768eeb25ca0d1d389757 (diff) | |
download | pdf-over-76d1dd22a916ca17d18c73aca0adb5e334767189.tar.gz pdf-over-76d1dd22a916ca17d18c73aca0adb5e334767189.tar.bz2 pdf-over-76d1dd22a916ca17d18c73aca0adb5e334767189.zip |
Add keystore option to advanced config dialog
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
3 files changed, 67 insertions, 11 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 0b0f6d1b..a68542d6 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 @@ -84,6 +84,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { private Group grpBkuAuswahl; Combo cmbBKUAuswahl; String[] bkuStrings; + Button btnKeystoreEnabled; private Group grpSpeicherort; private Label lblDefaultOutputFolder; @@ -297,6 +298,31 @@ 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.left = new FormAttachment(0, 5); + 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])); + + this.btnKeystoreEnabled + .addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AdvancedConfigurationComposite.this.performKeystoreEnabledSelection( + AdvancedConfigurationComposite.this.btnKeystoreEnabled.getSelection()); + } + }); + this.grpSpeicherort = new Group(this, SWT.NONE); layout = new FormLayout(); layout.marginHeight = 10; @@ -809,6 +835,11 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.btnPdfACompat.setSelection(compat); } + void performKeystoreEnabledSelection(boolean enabled) { + this.configurationContainer.setKeyStoreEnabled(enabled); + this.btnKeystoreEnabled.setSelection(enabled); + } + void performPlaceholderTransparency(int transparency) { this.configurationContainer.setPlaceholderTransparency(transparency); } @@ -928,6 +959,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setDefaultBKU( provider.getDefaultBKUPersistent()); + this.configurationContainer.setKeyStoreEnabled( + provider.getKeyStoreEnabledPersistent()); this.configurationContainer.setOutputFolder( provider.getDefaultOutputFolderPersistent()); @@ -971,6 +1004,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getPlaceholderTransparency()); performLocaleSelectionChanged(this.configurationContainer.getLocale()); performPdfACompatSelection(this.configurationContainer.getSignaturePdfACompat()); + performKeystoreEnabledSelection(this.configurationContainer.getKeyStoreEnabled()); performUpdateCheckSelection(this.configurationContainer.getUpdateCheck()); int port = this.configurationContainer.getProxyPort(); @@ -1009,6 +1043,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.getPlaceholderTransparency()); store.setDefaultBKU(this.configurationContainer.getDefaultBKU()); + store.setKeyStoreEnabled(this.configurationContainer.getKeyStoreEnabled()); store.setDefaultOutputFolder(this.configurationContainer.getOutputFolder()); @@ -1116,6 +1151,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .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$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index 8eebe02d..c386c49b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -112,7 +112,7 @@ public class BKUSelectionComposite extends StateComposite { private Button btnCard; - private Button btnKS; + private Button btnKS = null; /** * Gets selected BKU type @@ -132,6 +132,28 @@ public class BKUSelectionComposite extends StateComposite { } /** + * Sets whether keystore option is enabled + * @param enabled + */ + public void setKeystoreEnabled(boolean enabled) { + if (enabled) { + this.btnKS = new Button(this, SWT.NONE); + FormData fd_btnKS = new FormData(); + fd_btnKS.top = new FormAttachment(this.btnCard, 10); + fd_btnKS.left = new FormAttachment(this.btnMobile, 0, SWT.LEFT); + fd_btnKS.right = new FormAttachment(this.btnCard, 0, SWT.RIGHT); + + this.btnKS.setLayoutData(fd_btnKS); + this.btnKS.addSelectionListener(new KSSelectionListener()); + + reloadResources(); + } else if (this.btnKS != null) { + this.btnKS.dispose(); + this.btnKS = null; + } + } + + /** * Create the composite. * @param parent * @param style @@ -208,15 +230,6 @@ public class BKUSelectionComposite extends StateComposite { fd_btnCard.width = (btncsize > cardsize) ? btncsize : cardsize; - this.btnKS = new Button(this, SWT.NONE); - FormData fd_btnKS = new FormData(); - fd_btnKS.top = new FormAttachment(this.btnCard, 10); - fd_btnKS.left = new FormAttachment(this.btnMobile, 0, SWT.LEFT); - fd_btnKS.right = new FormAttachment(this.btnCard, 0, SWT.RIGHT); - - this.btnKS.setLayoutData(fd_btnKS); - this.btnKS.addSelectionListener(new KSSelectionListener()); - reloadResources(); //this.pack(); } @@ -241,6 +254,7 @@ public class BKUSelectionComposite extends StateComposite { public void reloadResources() { this.btnMobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$ this.btnCard.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ - this.btnKS.setText(Messages.getString("bku_selection.ks")); //$NON-NLS-1$ + if (this.btnKS != null) + this.btnKS.setText(Messages.getString("bku_selection.ks")); //$NON-NLS-1$ } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java index 4e9901c9..64816edc 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java @@ -54,6 +54,9 @@ public class BKUSelectionState extends State { getStateMachine().getGUIProvider().createComposite(BKUSelectionComposite.class, SWT.RESIZE, this); } + this.selectionComposite.setKeystoreEnabled( + getStateMachine().getConfigProvider().getKeyStoreEnabled()); + return this.selectionComposite; } |