JAL-2527 Code comments, tidy
[jalview.git] / src / jalview / renderer / OverviewResColourFinder.java
index c591f54..07fc6e3 100644 (file)
@@ -28,12 +28,55 @@ import java.awt.Color;
 
 public class OverviewResColourFinder extends ResidueColourFinder
 {
-  final Color GAP_COLOUR = new Color(240, 240, 240);
+  final Color GAP_COLOUR; // default colour to use at gaps
+
+  final Color RESIDUE_COLOUR; // default colour to use at residues
+
+  final Color HIDDEN_COLOUR; // colour for hidden regions
+
+  boolean useLegacy = false;
+
+  /**
+   * Constructor without colour settings (used by applet)
+   */
+  public OverviewResColourFinder()
+  {
+    GAP_COLOUR = Color.lightGray;
+    RESIDUE_COLOUR = Color.white;
+    HIDDEN_COLOUR = Color.DARK_GRAY.darker();
+  }
+
+  /**
+   * Constructor with colour settings
+   * 
+   * @param useLegacyColouring
+   *          whether to use legacy gap colouring (white gaps, grey residues)
+   * @param gapCol
+   *          gap colour if not legacy
+   * @param hiddenCol
+   *          hidden region colour (transparency applied by rendering code)
+   */
+  public OverviewResColourFinder(boolean useLegacyColouring, Color gapCol,
+          Color hiddenCol)
+  {
+    if (useLegacyColouring)
+    {
+      GAP_COLOUR = Color.white;
+      RESIDUE_COLOUR = Color.lightGray;
+      HIDDEN_COLOUR = hiddenCol;
+    }
+    else
+    {
+      GAP_COLOUR = gapCol;
+      RESIDUE_COLOUR = Color.white;
+      HIDDEN_COLOUR = hiddenCol;
+    }
+  }
 
   @Override
   public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
   {
-    Color resBoxColour = Color.white;
+    Color resBoxColour = RESIDUE_COLOUR;
     char currentChar = seq.getCharAt(i);
 
     // In the overview window, gaps are coloured grey, unless the colour scheme
@@ -82,4 +125,14 @@ public class OverviewResColourFinder extends ResidueColourFinder
 
     return getBoxColour(currentShader, seq, i);
   }
+
+  /**
+   * Supply hidden colour
+   * 
+   * @return colour of hidden regions
+   */
+  protected Color getHiddenColour()
+  {
+    return HIDDEN_COLOUR;
+  }
 }