From: hansonr Date: Thu, 18 Apr 2019 03:53:59 +0000 (-0500) Subject: adds an explicit clearing of the SeqCanvas fastPaint flag upon viewport X-Git-Tag: Release_2_11_4_0~45^2~18^2~150 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5cbf11a75929325ead970d992f10ad7f3e84bab0;p=jalview.git adds an explicit clearing of the SeqCanvas fastPaint flag upon viewport adjustment --- diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index e9081b0..91ae27b 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -46,6 +46,7 @@ import java.awt.event.ComponentEvent; import java.beans.PropertyChangeEvent; import java.util.List; +@SuppressWarnings("serial") public class AlignmentPanel extends Panel implements AdjustmentListener, AlignmentViewPanel, ViewportListenerI { @@ -415,7 +416,7 @@ public class AlignmentPanel extends Panel public boolean scrollTo(int ostart, int end, int seqIndex, boolean scrollToNearest, boolean redrawOverview) { - int startv, endv, starts, ends, width; + int startv, endv, starts, ends;// , width; int start = -1; if (av.hasHiddenColumns()) @@ -736,6 +737,7 @@ public class AlignmentPanel extends Panel @Override public void adjustmentValueChanged(AdjustmentEvent evt) { + seqPanel.seqCanvas.clearFastPaint(); // Note that this event is NOT fired by the AWT scrollbar when setValues is // called. Instead manually call adjustHorizontal and adjustVertical // directly. diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 96eb6b9..f055776 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -40,6 +40,7 @@ import java.awt.Panel; import java.beans.PropertyChangeEvent; import java.util.Iterator; +@SuppressWarnings("serial") public class SeqCanvas extends Panel implements ViewportListenerI { FeatureRenderer fr; @@ -905,4 +906,19 @@ public class SeqCanvas extends Panel implements ViewportListenerI } } + /** + * Ensure that a full paint is done next, for whatever reason. This was + * necessary for JavaScript; apparently in Java the timing is just right on + * multiple threads (EventQueue-0, Consensus, Conservation) that we can get + * away with one fast paint before the others, but this ensures that in the + * end we get a full paint. Problem arose in relation to copy/paste, where the + * paste was not finalized with a full paint. + * + * @author hansonr 2019.04.17 + */ + public void clearFastPaint() + { + fastPaint = false; + } + } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 2aa21bb..f27b9b7 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -73,6 +73,7 @@ import javax.swing.SwingUtilities; * @author $author$ * @version $Revision: 1.161 $ */ +@SuppressWarnings("serial") public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListener, Printable, AlignmentViewPanel, ViewportListenerI { @@ -730,6 +731,7 @@ public class AlignmentPanel extends GAlignmentPanel implements } ranges.setViewportStartAndHeight(y, height); } + seqPanel.seqCanvas.clearFastPaint(); repaint(); } @@ -1711,4 +1713,5 @@ public class AlignmentPanel extends GAlignmentPanel implements { return calculationDialog; } + } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 2139b6b..1851200 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -52,6 +52,7 @@ import javax.swing.JPanel; * Wrapped mode, but not the scale above in Unwrapped mode. * */ +@SuppressWarnings("serial") public class SeqCanvas extends JPanel implements ViewportListenerI { /* @@ -290,7 +291,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI } fastpainting = true; fastPaint = true; - try { int charHeight = av.getCharHeight(); @@ -373,7 +373,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI width -= (width % charWidth); height -= (height % charHeight); - if ((img != null) && (fastPaint || (getVisibleRect().width != g.getClipBounds().width) || (getVisibleRect().height != g.getClipBounds().height))) @@ -1755,6 +1754,9 @@ public class SeqCanvas extends JPanel implements ViewportListenerI fastPaint = true; fastpainting = true; + System.out + .println("fastpaintwrapped fastpainting true; fastPaint=" + + fastPaint); try { @@ -2130,4 +2132,19 @@ public class SeqCanvas extends JPanel implements ViewportListenerI { return labelWidthWest; } + + /** + * Ensure that a full paint is done next, for whatever reason. This was + * necessary for JavaScript; apparently in Java the timing is just right on + * multiple threads (EventQueue-0, Consensus, Conservation) that we can get + * away with one fast paint before the others, but this ensures that in the + * end we get a full paint. Problem arose in relation to copy/paste, where the + * paste was not finalized with a full paint. + * + * @author hansonr 2019.04.17 + */ + public void clearFastPaint() + { + fastPaint = false; + } }