diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-02-18 13:32:09 +0100 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-02-18 13:32:09 +0100 |
commit | b8295c8f0cf1131888f65a03b30307cd27a34c14 (patch) | |
tree | 50047909922e806d49fb1449285b584246b5b4a5 | |
parent | b8deac65b30f52f2bd502f04b985a95744c4e4e1 (diff) | |
download | pdf-over-b8295c8f0cf1131888f65a03b30307cd27a34c14.tar.gz pdf-over-b8295c8f0cf1131888f65a03b30307cd27a34c14.tar.bz2 pdf-over-b8295c8f0cf1131888f65a03b30307cd27a34c14.zip |
refactor getDefaultSignatureBlockNote to not be static
3 files changed, 11 insertions, 11 deletions
diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java index 34014cc7..dc6d0960 100644 --- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java +++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java @@ -28,11 +28,11 @@ public enum Profile { return SIGNATURBLOCK_SMALL.name(); } - public static String getSignatureBlockNoteTextAccordingToProfile(Profile profile, Locale locale){ + public String getDefaultSignatureBlockNote(Locale locale){ - if (profile.equals(Profile.SIGNATURBLOCK_SMALL)){ + if (this == Profile.SIGNATURBLOCK_SMALL){ return Messages.getString("simple_config.Note_Default_Standard", locale); - } else if (profile.equals(Profile.AMTSSIGNATURBLOCK)){ + } else if (this == Profile.AMTSSIGNATURBLOCK) { return Messages.getString("simple_config.Note_Default_OfficialSignature", locale); } else { return ""; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index 44dcafc5..fc844ef3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -537,9 +537,9 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); if (previous != null) { Profile profile = Profile.values()[this.cmbSignatureProfiles.getSelectionIndex()]; - String prev_default_note = getSignatureBlockNoteTextAccordingToProfile(profile, previous); + String prev_default_note = profile.getDefaultSignatureBlockNote(previous); if (this.txtSignatureNote.getText().equals(prev_default_note)) { - this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile(profile, selected)); //$NON-NLS-1$); + this.txtSignatureNote.setText(profile.getDefaultSignatureBlockNote(selected)); processSignatureNoteChanged(); } } @@ -575,10 +575,10 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { String note = this.txtSignatureNote.getText(); note = note.replace("!",""); - 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()))){ + if (note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.AMTSSIGNATURBLOCK, configurationContainer.getSignatureLocale())) || + note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.SIGNATURBLOCK_SMALL, configurationContainer.getSignatureLocale())) || + note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.INVISIBLE, configurationContainer.getSignatureLocale())) || + note.equals(getSignatureBlockNoteTextAccordingToProfile(Profile.BASE_LOGO, configurationContainer.getSignatureLocale()))){ return false; } return true; @@ -587,7 +587,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { String getSignatureBlockNoteTextAccordingToProfile(Profile profile, Locale signatureLocale){ - return Profile.getSignatureBlockNoteTextAccordingToProfile(profile, this.configurationContainer.getSignatureLocale()); + return profile.getDefaultSignatureBlockNote(configurationContainer.getSignatureLocale()); } void setSignatureProfileSetting(){ 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 acea5f09..21343b5b 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 @@ -157,7 +157,7 @@ public class PrepareConfigurationState extends State { private void resetSignatureNoteField(ConfigProvider config){ getStateMachine().getConfigManipulator().setSignatureNote( - Profile.getSignatureBlockNoteTextAccordingToProfile(Profile.getProfile(config.getSignatureProfile()), config.getLocale()) + Profile.getProfile(config.getSignatureProfile()).getDefaultSignatureBlockNote(config.getLocale()) ); } |