summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java34
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java34
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java10
4 files changed, 59 insertions, 28 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 98fac033..7cb58f74 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,6 +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,7 +60,7 @@ public class Constants {
public static final String[] SUPPORTED_PROFILES_STRINGS = {"Signaturblock Normal", "Signaturblock Klein", "Amtssignaturblock", "Nur Bildmarke"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
public static enum PROFILE {
- SIGNATUREBLOCK_NORMAL("Signaturblock Normal"), //$NON-NLS-1$
+ SIGNATUREBLOCK_NORMAL("Signaturblock Normal") , //$NON-NLS-1$
SIGNATUREBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$
AMTSSIGNATUREBLOCK("Amtssignaturblock"), //$NON-NLS-1$
LOGO_ONLY("Nur Bildmarke"); //$NON-NLS-1$
@@ -71,9 +72,40 @@ public class Constants {
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 (SIGNATUREBLOCK_NORMAL.getName().equals(profile)) {
+ return SIGNATUREBLOCK_NORMAL;
+ } else if (SIGNATUREBLOCK_SMALL.getName().equals(profile)) {
+ return SIGNATUREBLOCK_SMALL;
+ } else if (AMTSSIGNATUREBLOCK.getName().equals(profile)) {
+ return AMTSSIGNATUREBLOCK;
+ } else if (LOGO_ONLY.getName().equals(profile)) {
+ return LOGO_ONLY;
+ }
+ return null;
+ }
}
/** Configuration directory */
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 00df4a99..6737c194 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
@@ -116,7 +116,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
Image logo = null;
private final Group grpSignatureProfile;
-// private final Label lblSignatureProfile;
private final Combo cmbSingatureProfiles;
@@ -216,7 +215,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
fd_grpSingnatureProfile.left = new FormAttachment(0, 5);
fd_grpSingnatureProfile.top = new FormAttachment(this.grpHandySignatur, 5);
this.grpSignatureProfile.setLayoutData(fd_grpSingnatureProfile);
-// this.grpSignatureProfile.setLayout(new GridLayout(2, false));
this.grpSignatureProfile.setText("Signature Profile"); //$NON-NLS-1$
this.grpSignatureProfile.setLayout(new FormLayout());
@@ -241,30 +239,20 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL);
this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(),
fD_cmbSignatureProfile[0]));
-
- String[] profiles = new String[PROFILE.length];
- int i = 0;
- for (PROFILE profile : PROFILE.values()) {
- profiles[i] = profile.name();
- i++;
- }
-
- this.cmbSingatureProfiles.setItems(profiles);
+ this.cmbSingatureProfiles.setItems(PROFILE.getProfileStrings());
+ this.configurationContainer.getSignatureProfile();
+ this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal());
this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- String current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile();
- String selected = profiles[SimpleConfigurationComposite.this.cmbSingatureProfiles
- .getSelectionIndex()];
+ PROFILE current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile();
+ PROFILE selected = PROFILE.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles
+ .getSelectionIndex());
if (!current.equals(selected)) {
- preformProfileSelectionChanged(selected, current);
+ preformProfileSelectionChanged(selected);
}
}
});
-
-
- //------------------------------------------------------------------------
-
this.grpLogo = new Group(this, SWT.NONE);
FormData fd_grpBildmarke = new FormData();
@@ -772,12 +760,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
}
}
}
- private void preformProfileSelectionChanged(String selected, String previous) {
-
-
-
-
+ void preformProfileSelectionChanged(PROFILE selected) {
+ log.debug("Signature Profile {0} was selected", selected.getName());
+ this.configurationContainer.setSignatureProfile(selected);
}
/*
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 668c8cb7..18145d4f 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
@@ -19,6 +19,7 @@ import java.util.Locale;
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;
@@ -415,7 +416,13 @@ public interface ConfigurationContainer {
/**
+ * @param profile set the selected profile
+ */
+ public void setSignatureProfile(PROFILE profile);
+
+
+ /**
* @return selected signature profile as string
*/
- public String 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 be2444a0..b3232cfe 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
@@ -28,6 +28,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.gui.bku.mobile.MobileBKUHelper;
import at.asit.pdfover.gui.bku.mobile.MobileBKUs;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
@@ -146,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
protected boolean useSignatureFields = false;
/** The Signature Profile */
- protected String signatureProfile = "Normal"; //$NON-NLS-1$
+ protected PROFILE signatureProfile = PROFILE.SIGNATUREBLOCK_NORMAL; //$NON-NLS-1$
/* (non-Javadoc)
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem()
@@ -728,8 +729,13 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
@Override
- public String getSignatureProfile() {
+ public PROFILE getSignatureProfile() {
return this.signatureProfile;
}
+ @Override
+ public void setSignatureProfile(PROFILE profile) {
+ this.signatureProfile = profile;
+ }
+
}