diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-01 16:46:52 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-01 16:46:52 +0200 |
commit | d4260503697d423c0f2e18eec0b37646188e6833 (patch) | |
tree | 8a05b08669f87353334e3535569c5bb813ca9925 /pdf-over-gui/src/main/java/at | |
parent | c65a56c81433f8b675b2f5527bfa298ab1894333 (diff) | |
download | pdf-over-d4260503697d423c0f2e18eec0b37646188e6833.tar.gz pdf-over-d4260503697d423c0f2e18eec0b37646188e6833.tar.bz2 pdf-over-d4260503697d423c0f2e18eec0b37646188e6833.zip |
some cleanups trying to track down #106
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java | 34 | ||||
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 6 |
2 files changed, 16 insertions, 24 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 e04ad5b5..118f0b35 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 @@ -98,6 +98,17 @@ public class PositioningComposite extends StateComposite { StateComposite.anchor(mainArea).left(0).right(100).top(0).bottom(bottomBar, -5).set(); this.scrollbar = this.mainArea.getVerticalBar(); + this.frame = SWT_AWT.new_Frame(this.mainArea); + this.frame.addKeyListener(this.keyListener); + this.frame.addMouseWheelListener(this.mouseListener); + + this.viewer = new SignaturePanel(); + this.viewer.setSignaturePlaceholderBorderColor(new Color( + Constants.MAINBAR_ACTIVE_BACK_DARK.getRed(), + Constants.MAINBAR_ACTIVE_BACK_DARK.getGreen(), + Constants.MAINBAR_ACTIVE_BACK_DARK.getBlue())); + this.frame.add(this.viewer, BorderLayout.CENTER); + this.btnNewPage.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -109,12 +120,6 @@ public class PositioningComposite extends StateComposite { } }); - EventQueue.invokeLater(() -> { - getDisplay().syncExec(() -> { - this.frame = SWT_AWT.new_Frame(this.mainArea); - this.frame.addKeyListener(this.keyListener); - this.frame.addMouseWheelListener(this.mouseListener); - }); this.btnSign.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -135,20 +140,9 @@ public class PositioningComposite extends StateComposite { * document to display */ public void displayDocument(final PDDocument document) { - if (this.viewer == null) { - EventQueue.invokeLater(() -> { - this.viewer = new SignaturePanel(document); - this.viewer.setSignaturePlaceholderBorderColor(new Color( - Constants.MAINBAR_ACTIVE_BACK_DARK.getRed(), - Constants.MAINBAR_ACTIVE_BACK_DARK.getGreen(), - Constants.MAINBAR_ACTIVE_BACK_DARK.getBlue())); - this.frame.add(this.viewer, BorderLayout.CENTER); - }); - } else { - EventQueue.invokeLater(() -> { - this.viewer.setDocument(document); - }); - } + EventQueue.invokeLater(() -> { + this.viewer.setDocument(document); + }); if (document != null) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 37ef9eb5..008a2d2c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -113,12 +113,10 @@ public class SignaturePanel extends JPanel { /**
* Create a new PagePanel.
- * @param pdf the PDFFile to display
*/
- public SignaturePanel(PDDocument pdf) {
+ public SignaturePanel() {
super(new BorderLayout());
- setDocument(pdf);
- setPreferredSize(new Dimension(Constants.DEFAULT_MAINWINDOW_WIDTH, Constants.DEFAULT_MAINWINDOW_HEIGHT - Constants.MAINBAR_HEIGHT));
+ setDocument(null);
setFocusable(true);
addMouseListener(this.mouseListener);
addMouseMotionListener(this.mouseListener);
|