diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:37:01 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:37:01 +0000 |
commit | 2ee9d2d09aaa6bdca33978c90d1717bb0fde233d (patch) | |
tree | a4e085242b76c61ac4069f1329c6607c6f0c1cd0 /trunk/pdf-over-gui/src | |
parent | e1eee5730e290a7a2dd23438ff219e867b3fe4e3 (diff) | |
download | pdf-over-2ee9d2d09aaa6bdca33978c90d1717bb0fde233d.tar.gz pdf-over-2ee9d2d09aaa6bdca33978c90d1717bb0fde233d.tar.bz2 pdf-over-2ee9d2d09aaa6bdca33978c90d1717bb0fde233d.zip |
Add page number label
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12760 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java | 29 |
1 files changed, 21 insertions, 8 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 f4949c52..02cf6d48 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 @@ -40,6 +40,7 @@ import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.ScrollBar; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +67,10 @@ public class PositioningComposite extends StateComposite { private Frame frame = null; + private Composite mainArea = null; + + private Label lblPage = null; + int currentPage = 0; int numPages = 0; @@ -96,20 +101,27 @@ public class PositioningComposite extends StateComposite { btnSign.setText("Sign"); FormData fd_btnSign = new FormData(); fd_btnSign.right = new FormAttachment(100); - fd_btnSign.bottom = new FormAttachment(100); + fd_btnSign.top = new FormAttachment(0); btnSign.setLayoutData(fd_btnSign); - Composite mainArea = new Composite(this, SWT.BORDER | SWT.EMBEDDED | SWT.V_SCROLL); + this.lblPage = new Label(bottomBar, SWT.CENTER); + FormData fd_lblPage = new FormData(); + fd_lblPage.left = new FormAttachment(0); + fd_lblPage.right = new FormAttachment(btnSign, 5); + fd_lblPage.bottom = new FormAttachment(100); + this.lblPage.setLayoutData(fd_lblPage); + + this.mainArea = new Composite(this, SWT.BORDER | SWT.EMBEDDED | SWT.V_SCROLL); FormData fd_mainArea = new FormData(); fd_mainArea.left = new FormAttachment(0); fd_mainArea.right = new FormAttachment(100); fd_mainArea.top = new FormAttachment(0); fd_mainArea.bottom = new FormAttachment(bottomBar, -5); - mainArea.setLayoutData(fd_mainArea); - this.scrollbar = mainArea.getVerticalBar(); + this.mainArea.setLayoutData(fd_mainArea); + this.scrollbar = this.mainArea.getVerticalBar(); - this.frame = SWT_AWT.new_Frame(mainArea); - this.addKeyListener(this.keyListener); + this.frame = SWT_AWT.new_Frame(this.mainArea); + this.mainArea.addKeyListener(this.keyListener); this.frame.addMouseWheelListener(this.mouseListener); this.scrollbar.addSelectionListener(this.selectionListener); requestFocus(); @@ -149,8 +161,8 @@ public class PositioningComposite extends StateComposite { */ private void requestFocus() { - this.frame.requestFocus(); - setFocus(); + this.frame.requestFocusInWindow(); + this.mainArea.setFocus(); } /** @@ -260,6 +272,7 @@ public class PositioningComposite extends StateComposite { PositioningComposite.this.scrollbar.setSelection(PositioningComposite.this.currentPage); } }); + this.lblPage.setText(String.format("Page %d of %d", page, this.numPages)); this.viewer.showPage(page); } |