summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-08 18:25:26 +0200
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-09 11:33:03 +0200
commit76d1dd22a916ca17d18c73aca0adb5e334767189 (patch)
treefedb9ee9c3d5c62c6afd0248c4716429b13e64fe
parent86d2a12c001e74a1a549768eeb25ca0d1d389757 (diff)
downloadmocca-76d1dd22a916ca17d18c73aca0adb5e334767189.tar.gz
mocca-76d1dd22a916ca17d18c73aca0adb5e334767189.tar.bz2
mocca-76d1dd22a916ca17d18c73aca0adb5e334767189.zip
Add keystore option to advanced config dialog
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java39
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java36
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java3
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties2
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties2
5 files changed, 71 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;
}
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
index 9b5bd3db..d13f0e9c 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
@@ -10,6 +10,8 @@ advanced_config.AutoPosition=Automatic positioning
advanced_config.AutoPosition_ToolTip=Activate this option to automatically position the signature
advanced_config.BKUSelection_Title=CC&E Selection
advanced_config.BKUSelection_ToolTip=Select the default CCE to use during signature
+advanced_config.KeystoreEnabled=Enable keystore signing
+advanced_config.KeystoreEnabled_ToolTip=Enables the possibility to sign with a local keystore
advanced_config.LocaleSelection_Title=Interface &language selection
advanced_config.LocaleSelection_ToolTip=Select the interface language for PDF-Over
advanced_config.OutputFolder=Default output folder\:
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
index bba89f05..9359a184 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
@@ -10,6 +10,8 @@ advanced_config.AutoPosition=Automatische Positionierung
advanced_config.AutoPosition_ToolTip=Aktivieren Sie diese Option, um die Signatur automatisch zu positionieren
advanced_config.BKUSelection_Title=&BKU-Auswahl
advanced_config.BKUSelection_ToolTip=W\u00E4hlen Sie die BKU, mit der die Signatur durchgef\u00FChrt werden soll
+advanced_config.KeystoreEnabled=Keystore-Signatur aktivieren
+advanced_config.KeystoreEnabled_ToolTip=Aktiviert die M\u00F6glichkeit, mit einem lokalen Keystore zu signieren
advanced_config.LocaleSelection_Title=S&prachauswahl
advanced_config.LocaleSelection_ToolTip=W\u00E4hlen Sie die Sprache f\u00FCr das Benutzerinterface
advanced_config.OutputFolder=Standard-Ausgabeordner\: