From: hansonr Date: Mon, 29 Jul 2019 20:34:41 +0000 (-0500) Subject: JAL-3383 JAL-3253-applet removes unnecessary updateOverviewImage() X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2d241446c80365862d31e76f2ecccaab33a1547f;p=jalview.git JAL-3383 JAL-3253-applet removes unnecessary updateOverviewImage() --- diff --git a/src/jalview/bin/JalviewJS2.java b/src/jalview/bin/JalviewJS2.java index 12dc147..71c06b3 100644 --- a/src/jalview/bin/JalviewJS2.java +++ b/src/jalview/bin/JalviewJS2.java @@ -34,7 +34,10 @@ public class JalviewJS2 if (args.length == 0) { args = new String[] { "open", "examples/uniref50.fa", "features", - "examples/exampleFeatures.txt", "noannotation" }; + "examples/exampleFeatures.txt" + // , "noannotation" + , "showoverview" + }; } Jalview.main(args); //showFocusTimer(); diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index ca2b6d4..4c46522 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -28,6 +28,7 @@ import jalview.util.DBRefUtils; import jalview.util.MapList; import jalview.util.StringUtils; +import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; @@ -2127,4 +2128,21 @@ public class Sequence extends ASequence implements SequenceI // otherwise, sequence was completely hidden return 0; } + + @Override + public Color getColor(int i) + { + return null; + } + + @Override + public Color setColor(int i, Color c) + { + return c; + } + + @Override + public void resetColors() + { + } } diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index 933f332..5e2355d 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -25,6 +25,7 @@ import jalview.datamodel.features.SequenceFeaturesI; import jalview.util.MapList; import jalview.ws.params.InvalidArgumentException; +import java.awt.Color; import java.util.BitSet; import java.util.Iterator; import java.util.List; @@ -584,6 +585,11 @@ public interface SequenceI extends ASequenceI */ public int firstResidueOutsideIterator(Iterator it); + public Color getColor(int i); + + public Color setColor(int i, Color c); + + public void resetColors(); } diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 8f24185..387d3dd 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -258,14 +258,14 @@ public class OverviewPanel extends JPanel }); - /* - * Javascript does not call componentResized on initial display, - * so do the update here - */ - if (Platform.isJS()) - { - updateOverviewImage(); - } + // /* + // * Javascript does not call componentResized on initial display, + // * so do the update here + // */ + // if (Platform.isJS()) + // { + // updateOverviewImage(); + // } } /** @@ -326,7 +326,11 @@ public class OverviewPanel extends JPanel } /** - * Updates the overview image when the related alignment panel is updated + * Updates the overview image when the related alignment panel is updated. + * + * Cases: + * + * */ public void updateOverviewImage() { diff --git a/src/jalview/renderer/OverviewResColourFinder.java b/src/jalview/renderer/OverviewResColourFinder.java index a497d92..ff52f1d 100644 --- a/src/jalview/renderer/OverviewResColourFinder.java +++ b/src/jalview/renderer/OverviewResColourFinder.java @@ -81,30 +81,24 @@ public class OverviewResColourFinder extends ResidueColourFinder @Override public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i) { - Color resBoxColour = RESIDUE_COLOUR; + seq.resetColors(); + Color c = seq.getColor(i); + if (c != null) + { + return c; + } char currentChar = seq.getCharAt(i); - // In the overview window, gaps are coloured grey, unless the colour scheme // specifies a gap colour, in which case gaps honour the colour scheme // settings - if (shader.getColourScheme() != null) + boolean isGap = Comparison.isGap(currentChar); + if (shader.getColourScheme() == null) { - if (Comparison.isGap(currentChar) - && (!shader.getColourScheme().hasGapColour())) - { - resBoxColour = GAP_COLOUR; - } - else - { - resBoxColour = shader.findColour(currentChar, i, seq); - } + return seq.setColor(i, isGap ? GAP_COLOUR : RESIDUE_COLOUR); } - else if (Comparison.isGap(currentChar)) - { - resBoxColour = GAP_COLOUR; - } - - return resBoxColour; + return seq.setColor(i, + isGap && !shader.getColourScheme().hasGapColour() ? GAP_COLOUR + : shader.findColour(currentChar, i, seq)); } /** @@ -113,21 +107,13 @@ public class OverviewResColourFinder extends ResidueColourFinder */ @Override protected Color getResidueBoxColour(boolean showBoxes, - ResidueShaderI shader, - SequenceGroup[] allGroups, SequenceI seq, int i) + ResidueShaderI shader, SequenceGroup[] allGroups, SequenceI seq, + int i) { - ResidueShaderI currentShader; SequenceGroup currentSequenceGroup = getCurrentSequenceGroup(allGroups, i); - if (currentSequenceGroup != null) - { - currentShader = currentSequenceGroup.getGroupColourScheme(); - } - else - { - currentShader = shader; - } - + ResidueShaderI currentShader = (currentSequenceGroup == null ? shader + : currentSequenceGroup.getGroupColourScheme()); return getBoxColour(currentShader, seq, i); }