X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPaintRefresher.java;h=7e203b22d54066c60870b587050eeb85a3717a44;hb=5ea5764f835390ab631afbf54c2de40f63aa8f31;hp=54fe488449c98e1708f66c89b969e922c2247cca;hpb=cd1dfe669b5d4d155cdb5f4a97554ae91ab10cf9;p=jalview.git diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index 54fe488..7e203b2 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -39,6 +39,9 @@ import java.util.Map; */ public class PaintRefresher { + private static final int ALIGNMENT_CHANGED = 1 << 0; + private static final int VALIDATE_SEQUENCES = 1 << 1; + static Map> components = new HashMap<>(); /** @@ -101,30 +104,48 @@ public class PaintRefresher { List comps = components.get(id); + int mode = (alignmentChanged ? ALIGNMENT_CHANGED : 0) | (validateSequences ? VALIDATE_SEQUENCES : 0); if (comps == null) { return; } + repaintComponents(source, mode, comps.toArray(new Component[comps.size()])); + } - for (Component comp : comps) + public static void repaintComponents(Component source, int mode, + Component... comps) + { + for (int i = 0; i < comps.length; i++) { - if (comp == source) + Component comp = comps[i]; + if (comp == null) { continue; } - - if (validateSequences && comp instanceof AlignmentPanel - && source instanceof AlignmentPanel) + if (comp instanceof AlignmentPanel) { - validateSequences(((AlignmentPanel) source).av.getAlignment(), - ((AlignmentPanel) comp).av.getAlignment()); + if ((mode & VALIDATE_SEQUENCES) != 0 && source instanceof AlignmentPanel) + { + validateSequences(((AlignmentPanel) source).av.getAlignment(), + ((AlignmentPanel) comp).av.getAlignment()); + } + if ((mode & ALIGNMENT_CHANGED) != 0) + { + ((AlignmentPanel) comp).alignmentChanged(); + } } - - if (comp instanceof AlignmentPanel && alignmentChanged) + else if (comp instanceof IdCanvas) { - ((AlignmentPanel) comp).alignmentChanged(); + // BH 2019.04.22 fixes JS problem of repaint() consolidation + // that occurs in JavaScript but not Java [JAL-3226] + ((IdCanvas) comp).setNoFastPaint(); + } + else if (comp instanceof SeqCanvas) + { + // BH 2019.04.22 fixes JS problem of repaint() consolidation + // that occurs in JavaScript but not Java [JAL-3226] + ((SeqCanvas) comp).setNoFastPaint(); } - comp.repaint(); } } @@ -251,4 +272,5 @@ public class PaintRefresher return tmp.toArray(new AlignmentPanel[tmp.size()]); } + }