From: gmungoc Date: Sat, 23 Mar 2019 06:40:38 +0000 (+0000) Subject: JAL-1889 remove debug logging, add updateLayout() X-Git-Tag: Release_2_11_0~17^2~33 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=87e1ada6a62777b415f14b0444fdcc63336c8f73;p=jalview.git JAL-1889 remove debug logging, add updateLayout() --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 795faff..b3fcc54 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -500,9 +500,6 @@ public class SeqCanvas extends JComponent implements ViewportListenerI labelWidthWest = av.getScaleLeftWrapped() ? labelWidth : 0; - System.out.println(Thread.currentThread().getName() - + " " + System.currentTimeMillis() + " labelWidthWest: " - + labelWidthWest); return (canvasWidth - labelWidthEast - labelWidthWest) / charWidth; } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 6bc1ad8..1176df5 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -255,11 +255,6 @@ public class SeqPanel extends JPanel int wrappedBlock = -1; - MousePos findMousePosition(MouseEvent evt) - { - return findMousePosition(evt, null); - } - /** * Computes the column and sequence row (and possibly annotation row when in * wrapped mode) for the given mouse position @@ -267,22 +262,15 @@ public class SeqPanel extends JPanel * @param evt * @return */ - MousePos findMousePosition(MouseEvent evt, String debug) + MousePos findMousePosition(MouseEvent evt) { - int col = findColumn(evt, debug); + int col = findColumn(evt); int seqIndex = -1; int annIndex = -1; int y = evt.getY(); int charHeight = av.getCharHeight(); int alignmentHeight = av.getAlignment().getHeight(); - if (debug != null) - { - System.out.println(String.format( - "%s: charHeight %d alHeight %d canvasWidth %d canvasHeight %d", - debug, charHeight, alignmentHeight, seqCanvas.getWidth(), - seqCanvas.getHeight())); - } if (av.getWrapAlignment()) { seqCanvas.calculateWrappedGeometry(seqCanvas.getWidth(), @@ -343,11 +331,6 @@ public class SeqPanel extends JPanel */ int findColumn(MouseEvent evt) { - return findColumn(evt, null); - } - - int findColumn(MouseEvent evt, String debug) - { int res = 0; int x = evt.getX(); @@ -368,14 +351,6 @@ public class SeqPanel extends JPanel int y = evt.getY(); y = Math.max(0, y - hgap); x -= seqCanvas.getLabelWidthWest(); - if (debug != null) - { - System.out.println( - String.format("%s: %s %d x %d labelWest %d charWidth %d ", - debug, Thread.currentThread().getName(), - System.currentTimeMillis(), x, - seqCanvas.getLabelWidthWest(), charWidth)); - } if (x < 0) { // mouse is over left scale @@ -389,10 +364,6 @@ public class SeqPanel extends JPanel } if (x >= cwidth * charWidth) { - if (debug != null) - { - System.out.println(debug + ": cwidth = " + cwidth); - } // mouse is over right scale return -1; } diff --git a/test/jalview/gui/SeqPanelTest.java b/test/jalview/gui/SeqPanelTest.java index fa0e352..6783514 100644 --- a/test/jalview/gui/SeqPanelTest.java +++ b/test/jalview/gui/SeqPanelTest.java @@ -266,8 +266,8 @@ public class SeqPanelTest av.setScaleAboveWrapped(false); av.setScaleLeftWrapped(false); av.setScaleRightWrapped(false); - alignFrame.alignPanel.paintAlignment(false, false); - waitForSwing(); // for Swing thread + + alignFrame.alignPanel.updateLayout(); final int charHeight = av.getCharHeight(); final int charWidth = av.getCharWidth(); @@ -288,7 +288,7 @@ public class SeqPanelTest */ MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, false, 0); - MousePos pos = testee.findMousePosition(evt, "291"); + MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); assertEquals(pos.seqIndex, -1); // above sequences assertEquals(pos.annotationIndex, -1); @@ -441,8 +441,7 @@ public class SeqPanelTest av.setScaleAboveWrapped(true); av.setScaleLeftWrapped(false); av.setScaleRightWrapped(false); - alignFrame.alignPanel.paintAlignment(false, false); - waitForSwing(); + alignFrame.alignPanel.updateLayout(); final int charHeight = av.getCharHeight(); final int charWidth = av.getCharWidth(); @@ -463,7 +462,7 @@ public class SeqPanelTest */ MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, false, 0); - MousePos pos = testee.findMousePosition(evt, "466"); + MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); assertEquals(pos.seqIndex, -1); // above sequences assertEquals(pos.annotationIndex, -1); @@ -637,8 +636,7 @@ public class SeqPanelTest av.setScaleAboveWrapped(false); av.setScaleLeftWrapped(false); av.setScaleRightWrapped(false); - alignFrame.alignPanel.paintAlignment(false, false); - waitForSwing(); + alignFrame.alignPanel.updateLayout(); final int charHeight = av.getCharHeight(); final int charWidth = av.getCharWidth(); @@ -659,7 +657,7 @@ public class SeqPanelTest */ MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0, false, 0); - MousePos pos = testee.findMousePosition(evt, "662"); + MousePos pos = testee.findMousePosition(evt); assertEquals(pos.column, 0); assertEquals(pos.seqIndex, -1); // above sequences assertEquals(pos.annotationIndex, -1); @@ -791,9 +789,7 @@ public class SeqPanelTest av.setScaleAboveWrapped(false); av.setScaleLeftWrapped(false); av.setScaleRightWrapped(false); - alignFrame.alignPanel.paintAlignment(false, false); - // need to wait for repaint to finish! - waitForSwing(); + alignFrame.alignPanel.updateLayout(); SeqPanel testee = alignFrame.alignPanel.getSeqPanel(); int x = 0; final int charWidth = av.getCharWidth(); @@ -805,7 +801,7 @@ public class SeqPanelTest */ MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0, 0, 0, 0, false, 0); - assertEquals(testee.findColumn(evt, "808"), 0); + assertEquals(testee.findColumn(evt), 0); /* * not quite one charWidth across @@ -827,8 +823,7 @@ public class SeqPanelTest * x over scale left (before drawn columns) results in -1 */ av.setScaleLeftWrapped(true); - alignFrame.alignPanel.paintAlignment(false, false); - waitForSwing(); + alignFrame.alignPanel.updateLayout(); SeqCanvas seqCanvas = testee.seqCanvas; int labelWidth = (int) PA.getValue(seqCanvas, "labelWidthWest"); assertTrue(labelWidth > 0); @@ -856,8 +851,7 @@ public class SeqPanelTest * x over scale right (beyond drawn columns) results in -1 */ av.setScaleRightWrapped(true); - alignFrame.alignPanel.paintAlignment(false, false); - waitForSwing(); + alignFrame.alignPanel.updateLayout(); labelWidth = (int) PA.getValue(seqCanvas, "labelWidthEast"); assertTrue(labelWidth > 0); int residuesWide2 = av.getRanges().getViewportWidth(); diff --git a/test/jalview/util/PlatformTest.java b/test/jalview/util/PlatformTest.java index a9ddfbb..307f450 100644 --- a/test/jalview/util/PlatformTest.java +++ b/test/jalview/util/PlatformTest.java @@ -23,12 +23,10 @@ package jalview.util; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; -import jalview.bin.Jalview; import jalview.gui.JvOptionPane; import java.awt.Button; import java.awt.Event; -import java.awt.Toolkit; import java.awt.event.MouseEvent; import org.testng.annotations.BeforeClass; @@ -58,12 +56,6 @@ public class PlatformTest int buttonNo = MouseEvent.BUTTON1; boolean mac = true; - assertFalse(Jalview.isHeadlessMode()); - Toolkit toolkit = Toolkit.getDefaultToolkit(); - System.err.println("Toolkit is " + toolkit.getClass().getName()); - System.err.println("getMenuShortcutKeyMask is " - + toolkit.getMenuShortcutKeyMask()); - int mods = 0; // not concerned with MouseEvent id, when, x, y, xAbs, yAbs values assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,