X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FUserColourScheme.java;h=bf62e453b4b9e6eb8cdd9aaf6df20631a33b43ff;hb=8669979d57e2019889afaefafe65b945ae7c172d;hp=d95652d3fae3442de89531c33c09d8cc3fa3a4b0;hpb=8e1be43e250107a4d86898bd554cf03098fa5957;p=jalview.git diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index d95652d..bf62e45 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -73,7 +73,7 @@ public class UserColourScheme extends ResidueColourScheme schemeName = from.schemeName; if (from.lowerCaseColours != null) { - lowerCaseColours = new Color[lowerCaseColours.length]; + lowerCaseColours = new Color[from.lowerCaseColours.length]; System.arraycopy(from.lowerCaseColours, 0, lowerCaseColours, 0, from.lowerCaseColours.length); } @@ -222,7 +222,8 @@ public class UserColourScheme extends ResidueColourScheme { lowerCaseColours = new Color[colors.length]; } - lowerCaseColours[colIndex] = ColorUtils.parseColourString(colour); + lowerCaseColours[colIndex] = ColorUtils + .parseColourString(colour); } else { @@ -232,30 +233,12 @@ public class UserColourScheme extends ResidueColourScheme } } catch (Exception ex) { - System.out.println("Error parsing userDefinedColours:\n" + token - + "\n" + ex); + System.out.println( + "Error parsing userDefinedColours:\n" + token + "\n" + ex); } } - @Override - public Color findColour(char c, int j, SequenceI seq) - { - Color colour; - int index = ResidueProperties.aaIndex[c]; - - if (lowerCaseColours != null && 'a' <= c && c <= 'z') - { - colour = lowerCaseColours[index]; - } - else - { - colour = colors[index]; - } - - return colour; - } - public void setLowerCaseColours(Color[] lcolours) { lowerCaseColours = lcolours; @@ -281,8 +264,8 @@ public class UserColourScheme extends ResidueColourScheme } /** - * Answers the customised name of the colour scheme, if it has one, else - * "User Defined" + * Answers the customised name of the colour scheme, if it has one, else "User + * Defined" */ @Override public String getSchemeName() @@ -291,7 +274,7 @@ public class UserColourScheme extends ResidueColourScheme { return schemeName; } - return "User Defined"; + return ResidueColourScheme.USER_DEFINED; } /** @@ -304,7 +287,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++) { @@ -337,7 +320,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; @@ -367,4 +350,10 @@ public class UserColourScheme extends ResidueColourScheme Collections.sort(residueColours); return StringUtils.listToDelimitedString(residueColours, ";"); } + + @Override + public boolean hasGapColour() + { + return (findColour(' ') != null); + } }