From: kiramt Date: Wed, 28 Jun 2017 09:55:50 +0000 (+0100) Subject: JAL-2588 Gap colour scheme now shown in overview X-Git-Tag: Release_2_10_3b1~142^2~2^2~9^2~3^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=93661ff97ede19d69fde4e2d15f12a7e8963f084;p=jalview.git JAL-2588 Gap colour scheme now shown in overview --- diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 51b1a3a..7a1e263 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -140,7 +140,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { if (shader.getColourScheme() != null) { - if (forOverview && Comparison.isGap(seq.getCharAt(i))) + if (forOverview && Comparison.isGap(seq.getCharAt(i)) + && !shader.getColourScheme().hasGapColour()) { resBoxColour = Color.lightGray; } diff --git a/src/jalview/schemes/ColourSchemeI.java b/src/jalview/schemes/ColourSchemeI.java index f16ca21..d70b4e2 100755 --- a/src/jalview/schemes/ColourSchemeI.java +++ b/src/jalview/schemes/ColourSchemeI.java @@ -98,4 +98,11 @@ public interface ColourSchemeI * @return */ boolean isSimple(); + + /** + * Answers true if the colour scheme has a colour specified for gaps. + * + * @return + */ + boolean hasGapColour(); } diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index b47b82e..3e8daf9 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -200,4 +200,14 @@ public abstract class ResidueColourScheme implements ColourSchemeI { return true; } + + /** + * Default method returns false. Override this to return true in colour + * schemes that have a colour associated with gap residues. + */ + @Override + public boolean hasGapColour() + { + return false; + } } diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index 8e58c20..d83e9c2 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -286,7 +286,7 @@ public class UserColourScheme extends ResidueColourScheme /* * step 1: build a map from colours to the symbol(s) that have the colour */ - Map> colours = new HashMap>(); + Map> colours = new HashMap<>(); for (char symbol = 'A'; symbol <= 'Z'; symbol++) { @@ -319,7 +319,7 @@ public class UserColourScheme extends ResidueColourScheme /* * step 2: make a list of { A,G,R=12f9d6 } residues/colour specs */ - List residueColours = new ArrayList(); + List residueColours = new ArrayList<>(); for (Entry> cols : colours.entrySet()) { boolean first = true; @@ -349,4 +349,10 @@ public class UserColourScheme extends ResidueColourScheme Collections.sort(residueColours); return StringUtils.listToDelimitedString(residueColours, ";"); } + + @Override + public boolean hasGapColour() + { + return (findColour(' ') != null); + } }