JAL-3383 JAL-3253-applet removes unnecessary updateOverviewImage()
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Mon, 29 Jul 2019 20:34:41 +0000 (15:34 -0500)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Mon, 29 Jul 2019 21:05:07 +0000 (16:05 -0500)
src/jalview/bin/JalviewJS2.java
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceI.java
src/jalview/gui/OverviewPanel.java
src/jalview/renderer/OverviewResColourFinder.java

index 12dc147..71c06b3 100644 (file)
@@ -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();
index ca2b6d4..4c46522 100755 (executable)
@@ -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()
+  {
+  }
 }
index 933f332..5e2355d 100755 (executable)
@@ -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<int[]> it);
 
+  public Color getColor(int i);
+
+  public Color setColor(int i, Color c);
+
+  public void resetColors();
 
 }
 
index 8f24185..387d3dd 100755 (executable)
@@ -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()
   {
index a497d92..ff52f1d 100644 (file)
@@ -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);
   }