summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-01 16:47:21 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-01 16:47:21 +0200
commitada27c42f0e3acd910535b0749089118fb1e2d18 (patch)
tree3573d602b42131e263e63f771bb7493f67ada537 /pdf-over-gui
parentd4260503697d423c0f2e18eec0b37646188e6833 (diff)
downloadpdf-over-ada27c42f0e3acd910535b0749089118fb1e2d18.tar.gz
pdf-over-ada27c42f0e3acd910535b0749089118fb1e2d18.tar.bz2
pdf-over-ada27c42f0e3acd910535b0749089118fb1e2d18.zip
setLocalizedText cleanups for PositioningComposite
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java2
2 files changed, 8 insertions, 9 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index 118f0b35..3db26635 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
@@ -299,19 +299,20 @@ public class PositioningComposite extends StateComposite {
int numPages = this.numPages;
if ((previousPage > numPages) && (currentPage <= numPages)) {
// Was on new page
- this.btnNewPage.setText(Messages.getString("positioning.newPage"));
+ StateComposite.setLocalizedText(btnNewPage, "positioning.newPage");
this.btnNewPage.setSelection(false);
this.bottomBar.layout();
this.scrollbar.setMaximum(numPages + 1);
} else if ((previousPage <= numPages) && (currentPage > numPages)) {
// Go to new page
+ StateComposite.setLocalizedText(btnNewPage, "positioning.removeNewPage");
this.btnNewPage.setText(Messages.getString("positioning.removeNewPage"));
this.btnNewPage.setSelection(true);
this.bottomBar.layout();
this.scrollbar.setMaximum(numPages + 2);
}
this.scrollbar.setSelection(currentPage);
- this.lblPage.setText(String.format(Messages.getString("positioning.page"), currentPage, numPages));
+ StateComposite.setLocalizedText(lblPage, "positioning.page", currentPage, numPages);
});
EventQueue.invokeLater(() -> {
PositioningComposite.this.viewer.showPage(page);
@@ -394,12 +395,8 @@ public class PositioningComposite extends StateComposite {
*/
@Override
public void reloadResources() {
- if (this.currentPage <= this.numPages)
- this.btnNewPage.setText(Messages.getString("positioning.newPage"));
- else
- this.btnNewPage.setText(Messages.getString("positioning.removeNewPage"));
- this.btnSign.setText(Messages.getString("positioning.sign"));
- this.lblPage.setText(String.format(Messages.getString("positioning.page"),
- this.currentPage, this.numPages));
+ StateComposite.setLocalizedText(btnNewPage, (this.currentPage <= this.numPages) ? "positioning.newPage" : "positioning.removeNewPage");
+ StateComposite.setLocalizedText(btnSign, "positioning.sign");
+ StateComposite.setLocalizedText(lblPage, "positioning.page", this.currentPage, this.numPages);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java
index a5ea4e4d..421e52d3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java
@@ -68,7 +68,9 @@ public abstract class StateComposite extends Composite {
}
public static void setLocalizedText(Label l, String messageKey) { l.setText(Messages.getString(messageKey)); l.requestLayout(); }
+ public static void setLocalizedText(Label l, String formatMessageKey, Object... formatArgs) { l.setText(String.format(Messages.getString(formatMessageKey), formatArgs)); l.requestLayout(); }
public static void setLocalizedText(Button b, String messageKey) { b.setText(Messages.getString(messageKey)); b.requestLayout(); }
+ public static void setLocalizedText(Button b, String formatMessageKey, Object... formatArgs) { b.setText(String.format(Messages.getString(formatMessageKey), formatArgs)); b.requestLayout(); }
public static void setFontHeight(Control c, int height)
{