X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Frenderer%2FOverviewResColourFinder.java;h=ef4d04b50525761bcc6e0b42fff60bbe8e01422d;hb=2bb9cad4fa36d64cebbe09bc63732e8dbb4dcb32;hp=07fc6e3d9405889df90ff959fe7e510393743343;hpb=69dbb53dd5e77aed29eeea737414ebe2d74cebd4;p=jalview.git diff --git a/src/jalview/renderer/OverviewResColourFinder.java b/src/jalview/renderer/OverviewResColourFinder.java index 07fc6e3..ef4d04b 100644 --- a/src/jalview/renderer/OverviewResColourFinder.java +++ b/src/jalview/renderer/OverviewResColourFinder.java @@ -20,63 +20,60 @@ */ package jalview.renderer; +import java.awt.Color; + import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.util.Comparison; -import java.awt.Color; - public class OverviewResColourFinder extends ResidueColourFinder { - final Color GAP_COLOUR; // default colour to use at gaps - - final Color RESIDUE_COLOUR; // default colour to use at residues + /* + * colour for gaps (unless overridden by colour scheme) + * - as set in Preferences, _or_ read from a project file + */ + Color gapColour; - final Color HIDDEN_COLOUR; // colour for hidden regions + /* + * colour for residues if no colour scheme set (before feature colouring) + * - as set in Preferences, _or_ read from a project file + */ + Color residueColour; - boolean useLegacy = false; + /* + * colour for hidden regions + * - as set in Preferences, _or_ read from a project file + */ + Color hiddenColour; /** * Constructor without colour settings (used by applet) + * @deprecated */ + @Deprecated public OverviewResColourFinder() { - GAP_COLOUR = Color.lightGray; - RESIDUE_COLOUR = Color.white; - HIDDEN_COLOUR = Color.DARK_GRAY.darker(); + this(Color.lightGray, Color.white, Color.darkGray.darker()); } /** - * Constructor with colour settings + * Constructor given default colours for gaps, residues and hidden regions * - * @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) + * @param gaps + * @param residues + * @param hidden */ - public OverviewResColourFinder(boolean useLegacyColouring, Color gapCol, - Color hiddenCol) + public OverviewResColourFinder(Color gaps, Color residues, Color hidden) { - if (useLegacyColouring) - { - GAP_COLOUR = Color.white; - RESIDUE_COLOUR = Color.lightGray; - HIDDEN_COLOUR = hiddenCol; - } - else - { - GAP_COLOUR = gapCol; - RESIDUE_COLOUR = Color.white; - HIDDEN_COLOUR = hiddenCol; - } + gapColour = gaps; + residueColour = residues; + hiddenColour = hidden; } @Override public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i) { - Color resBoxColour = RESIDUE_COLOUR; + Color resBoxColour = residueColour; char currentChar = seq.getCharAt(i); // In the overview window, gaps are coloured grey, unless the colour scheme @@ -84,10 +81,10 @@ public class OverviewResColourFinder extends ResidueColourFinder // settings if (shader.getColourScheme() != null) { - if (!shader.getColourScheme().hasGapColour() - && Comparison.isGap(currentChar)) + if (Comparison.isGap(currentChar) + && (!shader.getColourScheme().hasGapColour())) { - resBoxColour = GAP_COLOUR; + resBoxColour = gapColour; } else { @@ -96,7 +93,7 @@ public class OverviewResColourFinder extends ResidueColourFinder } else if (Comparison.isGap(currentChar)) { - resBoxColour = GAP_COLOUR; + resBoxColour = gapColour; } return resBoxColour; @@ -108,8 +105,8 @@ 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, @@ -127,12 +124,34 @@ public class OverviewResColourFinder extends ResidueColourFinder } /** - * Supply hidden colour + * Returns the colour used for hidden regions + * + * @return + */ + public Color getHiddenColour() + { + return hiddenColour; + } + + /** + * Returns the colour used for gaps, if not overridden by the alignment colour + * scheme + * + * @return + */ + public Color getGapColour() + { + return gapColour; + } + + /** + * Returns the colour used for residues (before applying any feature + * colouring) if there is no alignment colour scheme * - * @return colour of hidden regions + * @return */ - protected Color getHiddenColour() + public Color getResidueColour() { - return HIDDEN_COLOUR; + return residueColour; } }