From 0e25043214ca2497b44e2b4b88ad945f6180ac08 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 18 Jun 2021 13:36:09 +0200 Subject: .gitignore changed --- .../at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pdf-over-gui/src/main/java/at') 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..91fd9023 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 @@ -746,6 +746,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { setSignatureProfileSetting(); } + void adoptSignatureNoteText(){ + //TODO check if one of the text + } + void setSignatureProfileSetting(){ if (this.signer == null){ log.debug("In setSignatureProfileSettings: Signer was null"); -- cgit v1.2.3 From 7a032cc75008748df505f2939984f6d33d24d58e Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 18 Jun 2021 16:16:31 +0200 Subject: added alignement of signature note text to selected profile --- .../composites/SimpleConfigurationComposite.java | 47 +++++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'pdf-over-gui/src/main/java/at') 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(){ -- cgit v1.2.3 From 995742efd6130721f1ac559a61ceaf0b09727148 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Fri, 18 Jun 2021 16:44:05 +0200 Subject: fixed behaviour --- .../gui/composites/SimpleConfigurationComposite.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main/java/at') 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 82468547..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 @@ -728,9 +728,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setSignatureLocale(selected); this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); if (previous != null) { - String prev_default_note = getSignatureBlockNoteTextAccordingToProfile(this.configurationContainer.getSignatureProfile(), previous); + 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(getSignatureBlockNoteTextAccordingToProfile(this.configurationContainer.getSignatureProfile(), selected)); //$NON-NLS-1$); + this.txtSignatureNote.setText(getSignatureBlockNoteTextAccordingToProfile(profile, selected)); //$NON-NLS-1$); processSignatureNoteChanged(); } } @@ -763,8 +764,13 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } boolean detectChanges(Profile profile){ - if (this.configurationContainer.getSignatureNote().equals(getSignatureBlockNoteTextAccordingToProfile(Profile.AMTSSIGNATURBLOCK)) || - this.configurationContainer.getSignatureNote().equals(getSignatureBlockNoteTextAccordingToProfile(Profile.SIGNATURBLOCK_SMALL))) { + + 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; -- cgit v1.2.3