summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:35:02 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:35:02 +0000
commit2996df12a0efd57f5b654f5f4deec117cd3b0117 (patch)
treeda6182b58c564ed49818671a310cf9b0d78243a1 /pdf-over-gui/src/main/java/at/asit
parent3385be57ce493a6e5f06117b652a38780ab834ab (diff)
downloadpdf-over-2996df12a0efd57f5b654f5f4deec117cd3b0117.tar.gz
pdf-over-2996df12a0efd57f5b654f5f4deec117cd3b0117.tar.bz2
pdf-over-2996df12a0efd57f5b654f5f4deec117cd3b0117.zip
Theme configuration
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@395 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java199
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java3
2 files changed, 118 insertions, 84 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 ecf84865..2be35d56 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
@@ -16,7 +16,9 @@
package at.asit.pdfover.gui;
import java.io.File;
+import java.io.FileInputStream;
import java.util.Locale;
+import java.util.Properties;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
@@ -31,13 +33,115 @@ public class Constants {
/** Current display - used for Colors */
private static Display display = Display.getCurrent();
- private static enum Themes { DEFAULT, GEMPLUSH };
-
- private static Themes theme = Themes.DEFAULT;
-
/** Supported locales */
public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH };
+ /** Configuration directory */
+ public static String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** The default configuration file name */
+ public static final String DEFAULT_CONFIG_FILENAME = "PDF-Over.config"; //$NON-NLS-1$
+
+ /** The default log4j file name */
+ public static final String DEFAULT_LOG4J_FILENAME = "log4j.properties"; //$NON-NLS-1$
+
+ /** File suffix for the signed document */
+ public final static String SIGNED_SUFFIX = "_signed"; //$NON-NLS-1$
+
+ /** Default Mobile BKU URL */
+ public static final String DEFAULT_MOBILE_BKU_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
+
+ /** Default Mobile BKU type */
+ public static final MobileBKUs DEFAULT_MOBILE_BKU_TYPE = MobileBKUs.A_TRUST;
+
+ /** Default signature placeholder transparency */
+ public static final int DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY = 170;
+
+ /** How far to displace the signature with the arrow keys */
+ public static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15;
+
+
+ /* Configuration parameters */
+
+ /** The bku config parameter */
+ public static final String CFG_BKU = "BKU"; //$NON-NLS-1$
+
+ /** The value for the Signature position in the configuration file
+ * values for this entry are:
+ *
+ * x=vx;y=vy;p=vp or auto
+ *
+ * vx:= float value
+ * vy:= float value
+ * vp:= integer value
+ */
+ public static final String CFG_SIGNATURE_POSITION = "SIGNATURE_POSITION"; //$NON-NLS-1$
+
+ /** This signature placeholder transparency config parameter (0-255) */
+ public static final String CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$
+
+ /** The mobile number config parameter */
+ public static final String CFG_MOBILE_NUMBER = "MOBILE_NUMBER"; //$NON-NLS-1$
+
+ /** The signature note config parameter */
+ public static final String CFG_SIGNATURE_NOTE = "SIGNATURE_NOTE"; //$NON-NLS-1$
+
+ /** Mobile bku url config parameter */
+ public static final String CFG_MOBILE_BKU_URL = "MOBILE_BKU_URL"; //$NON-NLS-1$
+
+ /** Mobile bku type config parameter */
+ public static final String CFG_MOBILE_BKU_TYPE = "MOBILE_BKU_TYPE"; //$NON-NLS-1$
+
+ /** The emblem config parameter */
+ public static final String CFG_EMBLEM = "EMBLEM"; //$NON-NLS-1$
+
+ /** The locale config parameter */
+ public static final String CFG_LOCALE = "LOCALE"; //$NON-NLS-1$
+
+ /** The signature locale config parameter */
+ public static final String CFG_SIGN_LOCALE = "SIGNLOCALE"; //$NON-NLS-1$
+
+ /** The proxy host config parameter */
+ public static final String CFG_PROXY_HOST = "PROXY_HOST"; //$NON-NLS-1$
+
+ /** The proxy port config parameter */
+ public static final String CFG_PROXY_PORT = "PROXY_PORT"; //$NON-NLS-1$
+
+ /** The output folder config parameter */
+ public static final String CFG_OUTPUT_FOLDER = "OUTPUT_FOLDER"; //$NON-NLS-1$
+
+ /** The main window size (Format: width,height) */
+ public static final String CFG_MAINWINDOW_SIZE = "MAINWINDOW_SIZE"; //$NON-NLS-1$
+
+ /** The theme */
+ public static final String CFG_THEME = "THEME"; //$NON-NLS-1$
+
+
+ /* Theme constants */
+
+ /** The available themes */
+ public static enum Themes {
+ /** Default theme */ DEFAULT,
+ /** GemPlush theme */ GEMPLUSH
+ };
+
+ /** The used theme */
+ public static final Themes THEME = getTheme();
+ private static Themes getTheme() {
+ File f = new File(CONFIG_DIRECTORY + File.separatorChar + DEFAULT_CONFIG_FILENAME);
+ if (f.canRead())
+ {
+ try {
+ Properties config = new Properties();
+ config.load(new FileInputStream(f));
+ return Themes.valueOf(config.getProperty(CFG_THEME).toUpperCase());
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ return Themes.DEFAULT;
+ }
+
/** Main window height */
public static final int DEFAULT_MAINWINDOW_HEIGHT = 780;
@@ -50,7 +154,7 @@ public class Constants {
/** Main bar active background - light start of gradient */
public static final Color MAINBAR_ACTIVE_BACK_LIGHT = getMainbarActiveBackLight();
private static Color getMainbarActiveBackLight() {
- switch (theme) {
+ switch (THEME) {
default:
case DEFAULT:
return new Color(display, 0xB4, 0xCD, 0xEC);
@@ -62,7 +166,7 @@ public class Constants {
/** Main bar active background - dark end of gradient */
public static final Color MAINBAR_ACTIVE_BACK_DARK = getMainbarActiveBackDark();
private static Color getMainbarActiveBackDark() {
- switch (theme) {
+ switch (THEME) {
default:
case DEFAULT:
return new Color(display, 0x6B, 0xA5, 0xD9);
@@ -74,7 +178,7 @@ public class Constants {
/** Main bar inactive background */
public static final Color MAINBAR_INACTIVE_BACK = getMainbarInactiveBack();
private static Color getMainbarInactiveBack() {
- switch (theme) {
+ switch (THEME) {
default:
case DEFAULT:
return new Color(display, 0xD4, 0xE7, 0xF1);
@@ -107,13 +211,16 @@ public class Constants {
/** Big text size */
public static final int TEXT_SIZE_BIG = 14;
+
+ /* Resources */
+
/** 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 = getResImgConfig();
private static String getResImgConfig() {
- switch (theme) {
+ switch (THEME) {
default:
case DEFAULT:
return "/img/config.png"; //$NON-NLS-1$
@@ -145,80 +252,4 @@ public class Constants {
/** 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;
-
- /** How far to displace the signature with the arrow keys */
- public static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15;
-
- /** File suffix for the signed document */
- public final static String SIGNED_SUFFIX = "_signed"; //$NON-NLS-1$
-
- /** Default Mobile BKU URL */
- public static final String DEFAULT_MOBILE_BKU_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
-
- /** Default Mobile BKU type */
- public static final MobileBKUs DEFAULT_MOBILE_BKU_TYPE = MobileBKUs.A_TRUST;
-
- /** Configuration directory */
- public static String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$
-
- /** The default configuration file name */
- public static final String DEFAULT_CONFIG_FILENAME = "PDF-Over.config"; //$NON-NLS-1$
-
- /** The default log4j file name */
- public static final String DEFAULT_LOG4J_FILENAME = "log4j.properties"; //$NON-NLS-1$
-
- /* Configuration parameters */
-
- /** The bku config parameter */
- public static final String CFG_BKU = "BKU"; //$NON-NLS-1$
-
- /** The value for the Signature position in the configuration file
- * values for this entry are:
- *
- * x=vx;y=vy;p=vp or auto
- *
- * vx:= float value
- * vy:= float value
- * vp:= integer value
- */
- public static final String CFG_SIGNATURE_POSITION = "SIGNATURE_POSITION"; //$NON-NLS-1$
-
- /** This signature placeholder transparency config parameter (0-255) */
- public static final String CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$
-
- /** The mobile number config parameter */
- public static final String CFG_MOBILE_NUMBER = "MOBILE_NUMBER"; //$NON-NLS-1$
-
- /** The signature note config parameter */
- public static final String CFG_SIGNATURE_NOTE = "SIGNATURE_NOTE"; //$NON-NLS-1$
-
- /** Mobile bku url config parameter */
- public static final String CFG_MOBILE_BKU_URL = "MOBILE_BKU_URL"; //$NON-NLS-1$
-
- /** Mobile bku type config parameter */
- public static final String CFG_MOBILE_BKU_TYPE = "MOBILE_BKU_TYPE"; //$NON-NLS-1$
-
- /** The emblem config parameter */
- public static final String CFG_EMBLEM = "EMBLEM"; //$NON-NLS-1$
-
- /** The locale config parameter */
- public static final String CFG_LOCALE = "LOCALE"; //$NON-NLS-1$
-
- /** The signature locale config parameter */
- public static final String CFG_SIGN_LOCALE = "SIGNLOCALE"; //$NON-NLS-1$
-
- /** The proxy host config parameter */
- public static final String CFG_PROXY_HOST = "PROXY_HOST"; //$NON-NLS-1$
-
- /** The proxy port config parameter */
- public static final String CFG_PROXY_PORT = "PROXY_PORT"; //$NON-NLS-1$
-
- /** The output folder config parameter */
- public static final String CFG_OUTPUT_FOLDER = "OUTPUT_FOLDER"; //$NON-NLS-1$
-
- /** The main window size. (Format: width,height) */
- public static final String CFG_MAINWINDOW_SIZE = "MAINWINDOW_SIZE"; //$NON-NLS-1$
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
index 63a69a53..e9fbe1c2 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
@@ -319,6 +319,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator,
if (mobileBKUType != Constants.DEFAULT_MOBILE_BKU_TYPE)
props.setProperty(Constants.CFG_MOBILE_BKU_TYPE, mobileBKUType.toString());
+ if (Constants.THEME != Constants.Themes.DEFAULT)
+ props.setProperty(Constants.CFG_THEME, Constants.THEME.name());
+
FileOutputStream outputstream = new FileOutputStream(configFile, false);
props.store(outputstream, "Configuration file was generated!"); //$NON-NLS-1$