summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java28
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java12
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java9
8 files changed, 46 insertions, 22 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index 48448572..a91a1ea4 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -79,6 +79,34 @@ public class Constants {
/** Big text size */
public static final int TEXT_SIZE_BIG = 14;
+ /** Shell icon resource */
+ public static final String RES_ICON = "/icons/icon.png"; //$NON-NLS-1$
+
+ /** Config image resource */
+ public static final String RES_IMG_CONFIG = "/img/config.png"; //$NON-NLS-1$
+// public static final String RES_IMG_CONFIG = "/img/config_p.png"; //$NON-NLS-1$
+
+ /** Error image resource */
+ public static final String RES_IMG_ERROR = "/img/error.png"; //$NON-NLS-1$
+
+ /** Card image resource */
+ public static final String RES_IMG_CARD = "/img/karte.gif"; //$NON-NLS-1$
+
+ /** Mobile phone image resource */
+ public static final String RES_IMG_MOBILE = "/img/handy.gif"; //$NON-NLS-1$
+
+ /** Package resource path */
+ public static String RES_PKG_PATH = "/at/asit/pdfover/gui/"; //$NON-NLS-1$
+
+ /** Zipped configuration resource */
+ public static final String RES_CFG_ZIP = "/cfg/PDFASConfig.zip"; //$NON-NLS-1$
+
+ /** Accepted certificate resource path */
+ public static final String RES_CERT_PATH = "/certificates/"; //$NON-NLS-1$
+
+ /** Accepted certificate list resource */
+ public static final String RES_CERT_LIST = RES_CERT_PATH + "certificates.xml"; //$NON-NLS-1$
+
/** Default signature placeholder transparency */
public static final int DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY = 170;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 2d06f9ef..502c8525 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -256,7 +256,7 @@ public class MainWindow {
}
});
- ImageData data = new ImageData(this.getClass().getResourceAsStream("/icons/icon.png"));//$NON-NLS-1$
+ ImageData data = new ImageData(this.getClass().getResourceAsStream(Constants.RES_ICON));
Image shellicon = new Image(this.shell.getDisplay(), data);
this.shell.setImage(shellicon);
@@ -293,7 +293,7 @@ public class MainWindow {
});
this.buttonMap.put(Buttons.CONFIG, this.btn_config);
- InputStream is = this.getClass().getResourceAsStream("/img/config.png"); //$NON-NLS-1$
+ InputStream is = this.getClass().getResourceAsStream(Constants.RES_IMG_CONFIG);
this.btn_config.setImage(new Image(Display.getDefault(), new ImageData(
is)));
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 c176dd54..d21afcaa 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
@@ -146,7 +146,7 @@ public class BKUSelectionComposite extends StateComposite {
});
cc_mobile.setLayoutData(fd_cc_mobile);
- Image mobile = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/handy.gif"))); //$NON-NLS-1$
+ Image mobile = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE)));
cc_mobile.setImage(mobile);
FontData[] fD_cc_mobile = cc_mobile.getFont().getFontData();
fD_cc_mobile[0].setHeight(Constants.TEXT_SIZE_BUTTON);
@@ -175,7 +175,7 @@ public class BKUSelectionComposite extends StateComposite {
});
cc_karte.setLayoutData(fd_cc_karte);
- Image karte = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/karte.gif"))); //$NON-NLS-1$
+ Image karte = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_CARD)));
cc_karte.setImage(karte);
FontData[] fD_cc_karte = cc_mobile.getFont().getFontData();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
index 5f83fd92..4cf7ec83 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
@@ -228,7 +228,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
Label lbl_image = new Label(containerComposite, SWT.NATIVE);
- ImageData data = new ImageData(this.getClass().getResourceAsStream("/img/handy.gif"));//$NON-NLS-1$
+ ImageData data = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE));
Image mobile = new Image(getDisplay(), data);
FormData fd_lbl_image = new FormData();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
index 953a898d..55203ba9 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
@@ -273,7 +273,6 @@ public class MobileBKUEnterTANComposite extends StateComposite {
final Composite containerComposite = new Composite(this, SWT.NATIVE);
containerComposite.addPaintListener(new PaintListener() {
-
@Override
public void paintControl(PaintEvent e) {
Rectangle clientArea = containerComposite.getClientArea();
@@ -308,7 +307,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
Label lbl_image = new Label(containerComposite, SWT.NATIVE);
ImageData data = new ImageData(this.getClass().getResourceAsStream(
- "/img/handy.gif"));//$NON-NLS-1$
+ Constants.RES_IMG_MOBILE));
Image mobile = new Image(getDisplay(), data);
FormData fd_lbl_image = new FormData();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java
index 546b0088..9e2579a3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java
@@ -28,6 +28,8 @@ import org.eclipse.swt.widgets.Label;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Constants;
+
/**
*
*/
@@ -40,8 +42,6 @@ public class ErrorMarker extends Label {
private static final Logger log = LoggerFactory
.getLogger(ErrorMarker.class);
- private static final String IMG_PATH = "/img/error.png"; //$NON-NLS-1$
-
Image errorImg;
/**
@@ -54,7 +54,7 @@ public class ErrorMarker extends Label {
String message) {
super(parent, style);
- InputStream stream = this.getClass().getResourceAsStream(IMG_PATH);
+ InputStream stream = this.getClass().getResourceAsStream(Constants.RES_IMG_ERROR);
this.errorImg = new Image(getDisplay(), new ImageData(stream));
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
index a05ded9e..93e5844c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
@@ -58,8 +58,6 @@ public class PrepareConfigurationState extends State {
private static final Logger log = LoggerFactory
.getLogger(PrepareConfigurationState.class);
- private static String RES_PATH = "/at/asit/pdfover/gui/"; //$NON-NLS-1$
-
private static String FILE_SEPARATOR = File.separator;
private ArgumentHandler handler;
@@ -105,7 +103,7 @@ public class PrepareConfigurationState extends State {
// default value!
try {
InputStream is = this.getClass().getResourceAsStream(
- RES_PATH + filename);
+ Constants.RES_PKG_PATH + filename);
this.stateMachine.getConfigProvider()
.loadConfiguration(is);
@@ -151,8 +149,8 @@ public class PrepareConfigurationState extends State {
InputStream inputStream = null;
FileOutputStream pdfOverConfig = null;
try {
- inputStream = this.getClass().getResourceAsStream(RES_PATH +
- Constants.DEFAULT_CONFIG_FILENAME);
+ inputStream = this.getClass().getResourceAsStream(
+ Constants.RES_PKG_PATH + Constants.DEFAULT_CONFIG_FILENAME);
pdfOverConfig = new FileOutputStream(
this.stateMachine.getConfigProvider().getConfigurationDirectory() +
FILE_SEPARATOR + Constants.DEFAULT_CONFIG_FILENAME);
@@ -190,7 +188,7 @@ public class PrepareConfigurationState extends State {
pdfOverConfig = null;
try {
inputStream = this.getClass().getResourceAsStream(
- RES_PATH + Constants.DEFAULT_LOG4J_FILENAME);
+ Constants.RES_PKG_PATH + Constants.DEFAULT_LOG4J_FILENAME);
String filename = this.stateMachine.getConfigProvider().getConfigurationDirectory()
+ FILE_SEPARATOR + Constants.DEFAULT_LOG4J_FILENAME;
pdfOverConfig = new FileOutputStream(filename);
@@ -227,7 +225,7 @@ public class PrepareConfigurationState extends State {
}
InputStream is = this.getClass().getResourceAsStream(
- "/cfg/PDFASConfig.zip"); //$NON-NLS-1$
+ Constants.RES_CFG_ZIP);
try {
Unzipper.unzip(is, configDir.getAbsolutePath());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java
index d08dcfe5..6d72e856 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java
@@ -33,6 +33,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import at.asit.pdfover.gui.Constants;
+
/**
*
*/
@@ -43,9 +45,6 @@ public class SimpleXMLTrustManager implements X509TrustManager {
private static final Logger log = LoggerFactory
.getLogger(SimpleXMLTrustManager.class);
- private static final String certificateList = "/certificates/certificates.xml"; //$NON-NLS-1$
-
-
/*
* The default X509TrustManager returned by SunX509. We'll delegate
* decisions to it, and fall back to the logic in this class if the default
@@ -93,7 +92,7 @@ public class SimpleXMLTrustManager implements X509TrustManager {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
- .parse(this.getClass().getResourceAsStream(certificateList));
+ .parse(this.getClass().getResourceAsStream(Constants.RES_CERT_LIST));
Node certificates = doc.getFirstChild();
@@ -118,7 +117,7 @@ public class SimpleXMLTrustManager implements X509TrustManager {
continue;
}
- String certResource = "/certificates/" + certificateNode.getTextContent(); //$NON-NLS-1$
+ String certResource = Constants.RES_CERT_PATH + certificateNode.getTextContent();
X509Certificate cert = (X509Certificate) CertificateFactory
.getInstance("X509"). //$NON-NLS-1$