summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authorAndreas Abraham <andreas.abraham@egiz.gv.at>2021-06-18 14:45:01 +0000
committerAndreas Abraham <andreas.abraham@egiz.gv.at>2021-06-18 14:45:01 +0000
commit76ffa9f2d9e9ec86b5a3c9a6f00ea901c9719451 (patch)
tree2c6bec3cfc764f32f761d938622889bf0a0887c8 /pdf-over-gui/src/main/java/at
parentd448f2334ebb9e83e52a009b563dbc3e0ab23ad4 (diff)
parent995742efd6130721f1ac559a61ceaf0b09727148 (diff)
downloadpdf-over-76ffa9f2d9e9ec86b5a3c9a6f00ea901c9719451.tar.gz
pdf-over-76ffa9f2d9e9ec86b5a3c9a6f00ea901c9719451.tar.bz2
pdf-over-76ffa9f2d9e9ec86b5a3c9a6f00ea901c9719451.zip
Merge branch 'issue/34' into 'master'
Issue/34 See merge request egiz/pdf-over!7
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.java53
1 files changed, 49 insertions, 4 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 269f72d3..05efd217 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,16 @@ 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$
+ Profile profile = Profile.values()[this.cmbSignatureProfiles.getSelectionIndex()];
+ String prev_default_note = getSignatureBlockNoteTextAccordingToProfile(profile, 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(profile, selected)); //$NON-NLS-1$);
processSignatureNoteChanged();
}
}
}
+
+
void preformProfileSelectionChanged(Profile selected) {
log.debug("Signature Profile {} was selected", selected.name()); //$NON-NLS-1$
@@ -744,6 +748,47 @@ 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){
+
+ 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))){
+ 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 "";
+ }
+ }
+
+ String getSignatureBlockNoteTextAccordingToProfile(Profile profile){
+ return getSignatureBlockNoteTextAccordingToProfile(profile, this.configurationContainer.getSignatureLocale());
}
void setSignatureProfileSetting(){