summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:11:57 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:11:57 +0000
commit18fab2e12d5205159f99695f0439adfbb9d336c9 (patch)
tree0a3b48d29862a1d304d8b4afd4b2e314c1265dc3 /pdf-over-gui/src
parent870d13d78375bb57e776b0cfc30dd916f0e178e3 (diff)
downloadpdf-over-18fab2e12d5205159f99695f0439adfbb9d336c9.tar.gz
pdf-over-18fab2e12d5205159f99695f0439adfbb9d336c9.tar.bz2
pdf-over-18fab2e12d5205159f99695f0439adfbb9d336c9.zip
Update Scrollbar on new page
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@189 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java26
1 files changed, 15 insertions, 11 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 9d3fa864..ef0177c5 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
@@ -301,25 +301,29 @@ public class PositioningComposite extends StateComposite {
};
void showPage(int page) {
+ final int previousPage = this.currentPage;
this.currentPage = page;
this.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
- PositioningComposite.this.scrollbar.setSelection(
- PositioningComposite.this.currentPage);
- PositioningComposite.this.lblPage.setText(String.format(
- "Page %d of %d", //$NON-NLS-1$
- PositioningComposite.this.currentPage,
- PositioningComposite.this.numPages));
- if (PositioningComposite.this.currentPage > PositioningComposite.this.numPages) {
- PositioningComposite.this.btnNewPage.setText(
- Messages.getString("positioning.removeNewPage")); //$NON-NLS-1$
- PositioningComposite.this.btnNewPage.setSelection(true);
- } else {
+ int currentPage = PositioningComposite.this.currentPage;
+ int numPages = PositioningComposite.this.numPages;
+ if ((previousPage > numPages) && (currentPage <= numPages)) {
+ // Was on new page
PositioningComposite.this.btnNewPage.setText(
Messages.getString("positioning.newPage")); //$NON-NLS-1$
PositioningComposite.this.btnNewPage.setSelection(false);
+ PositioningComposite.this.scrollbar.setMaximum(numPages);
+ } else if ((previousPage <= numPages) && (currentPage > numPages)) {
+ // Go to new page
+ PositioningComposite.this.btnNewPage.setText(
+ Messages.getString("positioning.removeNewPage")); //$NON-NLS-1$
+ PositioningComposite.this.btnNewPage.setSelection(true);
+ PositioningComposite.this.scrollbar.setMaximum(numPages + 1);
}
+ PositioningComposite.this.scrollbar.setSelection(currentPage);
+ PositioningComposite.this.lblPage.setText(String.format(
+ "Page %d of %d", currentPage, numPages)); //$NON-NLS-1$
}
});
this.viewer.showPage(page);