summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java20
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java24
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java13
9 files changed, 45 insertions, 34 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 4a95d791..c5d94102 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -177,18 +177,18 @@ public class MainWindow {
*/
public void reloadLocalization() {
SWTUtils.setLocalizedText(btn_config, "main.configuration");
- this.btn_config.setToolTipText(Messages.getString("main.configuration"));
+ SWTUtils.setLocalizedToolTipText(btn_config, "main.configuration");
SWTUtils.setLocalizedText(btn_open, "common.open");
- this.btn_open.setToolTipText(Messages.getString("common.open"));
+ SWTUtils.setLocalizedToolTipText(btn_open, "common.open");
SWTUtils.setLocalizedText(btn_position, "main.position");
- this.btn_position.setToolTipText(Messages.getString("main.position"));
+ SWTUtils.setLocalizedToolTipText(btn_position, "main.position");
SWTUtils.setLocalizedText(btn_sign, "main.signature");
- this.btn_sign.setToolTipText(Messages.getString("main.signature"));
+ SWTUtils.setLocalizedToolTipText(btn_sign, "main.signature");
SWTUtils.setLocalizedText(btn_end, "main.done");
- this.btn_end.setToolTipText(Messages.getString("main.done"));
+ SWTUtils.setLocalizedToolTipText(btn_end, "main.done");
Control ctrl = this.stack.topControl;
if (ctrl instanceof StateComposite) {
@@ -257,7 +257,7 @@ public class MainWindow {
this.btn_config = new MainBarRectangleButton(this.mainbar, SWT.NONE);
SWTUtils.anchor(btn_config).bottom(100).right(0,50).top(0).left(0).set();
SWTUtils.setLocalizedText(btn_config, "main.configuration");
- this.btn_config.setToolTipText(Messages.getString("main.configuration"));
+ SWTUtils.setLocalizedToolTipText(btn_config, "main.configuration");
this.btn_config.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@@ -282,7 +282,7 @@ public class MainWindow {
this.btn_open = new MainBarStartButton(mainbarContainer, SWT.NONE);
SWTUtils.anchor(btn_open).left(0).right(27, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_open, "common.open");
- this.btn_open.setToolTipText(Messages.getString("common.open"));
+ SWTUtils.setLocalizedToolTipText(btn_open, "common.open");
this.btn_open.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@@ -299,7 +299,7 @@ public class MainWindow {
this.btn_position = new MainBarMiddleButton(mainbarContainer, SWT.NONE);
SWTUtils.anchor(btn_position).left(27, -1 * (MainBarButton.SplitFactor / 2)).right(54, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_position, "main.position");
- this.btn_position.setToolTipText(Messages.getString("main.position"));
+ SWTUtils.setLocalizedToolTipText(btn_position, "main.position");
this.btn_position.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@@ -312,7 +312,7 @@ public class MainWindow {
this.btn_sign = new MainBarMiddleButton(mainbarContainer, SWT.NONE);
SWTUtils.anchor(btn_sign).left(54, -1 * (MainBarButton.SplitFactor / 2)).right(81, (MainBarButton.SplitFactor / 2)).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_sign, "main.signature");
- this.btn_sign.setToolTipText(Messages.getString("main.signature"));
+ SWTUtils.setLocalizedToolTipText(btn_sign, "main.signature");
this.btn_sign.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@@ -325,7 +325,7 @@ public class MainWindow {
this.btn_end = new MainBarEndButton(mainbarContainer, SWT.NONE);
SWTUtils.anchor(btn_end).left(81, -1 * (MainBarButton.SplitFactor / 2)).right(100).top(0).bottom(100).set();
SWTUtils.setLocalizedText(btn_end, "main.done");
- this.btn_end.setToolTipText(Messages.getString("main.done"));
+ SWTUtils.setLocalizedToolTipText(btn_end, "main.done");
this.buttonMap.put(Buttons.FINAL, this.btn_end);
this.container = new Composite(getShell(), SWT.RESIZE);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
index c238cc62..df4d7a97 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
@@ -286,7 +286,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
SWTUtils.setLocalizedText(btn_ok, "common.Ok");
SWTUtils.setLocalizedText(btn_cancel, "common.Cancel");
- this.btn_remember.setToolTipText(Messages.getString("mobileBKU.rememberPasswordNote"));
+ SWTUtils.setLocalizedToolTipText(btn_remember, "mobileBKU.rememberPasswordNote");
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
index 82de7a3e..ce3a23bf 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
@@ -379,7 +379,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
lnk_sig_data.setEnabled(true);
lnk_sig_data.addSelectionListener(new ShowSignatureDataListener());
SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show");
- lnk_sig_data.setToolTipText(Messages.getString("mobileBKU.show_tooltip"));
+ SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip");
this.btn_ok = new Button(containerComposite, SWT.NATIVE);
SWTUtils.anchor(btn_ok).right(100,-20).bottom(100,-20).set();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java
index 9bb586c2..991d2cca 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUFingerprintComposite.java
@@ -373,7 +373,7 @@ public class MobileBKUFingerprintComposite extends StateComposite {
SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue");
SWTUtils.setLocalizedText(lblFPLabel, "tanEnter.FP");
SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show");
- this.lnk_sig_data.setToolTipText(Messages.getString("mobileBKU.show_tooltip"));
+ SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip");
SWTUtils.setLocalizedText(btn_cancel, "common.Cancel");
SWTUtils.setLocalizedText(btn_sms, "tanEnter.SMS");
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java
index 006f7866..d93c2c97 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java
@@ -397,7 +397,7 @@ public class MobileBKUQRComposite extends StateComposite {
SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue");
SWTUtils.setLocalizedText(lblQRLabel, "tanEnter.QR");
SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show");
- this.lnk_sig_data.setToolTipText(Messages.getString("mobileBKU.show_tooltip"));
+ SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip");
SWTUtils.setLocalizedText(btn_cancel, "common.Cancel");
SWTUtils.setLocalizedText(btn_sms, "tanEnter.SMS");
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
index 4d0bd3c5..e24aa9a8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
@@ -831,43 +831,43 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
public void reloadResources() {
SWTUtils.setLocalizedText(grpSignatur, "advanced_config.Signature_Title");
SWTUtils.setLocalizedText(btnAutomatischePositionierung, "advanced_config.AutoPosition");
- this.btnAutomatischePositionierung.setToolTipText(Messages.getString("advanced_config.AutoPosition_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnAutomatischePositionierung, "advanced_config.AutoPosition_ToolTip");
SWTUtils.setLocalizedText(grpPlaceholder, "advanced_config.Placeholder_Title");
SWTUtils.setLocalizedText(btnPlatzhalterVerwenden, "advanced_config.UseMarker");
- this.btnPlatzhalterVerwenden.setToolTipText(Messages.getString("advanced_config.UseMarker_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnPlatzhalterVerwenden, "advanced_config.UseMarker_ToolTip");
SWTUtils.setLocalizedText(btnSignatureFieldsUsage, "advanced_config.UseSignatureFields");
- this.btnSignatureFieldsUsage.setToolTipText(Messages.getString("advanced_config.UseSignatureFields_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnSignatureFieldsUsage, "advanced_config.UseSignatureFields_ToolTip");
SWTUtils.setLocalizedText(btnEnablePlaceholderUsage, "advanced_config.Placeholder_Enabled");
SWTUtils.setLocalizedText(btnPdfACompat, "advanced_config.PdfACompat");
- this.btnPdfACompat.setToolTipText(Messages.getString("advanced_config.PdfACompat_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnPdfACompat, "advanced_config.PdfACompat_ToolTip");
SWTUtils.setLocalizedText(lblTransparenz, "advanced_config.SigPHTransparency");
SWTUtils.setLocalizedText(lblTransparenzLinks, "advanced_config.SigPHTransparencyMin");
SWTUtils.setLocalizedText(lblTransparenzRechts, "advanced_config.SigPHTransparencyMax");
- this.sclTransparenz.setToolTipText(Messages.getString("advanced_config.SigPHTransparencyTooltip"));
+ SWTUtils.setLocalizedToolTipText(sclTransparenz, "advanced_config.SigPHTransparencyTooltip");
SWTUtils.setLocalizedText(grpBkuAuswahl, "advanced_config.BKUSelection_Title");
- this.cmbBKUAuswahl.setToolTipText(Messages.getString("advanced_config.BKUSelection_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(cmbBKUAuswahl, "advanced_config.BKUSelection_ToolTip");
SWTUtils.setLocalizedText(btnKeystoreEnabled, "advanced_config.KeystoreEnabled");
- this.btnKeystoreEnabled.setToolTipText(Messages.getString("advanced_config.KeystoreEnabled_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnKeystoreEnabled, "advanced_config.KeystoreEnabled_ToolTip");
SWTUtils.setLocalizedText(grpSpeicherort, "advanced_config.OutputFolder_Title");
SWTUtils.setLocalizedText(lblDefaultOutputFolder, "advanced_config.OutputFolder");
- this.txtOutputFolder.setToolTipText(Messages.getString("advanced_config.OutputFolder_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtOutputFolder, "advanced_config.OutputFolder_ToolTip");
SWTUtils.setLocalizedText(btnBrowse, "common.browse");
SWTUtils.setLocalizedText(grpLocaleAuswahl, "advanced_config.LocaleSelection_Title");
- this.cmbLocaleAuswahl.setToolTipText(Messages.getString("advanced_config.LocaleSelection_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(cmbLocaleAuswahl, "advanced_config.LocaleSelection_ToolTip");
SWTUtils.setLocalizedText(grpUpdateCheck, "advanced_config.UpdateCheck_Title");
SWTUtils.setLocalizedText(btnUpdateCheck, "advanced_config.UpdateCheck");
- this.btnUpdateCheck.setToolTipText(Messages.getString("advanced_config.UpdateCheck_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnUpdateCheck, "advanced_config.UpdateCheck_ToolTip");
SWTUtils.setLocalizedText(grpProxy, "advanced_config.Proxy_Title");
SWTUtils.setLocalizedText(lblProxyHost, "advanced_config.ProxyHost");
- this.txtProxyHost.setToolTipText(Messages.getString("advanced_config.ProxyHost_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtProxyHost, "advanced_config.ProxyHost_ToolTip");
this.txtProxyHost.setMessage(Messages.getString("advanced_config.ProxyHost_Template"));
SWTUtils.setLocalizedText(lblProxyPort, "advanced_config.ProxyPort");
- this.txtProxyPort.setToolTipText(Messages.getString("advanced_config.ProxyPort_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtProxyPort, "advanced_config.ProxyPort_ToolTip");
this.txtProxyPort.setMessage(Messages.getString("advanced_config.ProxyPort_Template"));
// StateComposite.setLocalizedText(lblProxyUser, "advanced_config.ProxyUser");
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
index d8c40ed1..e8e4470b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
@@ -580,18 +580,18 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
SWTUtils.setLocalizedText(grpKeystore, "keystore_config.Keystore_Title");
SWTUtils.setLocalizedText(lblKeystoreFile, "keystore_config.KeystoreFile");
SWTUtils.setLocalizedText(btnBrowse, "common.browse");
- this.txtKeystoreFile.setToolTipText(Messages.getString("keystore_config.KeystoreFile_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtKeystoreFile, "keystore_config.KeystoreFile_ToolTip");
SWTUtils.setLocalizedText(lblKeystoreType, "keystore_config.KeystoreType");
reloadKeystoreTypeStrings();
SWTUtils.setLocalizedText(lblKeystorePassStoreType, "keystore_config.SaveToWhere.Header");
reloadKeystorePassStorageTypeStrings();
this.cmbKeystoreType.setItems(this.keystoreTypes.keySet().toArray(new String[0]));
SWTUtils.setLocalizedText(lblKeystoreStorePass, "keystore_config.KeystoreStorePass");
- this.txtKeystoreStorePass.setToolTipText(Messages.getString("keystore_config.KeystoreStorePass_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtKeystoreStorePass, "keystore_config.KeystoreStorePass_ToolTip");
SWTUtils.setLocalizedText(btnLoad, "keystore_config.Load");
- this.btnLoad.setToolTipText(Messages.getString("keystore_config.Load_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(btnLoad, "keystore_config.Load_ToolTip");
SWTUtils.setLocalizedText(lblKeystoreAlias, "keystore_config.KeystoreAlias");
SWTUtils.setLocalizedText(lblKeystoreKeyPass, "keystore_config.KeystoreKeyPass");
- this.txtKeystoreKeyPass.setToolTipText(Messages.getString("keystore_config.KeystoreKeyPass_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtKeystoreKeyPass, "keystore_config.KeystoreKeyPass_ToolTip");
}
}
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 03ba7b60..52c78e9d 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
@@ -645,7 +645,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
public void reloadResources() {
SWTUtils.setLocalizedText(grpHandySignatur, "simple_config.MobileBKU_Title");
SWTUtils.setLocalizedText(lblMobileNumber, "simple_config.PhoneNumber");
- this.txtMobileNumber.setToolTipText(Messages.getString("simple_config.ExampleNumber_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(txtMobileNumber, "simple_config.ExampleNumber_ToolTip");
this.txtMobileNumber.setMessage(Messages.getString("simple_config.ExampleNumber"));
SWTUtils.setLocalizedText(grpPreview, "simple_config.Preview_Title");
@@ -653,11 +653,11 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
SWTUtils.setLocalizedText(btnBrowseLogo, "simple_config.ReplaceEmblem");
SWTUtils.setLocalizedText(grpSignatureNote, "simple_config.Note_Title");
SWTUtils.setLocalizedText(lblSignatureNote, "simple_config.Note");
- this.txtSignatureNote.setToolTipText(Messages.getString("simple_config.Note_Tooltip"));
+ SWTUtils.setLocalizedToolTipText(txtSignatureNote, "simple_config.Note_Tooltip");
SWTUtils.setLocalizedText(btnSignatureNoteDefault, "simple_config.Note_SetDefault");
SWTUtils.setLocalizedText(grpSignatureLang, "simple_config.SigBlockLang_Title");
- this.cmbSignatureLang.setToolTipText(Messages.getString("simple_config.SigBlockLang_ToolTip"));
+ SWTUtils.setLocalizedToolTipText(cmbSignatureLang, "simple_config.SigBlockLang_ToolTip");
SWTUtils.setLocalizedText(grpSignatureProfile, "simple_config.SigProfile_Title");
this.cmbSignatureProfiles.setItems(Arrays.stream(Profile.values()).map(v -> Messages.getString("simple_config."+v.name())).toArray(String[]::new));
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
index 45558121..c89f12b8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
@@ -39,10 +39,21 @@ public final class SWTUtils {
log.error("Failed to re-layout {}", swtObj.getClass().getSimpleName(), e);
}
}
-
public static void setLocalizedText(Object o, String messageKey) { genericSetText(o, Messages.getString(messageKey)); }
public static void setLocalizedText(Object o, String formatMessageKey, Object... formatArgs) { genericSetText(o, String.format(Messages.getString(formatMessageKey), formatArgs)); }
+ private static void genericSetToolTipText(Object swtObj, String text) {
+ try {
+ Method m = swtObj.getClass().getMethod("setToolTipText", String.class);
+ m.invoke(swtObj, text);
+ } catch (NoSuchMethodException | IllegalAccessException e) {
+ log.error("Attempted to setLocalizedToolTipText on object of type {}, which does not have an accessible setToolTipText method", swtObj.getClass().getSimpleName(), e);
+ } catch (InvocationTargetException e) {
+ log.error("Failed to setLocalizedToolTipText on object of type {}", swtObj.getClass().getSimpleName(), e);
+ }
+ }
+ public static void setLocalizedToolTipText(Object o, String messageKey) { genericSetToolTipText(o, Messages.getString(messageKey));}
+
public static void disableEventDefault(Control c, int event) {
c.addListener(event, (Event e) -> { e.doit = false; });
}