public class OverviewResColourFinder extends ResidueColourFinder
{
- final int GAP_COLOUR; // default colour to use at gaps
-
- final int RESIDUE_COLOUR; // default colour to use at residues
-
- final Color HIDDEN_COLOUR; // colour for hidden regions
-
- boolean useLegacy = false;
-
public static final Color OVERVIEW_DEFAULT_GAP = Color.lightGray;
public static final Color OVERVIEW_DEFAULT_LEGACY_GAP = Color.white;
public static final Color OVERVIEW_DEFAULT_HIDDEN = Color.darkGray
.darker();
+ final Color gapColour; // colour to use for gaps
+
+ final int gapColourInt;
+
+ final Color residueColour; // colour to use for uncoloured residues
+
+ final int residueColourInt;
+
+ final Color hiddenColour; // colour for hidden regions
+
+ boolean useLegacy = false;
+
/**
* Constructor without colour settings (used by applet)
*/
{
if (useLegacyColouring)
{
- GAP_COLOUR = Color.white.getRGB();
- RESIDUE_COLOUR = Color.lightGray.getRGB();
+ gapColour = Color.white;
+ residueColour = Color.lightGray;
}
else
{
- GAP_COLOUR = gapCol.getRGB();
- RESIDUE_COLOUR = Color.white.getRGB();
+ gapColour = gapCol;
+ residueColour = Color.WHITE;
}
- HIDDEN_COLOUR = hiddenCol;
+ gapColourInt = gapColour.getRGB();
+ residueColourInt = residueColour.getRGB();
+ hiddenColour = hiddenCol;
}
@Override
- /**
- * for Test suite only.
- */
public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
{
return new Color(getBoxColourInt(shader, seq, i));
boolean isGap = Comparison.isGap(currentChar);
if (shader.getColourScheme() == null)
{
- return (isGap ? GAP_COLOUR : RESIDUE_COLOUR);
+ return (isGap ? gapColourInt : residueColourInt);
}
- return (isGap && !shader.getColourScheme().hasGapColour() ? GAP_COLOUR
+ return (isGap && !shader.getColourScheme().hasGapColour() ? gapColourInt
: shader.findColourInt(currentChar, i, seq));
}
- /**
- * For test suite only.
- */
@Override
public Color getResidueColour(boolean showBoxes, ResidueShaderI shader,
SequenceGroup[] allGroups, final SequenceI seq, int i,
FeatureColourFinder finder)
{
- return new Color(getResidueColourInt(showBoxes, shader, allGroups, seq,
- i, finder));
+ Color col = getResidueBoxColour(showBoxes, shader, allGroups, seq, i);
+
+ // if there's a FeatureColourFinder we might override the residue colour
+ // here with feature colouring
+ col = finder == null || finder.noFeaturesDisplayed() ? col
+ : finder.findFeatureColour(col, seq, i);
+ return col;
}
// 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));
+ col = finder == null || finder.noFeaturesDisplayed() ? col
+ : finder.findFeatureColourInt(col, seq, i);
+ return seq.setColor(i, col);
}
- /**
- * For test suite only.
- */
@Override
protected Color getResidueBoxColour(boolean showBoxes,
ResidueShaderI shader, SequenceGroup[] allGroups, SequenceI seq,
*/
protected Color getHiddenColour()
{
- return HIDDEN_COLOUR;
+ return hiddenColour;
}
}