JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / renderer / OverviewResColourFinder.java
index 94e7c5b..a497d92 100644 (file)
@@ -22,16 +22,15 @@ package jalview.renderer;
 
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
-import jalview.renderer.seqfeatures.FeatureColourFinder;
 import jalview.util.Comparison;
 
 import java.awt.Color;
 
 public class OverviewResColourFinder extends ResidueColourFinder
 {
-  final int GAP_COLOUR; // default colour to use at gaps
+  final Color GAP_COLOUR; // default colour to use at gaps
 
-  final int RESIDUE_COLOUR; // default colour to use at residues
+  final Color RESIDUE_COLOUR; // default colour to use at residues
 
   final Color HIDDEN_COLOUR; // colour for hidden regions
 
@@ -67,67 +66,69 @@ public class OverviewResColourFinder extends ResidueColourFinder
   {
     if (useLegacyColouring)
     {
-      GAP_COLOUR = Color.white.getRGB();
-      RESIDUE_COLOUR = Color.lightGray.getRGB();
+      GAP_COLOUR = Color.white;
+      RESIDUE_COLOUR = Color.lightGray;
+      HIDDEN_COLOUR = hiddenCol;
     }
     else
     {
-      GAP_COLOUR = gapCol.getRGB();
-      RESIDUE_COLOUR = Color.white.getRGB();
+      GAP_COLOUR = gapCol;
+      RESIDUE_COLOUR = Color.white;
+      HIDDEN_COLOUR = hiddenCol;
     }
-    HIDDEN_COLOUR = hiddenCol;
   }
 
-  public int getBoxColourInt(ResidueShaderI shader, SequenceI seq, int i)
+  @Override
+  public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
   {
+    Color resBoxColour = RESIDUE_COLOUR;
     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
-    boolean isGap = Comparison.isGap(currentChar);
-    if (shader.getColourScheme() == null)
+    if (shader.getColourScheme() != null)
     {
-      return (isGap ? GAP_COLOUR : RESIDUE_COLOUR);
+      if (Comparison.isGap(currentChar)
+              && (!shader.getColourScheme().hasGapColour()))
+      {
+        resBoxColour = GAP_COLOUR;
+      }
+      else
+      {
+        resBoxColour = shader.findColour(currentChar, i, seq);
+      }
     }
-    return (isGap && !shader.getColourScheme().hasGapColour() ? GAP_COLOUR
-            : shader.findColourInt(currentChar, i, seq));
-  }
-
-  public int getResidueColourInt(boolean showBoxes, ResidueShaderI shader,
-          SequenceGroup[] allGroups, final SequenceI seq, int i,
-          FeatureColourFinder finder)
-  {
-
-    int c = seq.getColor(i);
-    if (c != 0)
+    else if (Comparison.isGap(currentChar))
     {
-      return c;
+      resBoxColour = GAP_COLOUR;
     }
 
-    int col = getResidueBoxColourInt(showBoxes, shader, allGroups, seq,
-            i);
-
-
-    // if there's a FeatureColourFinder we might override the residue colour
-    // here with feature colouring
-    return seq.setColor(i,
-            finder == null || finder.noFeaturesDisplayed() ? col
-            : finder.findFeatureColourInt(col, seq, i));
+    return resBoxColour;
   }
-  
+
   /**
-   * In the overview, the showBoxes setting is ignored, as the overview displays
-   * the colours regardless.
+   * {@inheritDoc} In the overview, the showBoxes setting is ignored, as the
+   * overview displays the colours regardless.
    */
-  protected int getResidueBoxColourInt(boolean showBoxes,
-          ResidueShaderI shader, SequenceGroup[] allGroups, SequenceI seq,
-          int i)
+  @Override
+  protected Color getResidueBoxColour(boolean showBoxes,
+          ResidueShaderI shader,
+          SequenceGroup[] allGroups, SequenceI seq, int i)
   {
+    ResidueShaderI currentShader;
     SequenceGroup currentSequenceGroup = getCurrentSequenceGroup(allGroups,
             i);
-    ResidueShaderI currentShader = (currentSequenceGroup == null ? shader
-            : currentSequenceGroup.getGroupColourScheme());
-    return getBoxColourInt(currentShader, seq, i);
+    if (currentSequenceGroup != null)
+    {
+      currentShader = currentSequenceGroup.getGroupColourScheme();
+    }
+    else
+    {
+      currentShader = shader;
+    }
+
+    return getBoxColour(currentShader, seq, i);
   }
 
   /**