summaryrefslogtreecommitdiff
path: root/trunk/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authortkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:37:05 +0000
committertkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:37:05 +0000
commit74338c719f6e983ea0d01362b7aaeabff4b45725 (patch)
tree1482b01f8b4041389e172eff6d788b3c44b379e9 /trunk/pdf-over-gui/src/main/java/at
parentbdc63f6ee4cde5751d8b0e2e0382ad894b70f2c2 (diff)
downloadpdf-over-74338c719f6e983ea0d01362b7aaeabff4b45725.tar.gz
pdf-over-74338c719f6e983ea0d01362b7aaeabff4b45725.tar.bz2
pdf-over-74338c719f6e983ea0d01362b7aaeabff4b45725.zip
Update Scrollbar on new page
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12775 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index 9d3fa864..ef0177c5 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/trunk/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);