summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-09 19:32:26 +0200
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-09 19:32:26 +0200
commit607d606279ce292511c91443db416d4bc99d7194 (patch)
treec5d4520a619859cf6cbd01fa929d8b9264105a9c /pdf-over-gui/src/main/java
parent76d1dd22a916ca17d18c73aca0adb5e334767189 (diff)
downloadpdf-over-607d606279ce292511c91443db416d4bc99d7194.tar.gz
pdf-over-607d606279ce292511c91443db416d4bc99d7194.tar.bz2
pdf-over-607d606279ce292511c91443db416d4bc99d7194.zip
Add keystore config tab
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java69
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java233
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java232
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java18
4 files changed, 436 insertions, 116 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 a68542d6..49b760be 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
@@ -17,6 +17,8 @@ package at.asit.pdfover.gui.composites;
// Imports
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Locale;
import org.eclipse.swt.SWT;
@@ -73,6 +75,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
private static final Logger log = LoggerFactory
.getLogger(AdvancedConfigurationComposite.class);
+
+ private ConfigurationComposite configurationComposite;
+
private Group grpSignatur;
Button btnAutomatischePositionierung;
Button btnPdfACompat;
@@ -83,7 +88,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
private Group grpBkuAuswahl;
Combo cmbBKUAuswahl;
- String[] bkuStrings;
+ List<String> bkuStrings;
Button btnKeystoreEnabled;
private Group grpSpeicherort;
@@ -119,10 +124,13 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
* @param style
* @param state
* @param container
+ * @param config
*/
public AdvancedConfigurationComposite(Composite parent, int style,
- State state, ConfigurationContainer container) {
+ State state, ConfigurationContainer container,
+ ConfigurationComposite config) {
super(parent, style, state, container);
+ this.configurationComposite = config;
setLayout(new FormLayout());
this.grpSignatur = new Group(this, SWT.NONE);
@@ -276,23 +284,25 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
fD_cmbBKUAuswahl[0]));
int blen = BKUs.values().length;
- this.bkuStrings = new String[blen];
+ this.bkuStrings = new ArrayList<String>(blen);
for (int i = 0; i < blen; i++) {
String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$
- this.bkuStrings[i] = Messages.getString(lookup);
+ String text = Messages.getString(lookup);
+ this.bkuStrings.add(text);
+ this.cmbBKUAuswahl.add(text);
}
- this.cmbBKUAuswahl.setItems(this.bkuStrings);
this.cmbBKUAuswahl.addSelectionListener(new SelectionAdapter() {
-
@Override
public void widgetSelected(SelectionEvent e) {
- int selectionIndex = getBKUElementIndex(AdvancedConfigurationComposite.this.configurationContainer
+ int selectionIndex = getBKUElementIndex(
+ AdvancedConfigurationComposite.this.configurationContainer
.getDefaultBKU());
if (AdvancedConfigurationComposite.this.cmbBKUAuswahl
.getSelectionIndex() != selectionIndex) {
selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl
.getSelectionIndex();
- performBKUSelectionChanged(AdvancedConfigurationComposite.this.cmbBKUAuswahl
+ performBKUSelectionChanged(
+ AdvancedConfigurationComposite.this.cmbBKUAuswahl
.getItem(selectionIndex));
}
}
@@ -314,14 +324,13 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
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.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();
@@ -763,15 +772,12 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
String lookup = "BKU." + bku.toString(); //$NON-NLS-1$
String bkuName = Messages.getString(lookup);
- for (int i = 0; i < this.bkuStrings.length; i++) {
- if (this.bkuStrings[i].equals(bkuName)) {
- log.debug("BKU: " + bkuName + " IDX: " + i); //$NON-NLS-1$ //$NON-NLS-2$
- return i;
- }
+ int i = this.bkuStrings.indexOf(bkuName);
+ if (i == -1) {
+ log.warn("NO BKU match for " + bkuName); //$NON-NLS-1$
+ return 0;
}
-
- log.warn("NO BKU match for " + bkuName); //$NON-NLS-1$
- return 0;
+ return i;
}
void performBKUSelectionChanged(BKUs selected) {
@@ -838,6 +844,21 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
void performKeystoreEnabledSelection(boolean enabled) {
this.configurationContainer.setKeyStoreEnabled(enabled);
this.btnKeystoreEnabled.setSelection(enabled);
+ this.configurationComposite.keystoreEnabled(enabled);
+
+ int ksIndex = getBKUElementIndex(BKUs.KS);
+ String ksText = this.bkuStrings.get(ksIndex);
+ if (enabled) {
+ if (!this.cmbBKUAuswahl.getItem(ksIndex).equals(ksText))
+ this.cmbBKUAuswahl.add(ksText, ksIndex);
+ } else {
+ int i = this.cmbBKUAuswahl.indexOf(ksText);
+ if (i != -1) {
+ if (this.cmbBKUAuswahl.getSelectionIndex() == i)
+ performBKUSelectionChanged(BKUs.NONE);
+ this.cmbBKUAuswahl.remove(i);
+ }
+ }
}
void performPlaceholderTransparency(int transparency) {
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 9d894526..77b1bd98 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
@@ -65,6 +65,79 @@ public class ConfigurationComposite extends StateComposite {
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() {
@@ -86,22 +159,22 @@ public class ConfigurationComposite extends StateComposite {
this.containerComposite = new Composite(this, SWT.FILL | SWT.RESIZE);
- TabFolder tabFolder = new TabFolder(this.containerComposite, SWT.NONE);
+ 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);
- tabFolder.setLayoutData(fd_tabFolder);
+ this.tabFolder.setLayoutData(fd_tabFolder);
- FontData[] fD_tabFolder = tabFolder.getFont().getFontData();
+ FontData[] fD_tabFolder = this.tabFolder.getFont().getFontData();
fD_tabFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL);
- tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0]));
+ this.tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0]));
- this.simpleTabItem = new TabItem(tabFolder, SWT.NONE);
+ this.simpleTabItem = new TabItem(this.tabFolder, SWT.NONE);
this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$
- ScrolledComposite simpleCompositeScr = new ScrolledComposite(tabFolder,
+ ScrolledComposite simpleCompositeScr = new ScrolledComposite(this.tabFolder,
SWT.H_SCROLL | SWT.V_SCROLL);
this.simpleTabItem.setControl(simpleCompositeScr);
this.simpleConfigComposite = new SimpleConfigurationComposite(
@@ -113,26 +186,26 @@ public class ConfigurationComposite extends StateComposite {
simpleCompositeScr.setMinSize(this.simpleConfigComposite.computeSize(
SWT.DEFAULT, SWT.DEFAULT));
- this.advancedTabItem = new TabItem(tabFolder, SWT.NONE);
+ this.advancedTabItem = new TabItem(this.tabFolder, SWT.NONE);
this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$
ScrolledComposite advancedCompositeScr = new ScrolledComposite(
- tabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
+ this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
this.advancedTabItem.setControl(advancedCompositeScr);
this.advancedConfigComposite = new AdvancedConfigurationComposite(
advancedCompositeScr, SWT.NONE, state,
- this.configurationContainer);
+ 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(tabFolder, SWT.NONE);
+ 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(
- tabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
+ this.tabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
this.aboutTabItem.setControl(aboutCompositeScr);
AboutComposite aboutConfigComposite = new AboutComposite(
aboutCompositeScr, SWT.NONE);
@@ -142,7 +215,7 @@ public class ConfigurationComposite extends StateComposite {
aboutCompositeScr.setMinSize(aboutConfigComposite
.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- tabFolder.setSelection(this.simpleTabItem);
+ this.tabFolder.setSelection(this.simpleTabItem);
this.btnSpeichern = new Button(this, SWT.NONE);
FormData fd_btnSpeichern = new FormData();
@@ -194,7 +267,7 @@ public class ConfigurationComposite extends StateComposite {
fd_composite.right = new FormAttachment(100, -5);
this.containerComposite.setLayoutData(fd_composite);
this.containerComposite.setLayout(this.compositeStack);
- this.compositeStack.topControl = tabFolder;
+ this.compositeStack.topControl = this.tabFolder;
getShell().setText(Constants.APP_NAME_VERSION);
@@ -216,67 +289,6 @@ public class ConfigurationComposite extends StateComposite {
}
}
- /**
- * 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;
-
- /**
- * 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 aboutTabItem;
-
- private Button btnSpeichern;
-
- private Button btnAbbrechen;
-
private class AboutComposite extends StateComposite {
private Link lnkAbout;
/**
@@ -357,6 +369,39 @@ public class ConfigurationComposite extends StateComposite {
}
}
+ 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
*
@@ -380,6 +425,8 @@ public class ConfigurationComposite extends StateComposite {
this.simpleConfigComposite.loadConfiguration();
this.advancedConfigComposite.loadConfiguration();
+ if (this.keystoreConfigComposite != null)
+ this.keystoreConfigComposite.loadConfiguration();
}
}
@@ -437,6 +484,41 @@ public class ConfigurationComposite extends StateComposite {
}
}
} 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();
@@ -457,6 +539,9 @@ public class ConfigurationComposite extends StateComposite {
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;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java
new file mode 100644
index 00000000..9113d3bb
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java
@@ -0,0 +1,232 @@
+/*
+ * 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.io.File;
+import java.util.Locale;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+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;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+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.controls.ErrorMarker;
+import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
+import at.asit.pdfover.gui.exceptions.InvalidNumberException;
+import at.asit.pdfover.gui.exceptions.PDFOverGUIException;
+import at.asit.pdfover.gui.utils.Messages;
+import at.asit.pdfover.gui.utils.SignaturePlaceholderCache;
+import at.asit.pdfover.gui.workflow.config.ConfigManipulator;
+import at.asit.pdfover.gui.workflow.config.ConfigurationContainer;
+import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider;
+import at.asit.pdfover.gui.workflow.states.State;
+import at.asit.pdfover.signator.FileNameEmblem;
+import at.asit.pdfover.signator.SignatureParameter;
+
+/**
+ *
+ */
+public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
+
+ /**
+ * SLF4J Logger instance
+ **/
+ static final Logger log = LoggerFactory
+ .getLogger(KeystoreConfigurationComposite.class);
+
+ private Group grpKeystore;
+
+ /**
+ * @param parent
+ * @param style
+ * @param state
+ * @param container
+ */
+ public KeystoreConfigurationComposite(
+ org.eclipse.swt.widgets.Composite parent, int style, State state,
+ ConfigurationContainer container) {
+ super(parent, style, state, container);
+ setLayout(new FormLayout());
+
+ this.grpKeystore = new Group(this, SWT.NONE | SWT.RESIZE);
+ FormData fd_grpKeystore = new FormData();
+ fd_grpKeystore.right = new FormAttachment(100, -5);
+ fd_grpKeystore.left = new FormAttachment(0, 5);
+ fd_grpKeystore.top = new FormAttachment(0, 5);
+ this.grpKeystore.setLayoutData(fd_grpKeystore);
+ this.grpKeystore.setLayout(new GridLayout(2, false));
+
+ FontData[] fD_grpKeystore = this.grpKeystore.getFont()
+ .getFontData();
+ fD_grpKeystore[0].setHeight(Constants.TEXT_SIZE_NORMAL);
+ this.grpKeystore.setFont(new Font(Display.getCurrent(),
+ fD_grpKeystore[0]));
+
+ // Load localized strings
+ reloadResources();
+ }
+
+ /**
+ *
+ */
+ private final class KeystoreFileBrowser extends SelectionAdapter {
+ /**
+ *
+ */
+ public KeystoreFileBrowser() {
+ // Nothing to do
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(
+ KeystoreConfigurationComposite.this.getShell(), SWT.OPEN);
+ dialog.setFilterExtensions(new String[] {
+ "*.p12;*.pkcs12;*.ks;*.jks", "*.p12;*.pkcs12", "*.ks;*.jks*.", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ dialog.setFilterNames(new String[] {
+ Messages.getString("common.KeystoreExtension_Description"), //$NON-NLS-1$
+ Messages.getString("common.PKCS12Extension_Description"), //$NON-NLS-1$
+ Messages.getString("common.KSExtension_Description"), //$NON-NLS-1$
+ Messages.getString("common.AllExtension_Description") }); //$NON-NLS-1$
+ String fileName = dialog.open();
+ File file = null;
+ if (fileName != null) {
+ file = new File(fileName);
+ if (file.exists()) {
+ //processEmblemChanged(fileName);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
+ */
+ @Override
+ protected void signerChanged() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.asit.pdfover.gui.composites.StateComposite#doLayout()
+ */
+ @Override
+ public void doLayout() {
+ layout(true, true);
+ }
+
+
+ /* (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.setKeyStoreFile(
+ provider.getKeyStoreFilePersistent());
+ this.configurationContainer.setKeyStoreType(
+ provider.getKeyStoreTypePersistent());
+ this.configurationContainer.setKeyStoreStorePass(
+ provider.getKeyStoreStorePassPersistent());
+ this.configurationContainer.setKeyStoreKeyPass(
+ provider.getKeyStoreKeyPassPersistent());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#loadConfiguration
+ * ()
+ */
+ @Override
+ public void loadConfiguration() {
+ // Initialize form fields from configuration Container
+ }
+
+ /* (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.setKeyStoreFile(this.configurationContainer.getKeyStoreFile());
+ store.setKeyStoreType(this.configurationContainer.getKeyStoreType());
+ store.setKeyStoreStorePass(this.configurationContainer.getKeyStoreStorePass());
+ store.setKeyStoreKeyPass(this.configurationContainer.getKeyStoreKeyPass());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.asit.pdfover.gui.composites.BaseConfigurationComposite#validateSettings
+ * ()
+ */
+ @Override
+ public void validateSettings(int resumeFrom) throws Exception {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources()
+ */
+ @Override
+ public void reloadResources() {
+ this.grpKeystore.setText(Messages
+ .getString("keystore_config.Keystore_Title")); //$NON-NLS-1$
+ }
+}
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 37f37739..d02d9258 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
@@ -84,8 +84,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
static final Logger log = LoggerFactory
.getLogger(SimpleConfigurationComposite.class);
- ConfigurationComposite configurationComposite;
-
private Group grpHandySignatur;
private Label lblMobileNumber;
Text txtMobileNumber;
@@ -720,22 +718,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.configurationContainer.setSignatureNote(note);
}
- /**
- * @return the configurationComposite
- */
- public ConfigurationComposite getConfigurationComposite() {
- return this.configurationComposite;
- }
-
- /**
- * @param configurationComposite
- * the configurationComposite to set
- */
- public void setConfigurationComposite(
- ConfigurationComposite configurationComposite) {
- this.configurationComposite = configurationComposite;
- }
-
/*
* (non-Javadoc)
*