Merge branch 'develop' into features/JAL-2360colourSchemeApplicability
[jalview.git] / src / jalview / schemes / AnnotationColourGradient.java
index 133dd36..fb1443d 100755 (executable)
@@ -53,16 +53,18 @@ public class AnnotationColourGradient extends FollowerColourScheme
   private boolean predefinedColours = false;
 
   private boolean seqAssociated = false;
+
   /**
    * false if the scheme was constructed without a minColour and maxColour used
    * to decide if existing colours should be taken from annotation elements when
    * they exist
    */
   private boolean noGradient = false;
+
   IdentityHashMap<SequenceI, AlignmentAnnotation> seqannot = null;
 
   @Override
-  public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+  public ColourSchemeI getInstance(AnnotatedCollectionI sg,
           Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
   {
     AnnotationColourGradient acg = new AnnotationColourGradient(annotation,
@@ -175,7 +177,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
       // resolve the context containing all the annotation for the sequence
       AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment
               : alignment.getContext();
-      boolean f = true,rna=false;
+      boolean f = true, rna = false;
       for (AlignmentAnnotation alan : alcontext.findAnnotation(annotation
               .getCalcId()))
       {
@@ -207,6 +209,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
   }
 
   float aamin = 0f, aamax = 0f;
+
   public String getAnnotation()
   {
     return annotation.label;
@@ -247,6 +250,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
    * 
    * @return DOCUMENT ME!
    */
+  @Override
   public Color findColour(char c)
   {
     return Color.red;
@@ -266,8 +270,8 @@ public class AnnotationColourGradient extends FollowerColourScheme
   public Color findColour(char c, int j, SequenceI seq)
   {
     Color currentColour = Color.white;
-    AlignmentAnnotation annotation = (seqAssociated && seqannot!=null ? seqannot.get(seq)
-            : this.annotation);
+    AlignmentAnnotation annotation = (seqAssociated && seqannot != null ? seqannot
+            .get(seq) : this.annotation);
     if (annotation == null)
     {
       return currentColour;
@@ -396,6 +400,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
     return new Color(dr, dg, db);
 
   }
+
   public boolean isPredefinedColours()
   {
     return predefinedColours;
@@ -415,4 +420,16 @@ public class AnnotationColourGradient extends FollowerColourScheme
   {
     seqAssociated = sassoc;
   }
+
+  @Override
+  public String getSchemeName()
+  {
+    return "Annotation";
+  }
+
+  @Override
+  public boolean isSimple()
+  {
+    return false;
+  }
 }