Applet reads in annotation files
[jalview.git] / src / jalview / appletgui / SequenceRenderer.java
index c413588..889df36 100755 (executable)
@@ -44,11 +44,24 @@ public class SequenceRenderer
     renderGaps = b;\r
   }\r
 \r
-  public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
+  public Color getResidueBoxColour(SequenceI seq, int i)\r
   {\r
-    getBoxColour(cs, seq, i);\r
+    allGroups = av.alignment.findAllGroups(seq);\r
+\r
+    if (inCurrentSequenceGroup(i))\r
+    {\r
+      if (currentSequenceGroup.getDisplayBoxes())\r
+      {\r
+        getBoxColour(currentSequenceGroup.cs, seq, i);\r
+      }\r
+    }\r
+    else if (av.getShowBoxes())\r
+    {\r
+        getBoxColour(av.globalColourScheme, seq, i);\r
+    }\r
+\r
     return resBoxColour;\r
-  }\r
+    }\r
 \r
   void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
   {\r
@@ -62,6 +75,13 @@ public class SequenceRenderer
     }\r
   }\r
 \r
+  public Color findSequenceColour(SequenceI seq, int i)\r
+  {\r
+    allGroups = av.alignment.findAllGroups(seq);\r
+    drawBoxes(seq, i,i, 0, 0, 1,1);\r
+    return resBoxColour;\r
+  }\r
+\r
   public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
                            int start, int end, int x1, int y1, int width,\r
                            int height)\r
@@ -134,22 +154,22 @@ public class SequenceRenderer
   public void drawText(SequenceI seq, int start, int end, int x1, int y1,\r
                        int width, int height)\r
   {\r
-    int pady = height / 5;\r
-    int charOffset = 0;\r
-    char s=' ';\r
-    // Need to find the sequence position here.\r
 \r
-    String sequence = seq.getSequence();\r
+    y1 += height - height / 5;  // height/5 replaces pady\r
+\r
+    int charOffset = 0;\r
 \r
+    // Need to find the sequence position here.\r
     if(end+1>=seq.getLength())\r
           end = seq.getLength()-1;\r
 \r
+    char s = ' ';\r
+\r
     for (int i = start; i <= end; i++)\r
     {\r
       graphics.setColor(Color.black);\r
 \r
-      s = sequence.charAt(i);\r
-\r
+      s = seq.getCharAt(i);\r
       if (!renderGaps && jalview.util.Comparison.isGap(s))\r
       {\r
         continue;\r
@@ -191,8 +211,8 @@ public class SequenceRenderer
 \r
       charOffset = (width - fm.charWidth(s)) / 2;\r
       graphics.drawString(String.valueOf(s),\r
-                          charOffset + x1 + width * (i - start),\r
-                          y1 + height - pady);\r
+                         charOffset + x1 + width * (i - start),\r
+                        y1 );\r
     }\r
 \r
   }\r