summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main
diff options
context:
space:
mode:
authorAndreas Abraham <andreas.abraham@egiz.gv.at>2020-11-13 13:49:59 +0100
committerAndreas Abraham <andreas.abraham@egiz.gv.at>2020-11-13 13:49:59 +0100
commitd658f95290ea03bd0ecdc01110b48244b28e6f19 (patch)
treeaffd5db6f2a4d4fdbda113aeb1314458aa5f6775 /pdf-over-gui/src/main
parenta43f3b3f266a63a505ae866a2378f01e5b508cc9 (diff)
downloadpdf-over-d658f95290ea03bd0ecdc01110b48244b28e6f19.tar.gz
pdf-over-d658f95290ea03bd0ecdc01110b48244b28e6f19.tar.bz2
pdf-over-d658f95290ea03bd0ecdc01110b48244b28e6f19.zip
refactored Profile
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java55
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java10
6 files changed, 21 insertions, 74 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 d6f83973..ed007cb8 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
@@ -23,8 +23,7 @@ import java.util.Properties;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
-import at.asit.pdfover.gui.Constants.PROFILE;
-import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper;
+
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
/**
@@ -59,58 +58,6 @@ public class Constants {
/** Supported locales */
public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH };
- public static enum PROFILE {
- SIGNATURBLOCK("Signaturblock Normal") , //$NON-NLS-1$
- SIGNATURBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$
- AMTSSIGNATURBLOCK("Amtssignatur"), //$NON-NLS-1$
- LOGO_ONLY("Nur Bildmarke"), //$NON-NLS-1$
- INVISIBLE("Unsichtbar");
-
- public static int length = 5;
- private String name;
-
- PROFILE(String profile){
- this.name = profile;
- }
-
- public static String[] getProfileStrings() {
- String[] profiles = new String[PROFILE.length];
- int i = 0;
- for (PROFILE profile : PROFILE.values()) {
- profiles[i] = profile.getName();
- i++;
- }
- return profiles;
- }
-
- public static PROFILE getProfileByIndex(int index) {
- String[] profiles = getProfileStrings();
- if (profiles.length < index) {
- return null;
- }
- return getProfile(profiles[index]);
- }
-
- public String getName() {
- return this.name;
- }
-
- public static PROFILE getProfile(String profile) {
- if (SIGNATURBLOCK.getName().equals(profile)) {
- return SIGNATURBLOCK;
- } else if (SIGNATURBLOCK_SMALL.getName().equals(profile)) {
- return SIGNATURBLOCK_SMALL;
- } else if (AMTSSIGNATURBLOCK.getName().equals(profile)) {
- return AMTSSIGNATURBLOCK;
- } else if (LOGO_ONLY.getName().equals(profile)) {
- return LOGO_ONLY;
- } else if (INVISIBLE.getName().equals(profile)){
- return INVISIBLE;
- }
- return null;
- }
- }
-
/** Configuration directory */
public static final String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$
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 e9ed5316..f4b3ae0b 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
@@ -48,7 +48,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.Constants;
-import at.asit.pdfover.gui.Constants.PROFILE;
+import at.asit.pdfover.commons.Profile;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.ErrorMarker;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
@@ -953,7 +953,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
provider.getProxyUserPersistent());
this.configurationContainer.setProxyPass(
provider.getProxyPassPersistent());
- this.configurationContainer.setSignatureProfile(PROFILE.getProfile(provider.getSignatureProfile()));
+ this.configurationContainer.setSignatureProfile(Profile.getProfile(provider.getSignatureProfile()));
}
/*
@@ -1001,7 +1001,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
* @param profile
*
*/
- public void performSetSignatureProfile(PROFILE profile) {
+ public void performSetSignatureProfile(Profile profile) {
this.configurationContainer.setSignatureProfile(profile);
}
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 d65c45a5..7941bc9a 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
@@ -62,7 +62,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.Constants;
-import at.asit.pdfover.gui.Constants.PROFILE;
+import at.asit.pdfover.commons.Profile;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.ErrorMarker;
@@ -236,13 +236,13 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL);
this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(),
fD_cmbSignatureProfile[0]));
- this.cmbSingatureProfiles.setItems(PROFILE.getProfileStrings());
+ this.cmbSingatureProfiles.setItems(Profile.getProfileStrings());
//this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal());
this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- PROFILE current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile();
- PROFILE selected = PROFILE.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles
+ Profile current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile();
+ Profile selected = Profile.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles
.getSelectionIndex());
if (!current.equals(selected)) {
preformProfileSelectionChanged(selected);
@@ -755,7 +755,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
}
}
- void preformProfileSelectionChanged(PROFILE selected) {
+ void preformProfileSelectionChanged(Profile selected) {
log.debug("Signature Profile {} was selected", selected.getName()); //$NON-NLS-1$
this.configurationContainer.setSignatureProfile(selected);
this.cmbSingatureProfiles.select(selected.ordinal());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java
index f1461809..92a64103 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java
@@ -25,12 +25,12 @@ import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import at.asit.pdfover.commons.Profile;
import org.eclipse.swt.graphics.Point;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.Constants;
-import at.asit.pdfover.gui.Constants.PROFILE;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
@@ -144,8 +144,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator,
String signatureProfile = config.getProperty(Constants.SIGNATURE_PROFILE);
if (signatureProfile != null) {
- this.configuration.setSignatureProfile(PROFILE.getProfile(signatureProfile));
- this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(signatureProfile));
+ this.configuration.setSignatureProfile(Profile.getProfile(signatureProfile));
+ this.configurationOverlay.setSignatureProfile(Profile.getProfile(signatureProfile));
}
String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT);
@@ -1508,7 +1508,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator,
@Override
public void setSignatureProfile(String profile) {
- this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(profile));
+ this.configurationOverlay.setSignatureProfile(Profile.getProfile(profile));
}
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java
index 8b08ba9f..bed44da1 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java
@@ -17,9 +17,9 @@ package at.asit.pdfover.gui.workflow.config;
import java.util.Locale;
+import at.asit.pdfover.commons.Profile;
import org.eclipse.swt.graphics.Point;
-import at.asit.pdfover.gui.Constants.PROFILE;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
@@ -414,11 +414,11 @@ public interface ConfigurationContainer {
/**
* @param profile set the selected profile
*/
- public void setSignatureProfile(PROFILE profile);
+ public void setSignatureProfile(Profile profile);
/**
* @return selected signature profile as string
*/
- public PROFILE getSignatureProfile();
+ public Profile getSignatureProfile();
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java
index 300e2df1..7d2c77c4 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java
@@ -20,6 +20,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.util.Locale;
+import at.asit.pdfover.commons.Profile;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
@@ -28,7 +29,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.Constants;
-import at.asit.pdfover.gui.Constants.PROFILE;
import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
@@ -147,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
protected boolean useSignatureFields = false;
/** The Signature Profile */
- protected PROFILE signatureProfile = null;
+ protected Profile signatureProfile = null;
/* (non-Javadoc)
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem()
@@ -729,15 +729,15 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
@Override
- public PROFILE getSignatureProfile() {
+ public Profile getSignatureProfile() {
if (this.signatureProfile == null) {
- this.signatureProfile = PROFILE.SIGNATURBLOCK;
+ this.signatureProfile = Profile.SIGNATURBLOCK;
}
return this.signatureProfile;
}
@Override
- public void setSignatureProfile(PROFILE profile) {
+ public void setSignatureProfile(Profile profile) {
this.signatureProfile = profile;
}