From: BobHanson Date: Thu, 11 Jun 2020 00:40:52 +0000 (-0500) Subject: JAL-3446, JAL-3647 after first successful test run; X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8594f8fc93ae2003f0587a5b3b01d56f41216fac;p=jalview.git JAL-3446, JAL-3647 after first successful test run; removing debug messages --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index d99bd1d..b57bc08 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -568,17 +568,24 @@ public class AlignmentPanel extends GAlignmentPanel implements { // BH 2018.04.18 comment: addNotify() is not appropriate here. We // are not changing ancestors, and keyboard action listeners do - // not need to be reset. addNotify() is a very expensive operation, + // not need to be reset, and most importantly, we can't be sure we are actually + // connected to resources. + + // addNotify() is a very expensive operation, // requiring a full re-layout of all parents and children. + // Note in JComponent: + // This method is called by the toolkit internally and should // not be called directly by programs. + // I note that addNotify() is called in several areas of Jalview. int annotationHeight = getAnnotationPanel().adjustPanelHeight(); annotationHeight = getAnnotationPanel() .adjustForAlignFrame(adjustPanelHeight, annotationHeight); + // BH no!! hscroll.addNotify(); annotationScroller.setPreferredSize( new Dimension(annotationScroller.getWidth(), annotationHeight)); @@ -600,8 +607,13 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public void updateLayout() { - if (getTopLevelAncestor() == null) - return; + // BH 2020.06.09 avoiding negative values for SequencePanel and SeqCanvas + // dimensions. + + if (getTopLevelAncestor() == null) + return; + + ViewportRanges ranges = av.getRanges(); fontChanged(); setAnnotationVisible(av.isShowAnnotation()); @@ -645,8 +657,14 @@ public class AlignmentPanel extends GAlignmentPanel implements idSpaceFillerPanel1.setVisible(!wrap); - -// BH not added to anything yet! repaint(); + // System.out.println("ap dim = " + getSize()); + + // these values will go negative if getSize() returns (0,0): + + // System.out.println("seqpan dim = " + getSeqPanel().getSize()); + // System.out.println("seqcan dim = " + getSeqPanel().seqCanvas.getSize()); + + // BH not added to anything yet! repaint(); } /** @@ -660,8 +678,6 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public void setScrollValues(int x, int y) { - - System.out.println("AlignmentPanel.setScrollValues " + x + "_" + y); if (av == null || av.getAlignment() == null) { @@ -679,20 +695,10 @@ public class AlignmentPanel extends GAlignmentPanel implements hextent = Math.min(getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(), width); vextent = Math.min(getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(), height); - - if (hextent < 0) - System.out.println("AlignmentPanel.setScrollValues found hext=" + hextent + " vext=" + vextent + " width=" + width + " height=" + height - ); - x = Math.max(0, Math.min(x, width - hextent)); y = Math.max(0, Math.min(y, height - vextent)); - - System.out.println("AlignmentPanel.setScrollValues resetting these to " + x + "_" + y - + " based on hext=" + hextent + " vext=" + vextent + " width=" + width + " height=" + height - ); - updateRanges(x, y); updateScrollBars(x, y, width, height); } diff --git a/test/jalview/gui/SeqCanvasTest.java b/test/jalview/gui/SeqCanvasTest.java index b426562..21d67f4 100644 --- a/test/jalview/gui/SeqCanvasTest.java +++ b/test/jalview/gui/SeqCanvasTest.java @@ -331,7 +331,7 @@ public class SeqCanvasTest { AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( "examples/uniref50.fa", DataSourceType.FILE); - // The thing is that + // System.out.println("ap dim = " + af.alignPanel.getSize()); System.out.println("seqpan dim = " + af.alignPanel.getSeqPanel().getSize()); System.out.println("seqcan dim = " + af.alignPanel.getSeqPanel().seqCanvas.getSize());