2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.renderer;
23 import jalview.datamodel.SequenceGroup;
24 import jalview.datamodel.SequenceI;
25 import jalview.util.Comparison;
27 import java.awt.Color;
29 public class OverviewResColourFinder extends ResidueColourFinder
31 final Color GAP_COLOUR = new Color(240, 240, 240);
34 public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
36 Color resBoxColour = Color.white;
37 char currentChar = seq.getCharAt(i);
39 // In the overview window, gaps are coloured grey, unless the colour scheme
40 // specifies a gap colour, in which case gaps honour the colour scheme
42 if (shader.getColourScheme() != null)
44 if (Comparison.isGap(currentChar)
45 && !shader.getColourScheme().hasGapColour())
47 resBoxColour = GAP_COLOUR;
51 resBoxColour = shader.findColour(currentChar, i, seq);
54 else if (Comparison.isGap(currentChar))
56 resBoxColour = GAP_COLOUR;
63 * {@inheritDoc} In the overview, the showBoxes setting is ignored, as the
64 * overview displays the colours regardless.
67 protected Color getResidueBoxColour(boolean showBoxes,
68 ResidueShaderI shader,
69 SequenceGroup[] allGroups, SequenceI seq, int i)
71 ResidueShaderI currentShader;
72 SequenceGroup currentSequenceGroup = getCurrentSequenceGroup(allGroups,
74 if (currentSequenceGroup != null)
76 currentShader = currentSequenceGroup.getGroupColourScheme();
80 currentShader = shader;
83 return getBoxColour(currentShader, seq, i);