Don't parse input id, leave it as it is
[jalview.git] / src / jalview / appletgui / IdCanvas.java
index 8b6939e..9773019 100755 (executable)
@@ -21,7 +21,6 @@ package jalview.appletgui;
 \r
 import java.awt.*;\r
 \r
-import jalview.analysis.*;\r
 import jalview.datamodel.*;\r
 \r
 public class IdCanvas\r
@@ -55,7 +54,7 @@ public class IdCanvas
     if (searchResults != null && searchResults.contains(s))\r
     {\r
       gg.setColor(Color.black);\r
-      gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+      gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
                   getSize().width, charHeight);\r
       gg.setColor(Color.white);\r
     }\r
@@ -63,26 +62,21 @@ public class IdCanvas
              av.getSelectionGroup().sequences.contains(s))\r
     {\r
       gg.setColor(Color.lightGray);\r
-      gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+      gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
                   getSize().width, charHeight);\r
       gg.setColor(Color.white);\r
     }\r
     else\r
     {\r
       gg.setColor(s.getColor());\r
-      gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+      gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
                   getSize().width, charHeight);\r
       gg.setColor(Color.black);\r
     }\r
 \r
-    String string = s.getName();\r
-    if (av.getShowFullId())\r
-    {\r
-      string = s.getDisplayId();\r
-    }\r
 \r
-    gg.drawString(string, 0,\r
-                  AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos +\r
+    gg.drawString( s.getDisplayId(av.getShowJVSuffix()), 0,\r
+                  ((i - starty) * charHeight) + ypos +\r
                   charHeight - (charHeight / 5));\r
 \r
   }\r
@@ -177,23 +171,51 @@ public class IdCanvas
   {\r
     Color currentColor = Color.white;\r
     Color currentTextColor = Color.black;\r
+    Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
+                             av.getFont().getSize());\r
 \r
     if (av.getWrapAlignment())\r
     {\r
+      int annotationHeight = 0;\r
+      AnnotationLabels labels = null;\r
 \r
-      int rowSize = av.getEndRes() - av.getStartRes();\r
-      // Draw the rest of the panels\r
-\r
-      for (int ypos = 2 * av.charHeight, row = av.startRes;\r
-           ypos <= getSize().height && row < av.alignment.getWidth();\r
-           ypos += av.chunkHeight, row += rowSize)\r
+      if(av.showAnnotation)\r
       {\r
-        for (int i = starty; i < av.alignment.getHeight(); i++)\r
+        AnnotationPanel ap = new AnnotationPanel(av);\r
+        annotationHeight = ap.adjustPanelHeight();\r
+        labels = new AnnotationLabels(av);\r
+      }\r
+\r
+      int hgap = av.charHeight;\r
+      if (av.scaleAboveWrapped)\r
+        hgap += av.charHeight;\r
+\r
+      int cHeight = av.getAlignment().getHeight() * av.charHeight\r
+          + hgap\r
+          + annotationHeight;\r
+\r
+        int rowSize = av.getEndRes() - av.getStartRes();\r
+\r
+        // Draw the rest of the panels\r
+        for (int ypos = hgap, row = av.startRes;\r
+                (ypos <= getSize().height) && (row < av.alignment.getWidth());\r
+                ypos += cHeight, row += rowSize)\r
         {\r
-          SequenceI s = av.alignment.getSequenceAt(i);\r
-          drawIdString(gg, s, i, 0, ypos);\r
+            for (int i = starty; i < av.alignment.getHeight(); i++)\r
+            {\r
+                SequenceI s = av.alignment.getSequenceAt(i);\r
+                drawIdString(gg, s, i, 0, ypos);\r
+            }\r
+\r
+            if(labels!=null)\r
+            {\r
+              gg.setFont(av.getFont());\r
+              gg.translate(0, ypos+(av.getAlignment().getHeight() * av.charHeight));\r
+              labels.drawComponent(gg, getSize().width);\r
+              gg.translate(0, -ypos-(av.getAlignment().getHeight() * av.charHeight));\r
+              gg.setFont(italic);\r
+            }\r
         }\r
-      }\r
 \r
     }\r
     else\r
@@ -228,18 +250,15 @@ public class IdCanvas
         gg.setColor(currentColor);\r
 \r
         gg.fillRect(0,\r
-                    AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+                    ((i - starty) * av.charHeight),\r
                     getSize().width,\r
                     av.charHeight);\r
 \r
         gg.setColor(currentTextColor);\r
-        String string = av.alignment.getSequenceAt(i).getName();\r
-        if (av.getShowFullId())\r
-        {\r
-          string = av.alignment.getSequenceAt(i).getDisplayId();\r
-        }\r
-        gg.drawString(string, 0,\r
-                      AlignmentUtil.getPixelHeight(starty, i, av.charHeight) +\r
+\r
+        gg.drawString(av.alignment.getSequenceAt(i)\r
+            .getDisplayId(av.getShowJVSuffix()), 0,\r
+                      ((i - starty) * av.charHeight) +\r
                       av.charHeight - (av.charHeight / 5));\r
       }\r
 \r