JAL-1620 version bump and release notes
[jalview.git] / src / jalview / gui / SequenceRenderer.java
index 86c8490..7e39a8c 100755 (executable)
@@ -1,26 +1,33 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.gui;
 
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
 
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
 
 /**
  * DOCUMENT ME!
@@ -28,7 +35,7 @@ import jalview.schemes.*;
  * @author $author$
  * @version $Revision$
  */
-public class SequenceRenderer
+public class SequenceRenderer implements jalview.api.SequenceRenderer
 {
   AlignViewport av;
 
@@ -80,7 +87,7 @@ public class SequenceRenderer
 
   public Color getResidueBoxColour(SequenceI seq, int i)
   {
-    allGroups = av.alignment.findAllGroups(seq);
+    allGroups = av.getAlignment().findAllGroups(seq);
 
     if (inCurrentSequenceGroup(i))
     {
@@ -91,7 +98,7 @@ public class SequenceRenderer
     }
     else if (av.getShowBoxes())
     {
-      getBoxColour(av.globalColourScheme, seq, i);
+      getBoxColour(av.getGlobalColourScheme(), seq, i);
     }
 
     return resBoxColour;
@@ -111,7 +118,7 @@ public class SequenceRenderer
   {
     if (cs != null)
     {
-      resBoxColour = cs.findColour(seq.getCharAt(i), i);
+      resBoxColour = cs.findColour(seq.getCharAt(i), i, seq);
     }
     else if (forOverview
             && !jalview.util.Comparison.isGap(seq.getCharAt(i)))
@@ -205,7 +212,7 @@ public class SequenceRenderer
         }
         else if (av.getShowBoxes())
         {
-          getBoxColour(av.globalColourScheme, seq, i);
+          getBoxColour(av.getGlobalColourScheme(), seq, i);
         }
 
       }
@@ -325,10 +332,11 @@ public class SequenceRenderer
           {
             graphics.setColor(currentSequenceGroup.textColour);
           }
-          if (currentSequenceGroup.getShowunconserved()) // todo optimize
+          if (currentSequenceGroup.getShowNonconserved()) // todo optimize
           {
             // todo - use sequence group consensus
-            s = getDisplayChar(av.consensus, i, s, '.');
+            s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s,
+                    '.');
 
           }
 
@@ -343,7 +351,7 @@ public class SequenceRenderer
           if (av.getColourText())
           {
             getboxColour = true;
-            getBoxColour(av.globalColourScheme, seq, i);
+            getBoxColour(av.getGlobalColourScheme(), seq, i);
 
             if (av.getShowBoxes())
             {
@@ -359,7 +367,7 @@ public class SequenceRenderer
           {
             if (!getboxColour)
             {
-              getBoxColour(av.globalColourScheme, seq, i);
+              getBoxColour(av.getGlobalColourScheme(), seq, i);
             }
 
             if (resBoxColour.getRed() + resBoxColour.getBlue()
@@ -368,9 +376,10 @@ public class SequenceRenderer
               graphics.setColor(av.textColour2);
             }
           }
-          if (av.showUnconserved)
+          if (av.getShowUnconserved())
           {
-            s = getDisplayChar(av.consensus, i, s, '.');
+            s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s,
+                    '.');
 
           }
 
@@ -466,10 +475,8 @@ public class SequenceRenderer
         }
 
         charOffset = (av.charWidth - fm.charWidth(s)) / 2;
-        graphics
-                .drawString(String.valueOf(s), charOffset + x1
-                        + (av.charWidth * (i - start)),
-                        (y1 + av.charHeight) - pady);
+        graphics.drawString(String.valueOf(s), charOffset + x1
+                + (av.charWidth * (i - start)), (y1 + av.charHeight) - pady);
       }
     }
   }