diff options
author | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2021-09-13 14:57:00 +0200 |
---|---|---|
committer | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2021-09-13 14:57:00 +0200 |
commit | dd6f9d619008b4e3bcd5b163a25d3cf91836bf03 (patch) | |
tree | 91930db3e5fe5eb445ee95f4499ebed0da2cd1f1 /pdf-over-gui/src/main/java/at/asit | |
parent | f2fc62bd1d2dd0dc9660375890c28af5cbb5b00a (diff) | |
download | pdf-over-dd6f9d619008b4e3bcd5b163a25d3cf91836bf03.tar.gz pdf-over-dd6f9d619008b4e3bcd5b163a25d3cf91836bf03.tar.bz2 pdf-over-dd6f9d619008b4e3bcd5b163a25d3cf91836bf03.zip |
fixed issue 43
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
4 files changed, 19 insertions, 38 deletions
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 2ec6d80c..abed9e93 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 @@ -753,9 +753,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { void alignSignatureNoteTextToProfile(Profile profile){ if (detectChanges(profile) == false){ - this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile(profile)); + this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile(profile, SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())); this.configurationContainer.setSignatureNote( - Messages.getString(getSignatureBlockNoteTextAccordingToProfile(profile)) + Messages.getString(getSignatureBlockNoteTextAccordingToProfile(profile, SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())) ); } @@ -765,29 +765,19 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { String note = this.txtSignatureNote.getText(); note = note.replace("!",""); - if (note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.AMTSSIGNATURBLOCK)) || - note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.SIGNATURBLOCK_SMALL)) || - note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.INVISIBLE)) || - note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.BASE_LOGO))){ + if (note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.AMTSSIGNATURBLOCK, SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())) || + note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.SIGNATURBLOCK_SMALL, SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())) || + note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.INVISIBLE, SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())) || + note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.BASE_LOGO, SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale()))){ return false; } return true; } - //TODO FIX ME - String getSignatureBlockNoteTextAccordingToProfile(Profile profile, Locale locale){ - if (profile.equals(Profile.SIGNATURBLOCK_SMALL)){ - return Messages.getString("simple_config.Note_Default_Standard", locale); - } else if (profile.equals(Profile.AMTSSIGNATURBLOCK)){ - return Messages.getString("simple_config.Note_Default_OfficialSignature", locale); - } else { - return ""; - } - } - String getSignatureBlockNoteTextAccordingToProfile(Profile profile){ - return getSignatureBlockNoteTextAccordingToProfile(profile, this.configurationContainer.getSignatureLocale()); + String getSignatureBlockNoteTextAccordingToProfile(Profile profile, Locale signatureLocale){ + return Profile.getSignatureBlockNoteTextAccordingToProfile(profile, this.configurationContainer.getSignatureLocale()); } void setSignatureProfileSetting(){ 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 86d86e4b..4108a895 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 @@ -45,6 +45,12 @@ import at.asit.pdfover.signator.SignaturePosition; */ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, ConfigOverlayManipulator, PersistentConfigProvider { + + + /** Default Mobile BKU type */ + public static final MobileBKUs DEFAULT_MOBILE_BKU_TYPE = MobileBKUs.A_TRUST; + + /** * SLF4J Logger instance **/ @@ -178,7 +184,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, bkuType.trim().toUpperCase())); } catch (IllegalArgumentException e) { log.error("Invalid BKU type: " + bkuType); //$NON-NLS-1$ - this.configuration.setMobileBKUType(Constants.DEFAULT_MOBILE_BKU_TYPE); + this.configuration.setMobileBKUType(DEFAULT_MOBILE_BKU_TYPE); } } @@ -408,7 +414,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, props.setProperty(Constants.CFG_MOBILE_BKU_URL, mobileBKUURL); MobileBKUs mobileBKUType = getMobileBKUType(); - if (mobileBKUType != Constants.DEFAULT_MOBILE_BKU_TYPE) + if (mobileBKUType != DEFAULT_MOBILE_BKU_TYPE) props.setProperty(Constants.CFG_MOBILE_BKU_TYPE, mobileBKUType.toString()); if (getMobileBKUBase64()) 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 46b5c460..83d05f72 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 @@ -99,7 +99,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected String mobileBKUURL = Constants.DEFAULT_MOBILE_BKU_URL; /** Holds the mobile BKU type */ - protected MobileBKUs mobileBKUType = Constants.DEFAULT_MOBILE_BKU_TYPE; + protected MobileBKUs mobileBKUType = ConfigProviderImpl.DEFAULT_MOBILE_BKU_TYPE; /** Holds the mobile BKU BASE64 setting */ protected boolean mobileBKUBase64 = false; 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 2ce4a5a0..b0c5de85 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 @@ -153,27 +153,12 @@ public class PrepareConfigurationState extends State { String note_old = Messages.getString("simple_config.Note_Default_Old", loc); //$NON-NLS-1$ if (note.equals(note_old)) { - String profileNote = getDefaultNote(config); - - note = Messages.getString("simple_config.Note_Default", loc); //$NON-NLS-1$ + String profile = config.getSignatureProfile(); + note = Profile.getSignatureBlockNoteTextAccordingToProfile(Profile.getProfile(profile), config.getLocale()); getStateMachine().getConfigManipulator().setSignatureNote(note); } } - private String getDefaultNote(ConfigProvider config){ - - Profile profile = Profile.getProfile(config.getSignatureProfile()); - Locale locale = config.getLocale(); - - if (profile.equals(Profile.SIGNATURBLOCK_SMALL)){ - return Messages.getString("simple_config.Note_Default_Standard", locale); - } else if (profile.equals(Profile.AMTSSIGNATURBLOCK)){ - return Messages.getString("simple_config.Note_Default_OfficialSignature", locale); - } else { - return ""; - } - } - private void initializeFromArguments(String[] args, ArgumentHandler handler) throws InitializationException { handler.handleArguments(args); |