summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-02-16 18:49:28 +0100
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-02-16 18:49:28 +0100
commitb357443e16950567cac232c438a195dfaeae9f2a (patch)
tree9aa16c69c535b50638fcf455692c6b0d85c5a6a9
parentfb3dbc3e8796484cc91f329a95226ffc246c00da (diff)
downloadpdf-over-b357443e16950567cac232c438a195dfaeae9f2a.tar.gz
pdf-over-b357443e16950567cac232c438a195dfaeae9f2a.tar.bz2
pdf-over-b357443e16950567cac232c438a195dfaeae9f2a.zip
shove anchoring and font change operations into statics on ConfigurationCompositeBase, this lets us make layouting code readable (also: make it readable for KeystoreConfigurationComposite)
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java (renamed from pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/BaseConfigurationComposite.java)44
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java218
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java2
5 files changed, 108 insertions, 166 deletions
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 9875dbbb..75f91cc1 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
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.composites.configuration.AdvancedConfigurationComposite;
-import at.asit.pdfover.gui.composites.configuration.BaseConfigurationComposite;
+import at.asit.pdfover.gui.composites.configuration.ConfigurationCompositeBase;
import at.asit.pdfover.gui.composites.configuration.KeystoreConfigurationComposite;
import at.asit.pdfover.gui.composites.configuration.SimpleConfigurationComposite;
import at.asit.pdfover.gui.controls.ErrorDialog;
@@ -81,17 +81,17 @@ public class ConfigurationComposite extends StateComposite {
/**
* simple configuration composite
*/
- BaseConfigurationComposite simpleConfigComposite;
+ ConfigurationCompositeBase simpleConfigComposite;
/**
* advanced configuration composite
*/
- BaseConfigurationComposite advancedConfigComposite;
+ ConfigurationCompositeBase advancedConfigComposite;
/**
* advanced configuration composite
*/
- BaseConfigurationComposite keystoreConfigComposite = null;
+ ConfigurationCompositeBase keystoreConfigComposite = null;
/**
* The TabFolder
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
index 5898c062..882935d6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
@@ -67,7 +67,7 @@ import at.asit.pdfover.signator.SignaturePosition;
*
* Contains the simple configuration composite
*/
-public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
+public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
/**
* SLF4J Logger instance
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/BaseConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
index 5af5bcf3..6d2bdf0f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/BaseConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
@@ -16,7 +16,13 @@
package at.asit.pdfover.gui.composites.configuration;
+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.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import at.asit.pdfover.gui.composites.StateComposite;
import at.asit.pdfover.gui.workflow.PDFSigner;
@@ -28,7 +34,7 @@ import at.asit.pdfover.gui.workflow.states.State;
/**
* Base class for configuration composites
*/
-public abstract class BaseConfigurationComposite extends StateComposite {
+public abstract class ConfigurationCompositeBase extends StateComposite {
/**
* the configuration container
@@ -60,13 +66,47 @@ public abstract class BaseConfigurationComposite extends StateComposite {
*/
protected abstract void signerChanged();
+ protected static void setFontHeight(Control c, int height)
+ {
+ FontData[] fD = c.getFont().getFontData();
+ fD[0].setHeight(height);
+ c.setFont(new Font(Display.getCurrent(), fD[0]));
+ }
+
+ protected static class AnchorSetter
+ {
+ private final Control c;
+ private final FormData fd = new FormData();
+ private AnchorSetter(Control c) { this.c = c; }
+
+ public void set() { this.c.setLayoutData(this.fd); }
+
+ public AnchorSetter top(FormAttachment a) { fd.top = a; return this; }
+ public AnchorSetter left(FormAttachment a) { fd.left = a; return this; }
+ public AnchorSetter right(FormAttachment a) { fd.right = a; return this; }
+
+ public AnchorSetter top(Control control, int offset) { return top(new FormAttachment(control, offset)); }
+ public AnchorSetter top(int num, int offset) { return top(new FormAttachment(num, offset)); }
+ public AnchorSetter top(int num) { return top(new FormAttachment(num)); }
+
+ public AnchorSetter left(Control control, int offset) { return left(new FormAttachment(control, offset)); }
+ public AnchorSetter left(int num, int offset) { return left(new FormAttachment(num, offset)); }
+ public AnchorSetter left(int num) { return left(new FormAttachment(num)); }
+
+ public AnchorSetter right(Control control, int offset) { return right(new FormAttachment(control, offset)); }
+ public AnchorSetter right(int num, int offset) { return right(new FormAttachment(num, offset)); }
+ public AnchorSetter right(int num) { return right(new FormAttachment(num)); }
+ }
+
+ protected static AnchorSetter anchor(Control c) { return new AnchorSetter(c); }
+
/**
* @param parent
* @param style
* @param state
* @param configuration
*/
- public BaseConfigurationComposite(Composite parent, int style, State state, ConfigurationContainer configuration) {
+ public ConfigurationCompositeBase(Composite parent, int style, State state, ConfigurationContainer configuration) {
super(parent, style, state);
this.configurationContainer = configuration;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
index f38213e3..d63d3fc5 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
@@ -33,14 +33,11 @@ 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.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.widgets.Button;
import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@@ -65,7 +62,7 @@ import at.asit.pdfover.gui.workflow.states.State;
/**
*
*/
-public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
+public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
/**
* SLF4J Logger instance
@@ -88,7 +85,6 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
Text txtKeystoreKeyPass;
Map<String, String> keystoreTypes;
- private Map<String, String> keystoreTypes_i;
private KeyStore ks;
@@ -103,83 +99,65 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
ConfigurationContainer container) {
super(parent, style, state, container);
setLayout(new FormLayout());
-
- class InterfaceSetupHelper
- {
- public void setFontDataHeight(Control c, int height)
- {
- FontData[] fD = c.getFont().getFontData();
- fD[0].setHeight(height);
- c.setFont(new Font(Display.getCurrent(), fD[0]));
- }
- }
-
- InterfaceSetupHelper helper = new InterfaceSetupHelper();
this.grpKeystore = new Group(this, SWT.NONE | SWT.RESIZE);
FormLayout layout = new FormLayout();
layout.marginHeight = 10;
layout.marginWidth = 5;
this.grpKeystore.setLayout(layout);
- FormData fd_grpKeystore = new FormData();
- fd_grpKeystore.top = new FormAttachment(0, 5);
- fd_grpKeystore.left = new FormAttachment(0, 5);
- fd_grpKeystore.right = new FormAttachment(100, -5);
- this.grpKeystore.setLayoutData(fd_grpKeystore);
- helper.setFontDataHeight(this.grpKeystore, Constants.TEXT_SIZE_NORMAL);
+
+ ConfigurationCompositeBase.anchor(grpKeystore).top(0,5).left(0,5).right(100,-5).set();
+ ConfigurationCompositeBase.setFontHeight(this.grpKeystore, Constants.TEXT_SIZE_NORMAL);
this.lblKeystoreFile = new Label(this.grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(lblKeystoreFile).top(0).left(0,5).set();
FormData fd_lblKeystoreFile = new FormData();
fd_lblKeystoreFile.top = new FormAttachment(0);
fd_lblKeystoreFile.left = new FormAttachment(0, 5);
this.lblKeystoreFile.setLayoutData(fd_lblKeystoreFile);
- helper.setFontDataHeight(this.lblKeystoreFile, Constants.TEXT_SIZE_NORMAL);
-
- this.txtKeystoreFile = new Text(this.grpKeystore, SWT.BORDER);
- FormData fd_txtKeystoreFile = new FormData();
- fd_txtKeystoreFile.top = new FormAttachment(this.lblKeystoreFile, 5);
- fd_txtKeystoreFile.left = new FormAttachment(0, 15);
- this.txtKeystoreFile.setLayoutData(fd_txtKeystoreFile);
- helper.setFontDataHeight(this.txtKeystoreFile, Constants.TEXT_SIZE_NORMAL);
-
- this.btnBrowse = new Button(this.grpKeystore, SWT.NONE);
- fd_txtKeystoreFile.right = new FormAttachment(this.btnBrowse, -5);
- helper.setFontDataHeight(this.btnBrowse, Constants.TEXT_SIZE_BUTTON);
-
- FormData fd_btnBrowse = new FormData();
- fd_btnBrowse.top = new FormAttachment(this.lblKeystoreFile, 5);
- fd_btnBrowse.right = new FormAttachment(100, -5);
- this.btnBrowse.setLayoutData(fd_btnBrowse);
-
- this.lblKeystoreType = new Label(this.grpKeystore, SWT.NONE);
- FormData fd_lblKeystoreType = new FormData();
- fd_lblKeystoreType.top = new FormAttachment(this.txtKeystoreFile, 5);
- fd_lblKeystoreType.left = new FormAttachment(0, 5);
- this.lblKeystoreType.setLayoutData(fd_lblKeystoreType);
- helper.setFontDataHeight(this.lblKeystoreType, Constants.TEXT_SIZE_NORMAL);
-
- this.cmbKeystoreType = new Combo(this.grpKeystore, SWT.READ_ONLY);
- FormData fd_cmbKeystoreType = new FormData();
- fd_cmbKeystoreType.right = new FormAttachment(100, -5);
- fd_cmbKeystoreType.top = new FormAttachment(this.lblKeystoreType, 5);
- fd_cmbKeystoreType.left = new FormAttachment(0, 15);
- this.cmbKeystoreType.setLayoutData(fd_cmbKeystoreType);
- helper.setFontDataHeight(this.cmbKeystoreType, Constants.TEXT_SIZE_NORMAL);
-
- this.lblKeystoreAlias = new Label(this.grpKeystore, SWT.NONE);
- FormData fd_lblKeystoreAlias = new FormData();
- fd_lblKeystoreAlias.top = new FormAttachment(this.cmbKeystoreType, 5);
- fd_lblKeystoreAlias.left = new FormAttachment(0, 5);
- this.lblKeystoreAlias.setLayoutData(fd_lblKeystoreAlias);
- helper.setFontDataHeight(this.lblKeystoreAlias, Constants.TEXT_SIZE_NORMAL);
-
- this.cmbKeystoreAlias = new Combo(this.grpKeystore, SWT.NONE);
- FormData fd_cmbKeystoreAlias = new FormData();
- fd_cmbKeystoreAlias.top = new FormAttachment(this.lblKeystoreAlias, 5);
- fd_cmbKeystoreAlias.left = new FormAttachment(0, 15);
- this.cmbKeystoreAlias.setLayoutData(fd_cmbKeystoreAlias);
- helper.setFontDataHeight(this.cmbKeystoreAlias, Constants.TEXT_SIZE_NORMAL);
+ ConfigurationCompositeBase.setFontHeight(lblKeystoreFile, Constants.TEXT_SIZE_NORMAL);
+
+ this.txtKeystoreFile = new Text(grpKeystore, SWT.BORDER);
+ this.btnBrowse = new Button(grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.setFontHeight(txtKeystoreFile, Constants.TEXT_SIZE_NORMAL);
+ ConfigurationCompositeBase.setFontHeight(btnBrowse, Constants.TEXT_SIZE_BUTTON);
+ ConfigurationCompositeBase.anchor(txtKeystoreFile).top(lblKeystoreFile, 5).left(0,15).right(btnBrowse,-5).set();
+ ConfigurationCompositeBase.anchor(btnBrowse).top(lblKeystoreFile, 5).right(100,-5).set();
+ this.lblKeystoreType = new Label(grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(lblKeystoreType).top(txtKeystoreFile, 5).left(0,5).set();
+ ConfigurationCompositeBase.setFontHeight(lblKeystoreType, Constants.TEXT_SIZE_NORMAL);
+
+ this.cmbKeystoreType = new Combo(grpKeystore, SWT.READ_ONLY);
+ ConfigurationCompositeBase.anchor(cmbKeystoreType).right(100, -5).top(lblKeystoreType, 5).left(0,15).set();
+ ConfigurationCompositeBase.setFontHeight(cmbKeystoreType, Constants.TEXT_SIZE_NORMAL);
+
+ this.lblKeystoreStorePass = new Label(this.grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(lblKeystoreStorePass).top(cmbKeystoreType, 5).left(0,5).set();
+ ConfigurationCompositeBase.setFontHeight(lblKeystoreStorePass, Constants.TEXT_SIZE_NORMAL);
+
+ this.txtKeystoreStorePass = new Text(this.grpKeystore, SWT.BORDER | SWT.PASSWORD);
+ this.btnLoad = new Button(this.grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(txtKeystoreStorePass).top(lblKeystoreStorePass, 5).left(0,15).right(btnLoad, -5).set();
+ ConfigurationCompositeBase.anchor(btnLoad).top(lblKeystoreStorePass, 5).right(100,-5).set();
+ ConfigurationCompositeBase.setFontHeight(txtKeystoreStorePass, Constants.TEXT_SIZE_NORMAL);
+ ConfigurationCompositeBase.setFontHeight(btnLoad, Constants.TEXT_SIZE_BUTTON);
+
+ this.lblKeystoreAlias = new Label(grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(lblKeystoreAlias).top(txtKeystoreStorePass, 5).left(0, 5).set();
+ ConfigurationCompositeBase.setFontHeight(lblKeystoreAlias, Constants.TEXT_SIZE_NORMAL);
+
+ this.cmbKeystoreAlias = new Combo(grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(cmbKeystoreAlias).top(lblKeystoreAlias, 5).left(0,15).right(100,-5).set();
+ ConfigurationCompositeBase.setFontHeight(cmbKeystoreAlias, Constants.TEXT_SIZE_NORMAL);
+
+ this.lblKeystoreKeyPass = new Label(this.grpKeystore, SWT.NONE);
+ ConfigurationCompositeBase.anchor(lblKeystoreKeyPass).top(cmbKeystoreAlias, 5).left(0,5).set();
+ ConfigurationCompositeBase.setFontHeight(lblKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL);
+
+ this.txtKeystoreKeyPass = new Text(this.grpKeystore, SWT.BORDER | SWT.PASSWORD);
+ ConfigurationCompositeBase.anchor(txtKeystoreKeyPass).top(lblKeystoreKeyPass, 5).left(0,15).right(100,-5).set();
+ ConfigurationCompositeBase.setFontHeight(txtKeystoreKeyPass, Constants.TEXT_SIZE_NORMAL);
this.txtKeystoreFile.addFocusListener(new FocusAdapter() {
@Override
@@ -211,9 +189,6 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
}
});
-
- initKeystoreTypes();
- this.cmbKeystoreType.setItems(this.keystoreTypes.keySet().toArray(new String[0]));
this.cmbKeystoreType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -224,30 +199,6 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
}
});
- this.lblKeystoreStorePass = new Label(this.grpKeystore, SWT.NONE);
- FormData fd_lblKeystoreStorePass = new FormData();
- fd_lblKeystoreStorePass.top = new FormAttachment(this.cmbKeystoreType, 5);
- fd_lblKeystoreStorePass.left = new FormAttachment(0, 5);
- this.lblKeystoreStorePass.setLayoutData(fd_lblKeystoreStorePass);
-
- FontData[] fD_lblKeystoreStorePass = this.lblKeystoreStorePass.getFont()
- .getFontData();
- fD_lblKeystoreStorePass[0].setHeight(Constants.TEXT_SIZE_NORMAL);
- this.lblKeystoreStorePass.setFont(new Font(Display.getCurrent(),
- fD_lblKeystoreStorePass[0]));
-
- this.txtKeystoreStorePass = new Text(this.grpKeystore, SWT.BORDER | SWT.PASSWORD);
- FormData fd_txtKeystoreStorePass = new FormData();
- fd_txtKeystoreStorePass.top = new FormAttachment(this.lblKeystoreStorePass, 5);
- fd_txtKeystoreStorePass.left = new FormAttachment(0, 15);
- this.txtKeystoreStorePass.setLayoutData(fd_txtKeystoreStorePass);
-
- FontData[] fD_txtKeystoreStorePass = this.txtKeystoreStorePass.getFont()
- .getFontData();
- fD_txtKeystoreStorePass[0].setHeight(Constants.TEXT_SIZE_NORMAL);
- this.txtKeystoreStorePass.setFont(new Font(Display.getCurrent(),
- fD_txtKeystoreStorePass[0]));
-
this.txtKeystoreStorePass.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
@@ -256,18 +207,6 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
}
});
- this.btnLoad = new Button(this.grpKeystore, SWT.NONE);
- fd_txtKeystoreStorePass.right = new FormAttachment(this.btnLoad, -5);
-
- FontData[] fD_btnLoad = this.btnLoad.getFont().getFontData();
- fD_btnLoad[0].setHeight(Constants.TEXT_SIZE_BUTTON);
- this.btnLoad.setFont(new Font(Display.getCurrent(), fD_btnLoad[0]));
-
- FormData fd_btnLoad = new FormData();
- fd_btnLoad.top = new FormAttachment(this.lblKeystoreStorePass, 5);
- fd_btnLoad.right = new FormAttachment(100, -5);
- this.btnLoad.setLayoutData(fd_btnLoad);
-
this.btnLoad.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -314,31 +253,6 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
}
});
- this.lblKeystoreKeyPass = new Label(this.grpKeystore, SWT.NONE);
- FormData fd_lblKeystoreKeyPass = new FormData();
- fd_lblKeystoreKeyPass.top = new FormAttachment(this.cmbKeystoreAlias, 5);
- fd_lblKeystoreKeyPass.left = new FormAttachment(0, 5);
- this.lblKeystoreKeyPass.setLayoutData(fd_lblKeystoreKeyPass);
-
- FontData[] fD_lblKeystoreKeyPass = this.lblKeystoreKeyPass.getFont()
- .getFontData();
- fD_lblKeystoreKeyPass[0].setHeight(Constants.TEXT_SIZE_NORMAL);
- this.lblKeystoreKeyPass.setFont(new Font(Display.getCurrent(),
- fD_lblKeystoreKeyPass[0]));
-
- this.txtKeystoreKeyPass = new Text(this.grpKeystore, SWT.BORDER | SWT.PASSWORD);
- FormData fd_txtKeystoreKeyPass = new FormData();
- fd_txtKeystoreKeyPass.top = new FormAttachment(this.lblKeystoreKeyPass, 5);
- fd_txtKeystoreKeyPass.left = new FormAttachment(0, 15);
- fd_txtKeystoreKeyPass.right = new FormAttachment(100, -5);
- this.txtKeystoreKeyPass.setLayoutData(fd_txtKeystoreKeyPass);
-
- FontData[] fD_txtKeystoreKeyPass = this.txtKeystoreKeyPass.getFont()
- .getFontData();
- fD_txtKeystoreKeyPass[0].setHeight(Constants.TEXT_SIZE_NORMAL);
- this.txtKeystoreKeyPass.setFont(new Font(Display.getCurrent(),
- fD_txtKeystoreKeyPass[0]));
-
this.txtKeystoreKeyPass.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
@@ -371,11 +285,8 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
private void initKeystoreTypes() {
this.keystoreTypes = new HashMap<String, String>();
- this.keystoreTypes_i = new HashMap<String, String>();
this.keystoreTypes.put(Messages.getString("keystore_config.KeystoreType_PKCS12"), "PKCS12"); //$NON-NLS-1$ //$NON-NLS-2$
- this.keystoreTypes_i.put("PKCS12", Messages.getString("keystore_config.KeystoreType_PKCS12")); //$NON-NLS-1$ //$NON-NLS-2$
this.keystoreTypes.put(Messages.getString("keystore_config.KeystoreType_JKS"), "JCEKS"); //$NON-NLS-1$ //$NON-NLS-2$
- this.keystoreTypes_i.put("JCEKS", Messages.getString("keystore_config.KeystoreType_JKS")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -406,9 +317,8 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
protected void performKeystoreTypeChanged(String type) {
log.debug("Selected keystore type: " + type); //$NON-NLS-1$
this.configurationContainer.setKeyStoreType(type);
- String type_text = this.keystoreTypes_i.get(type);
for (int i = 0; i < this.cmbKeystoreType.getItemCount(); ++i) {
- if (this.cmbKeystoreType.getItem(i).equals(type_text)) {
+ if (this.keystoreTypes.get(this.cmbKeystoreType.getItem(i)).equals(type)) {
this.cmbKeystoreType.select(i);
break;
}
@@ -566,27 +476,19 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite {
*/
@Override
public void reloadResources() {
- this.grpKeystore.setText(Messages
- .getString("keystore_config.Keystore_Title")); //$NON-NLS-1$
- this.lblKeystoreFile.setText(Messages
- .getString("keystore_config.KeystoreFile")); //$NON-NLS-1$
+ this.grpKeystore.setText(Messages.getString("keystore_config.Keystore_Title")); //$NON-NLS-1$
+ this.lblKeystoreFile.setText(Messages.getString("keystore_config.KeystoreFile")); //$NON-NLS-1$
this.btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$
- this.txtKeystoreFile.setToolTipText(Messages
- .getString("keystore_config.KeystoreFile_ToolTip")); //$NON-NLS-1$
- this.lblKeystoreType.setText(Messages
- .getString("keystore_config.KeystoreType")); //$NON-NLS-1$
- this.lblKeystoreStorePass.setText(Messages
- .getString("keystore_config.KeystoreStorePass")); //$NON-NLS-1$
- this.txtKeystoreStorePass.setToolTipText(Messages
- .getString("keystore_config.KeystoreStorePass_ToolTip")); //$NON-NLS-1$
+ this.txtKeystoreFile.setToolTipText(Messages.getString("keystore_config.KeystoreFile_ToolTip")); //$NON-NLS-1$
+ this.lblKeystoreType.setText(Messages.getString("keystore_config.KeystoreType")); //$NON-NLS-1$
+ initKeystoreTypes();
+ this.cmbKeystoreType.setItems(this.keystoreTypes.keySet().toArray(new String[0]));
+ this.lblKeystoreStorePass.setText(Messages.getString("keystore_config.KeystoreStorePass")); //$NON-NLS-1$
+ this.txtKeystoreStorePass.setToolTipText(Messages.getString("keystore_config.KeystoreStorePass_ToolTip")); //$NON-NLS-1$
this.btnLoad.setText(Messages.getString("keystore_config.Load")); //$NON-NLS-1$
- this.btnLoad.setToolTipText(Messages
- .getString("keystore_config.Load_ToolTip")); //$NON-NLS-1$
- this.lblKeystoreAlias.setText(Messages
- .getString("keystore_config.KeystoreAlias")); //$NON-NLS-1$
- this.lblKeystoreKeyPass.setText(Messages
- .getString("keystore_config.KeystoreKeyPass")); //$NON-NLS-1$
- this.txtKeystoreKeyPass.setToolTipText(Messages
- .getString("keystore_config.KeystoreKeyPass_ToolTip")); //$NON-NLS-1$
+ this.btnLoad.setToolTipText(Messages.getString("keystore_config.Load_ToolTip")); //$NON-NLS-1$
+ this.lblKeystoreAlias.setText(Messages.getString("keystore_config.KeystoreAlias")); //$NON-NLS-1$
+ this.lblKeystoreKeyPass.setText(Messages.getString("keystore_config.KeystoreKeyPass")); //$NON-NLS-1$
+ this.txtKeystoreKeyPass.setToolTipText(Messages.getString("keystore_config.KeystoreKeyPass_ToolTip")); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
index a93ff8f2..bef6d58f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
@@ -78,7 +78,7 @@ import at.asit.pdfover.signator.SignatureParameter;
/**
*
*/
-public class SimpleConfigurationComposite extends BaseConfigurationComposite {
+public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
/**
* SLF4J Logger instance