diff options
author | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2021-06-18 16:16:31 +0200 |
---|---|---|
committer | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2021-06-18 16:16:31 +0200 |
commit | 7a032cc75008748df505f2939984f6d33d24d58e (patch) | |
tree | 6d492ab1c9147f07b39f6d7674b33abb5b9f242f /pdf-over-gui/src/main/java/at | |
parent | 0e25043214ca2497b44e2b4b88ad945f6180ac08 (diff) | |
download | pdf-over-7a032cc75008748df505f2939984f6d33d24d58e.tar.gz pdf-over-7a032cc75008748df505f2939984f6d33d24d58e.tar.bz2 pdf-over-7a032cc75008748df505f2939984f6d33d24d58e.zip |
added alignement of signature note text to selected profile
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java | 47 |
1 files changed, 41 insertions, 6 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 91fd9023..82468547 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 @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.Locale; import javax.imageio.ImageIO; +import javax.swing.*; import at.asit.pdfover.signator.SignaturePosition; import org.eclipse.swt.SWT; @@ -551,8 +552,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.btnSignatureNoteDefault.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - SimpleConfigurationComposite.this.txtSignatureNote.setText( - Messages.getString("simple_config.Note_Default", //$NON-NLS-1$ + SimpleConfigurationComposite.this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile( + SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(), SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())); } }); @@ -727,13 +728,15 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setSignatureLocale(selected); this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); if (previous != null) { - String prev_default_note = Messages.getString("simple_config.Note_Default", previous); //$NON-NLS-1$ + String prev_default_note = getSignatureBlockNoteTextAccordingToProfile(this.configurationContainer.getSignatureProfile(), previous); if (this.txtSignatureNote.getText().equals(prev_default_note)) { - this.txtSignatureNote.setText(Messages.getString("simple_config.Note_Default", selected)); //$NON-NLS-1$); + this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile(this.configurationContainer.getSignatureProfile(), selected)); //$NON-NLS-1$); processSignatureNoteChanged(); } } } + + void preformProfileSelectionChanged(Profile selected) { log.debug("Signature Profile {} was selected", selected.name()); //$NON-NLS-1$ @@ -744,10 +747,42 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); } setSignatureProfileSetting(); + alignSignatureNoteTextToProfile(selected); + + } + + void alignSignatureNoteTextToProfile(Profile profile){ + + if (detectChanges(profile) == false){ + this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile(profile)); + this.configurationContainer.setSignatureNote( + Messages.getString(getSignatureBlockNoteTextAccordingToProfile(profile)) + ); + } + + } + + boolean detectChanges(Profile profile){ + if (this.configurationContainer.getSignatureNote().equals(getSignatureBlockNoteTextAccordingToProfile(Profile.AMTSSIGNATURBLOCK)) || + this.configurationContainer.getSignatureNote().equals(getSignatureBlockNoteTextAccordingToProfile(Profile.SIGNATURBLOCK_SMALL))) { + return false; + } + return true; + } + + 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 ""; + } } - void adoptSignatureNoteText(){ - //TODO check if one of the text + String getSignatureBlockNoteTextAccordingToProfile(Profile profile){ + return getSignatureBlockNoteTextAccordingToProfile(profile, this.configurationContainer.getSignatureLocale()); } void setSignatureProfileSetting(){ |