Tooltip for multiple graph lines updated
authoramwaterhouse <Andrew Waterhouse>
Fri, 3 Feb 2006 17:43:58 +0000 (17:43 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 3 Feb 2006 17:43:58 +0000 (17:43 +0000)
src/jalview/gui/AnnotationPanel.java

index e3d8de1..27ac873 100755 (executable)
@@ -539,11 +539,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
         int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
 \r
-        if ((row > -1) && (res < aa[row].annotations.length) &&\r
-                (aa[row].annotations[res] != null))\r
+        if (row > -1 && res<aa[row].annotations.length)\r
         {\r
-\r
-\r
             if(aa[row].graphGroup>-1)\r
             {\r
               StringBuffer tip = new StringBuffer("<html>");\r
@@ -552,15 +549,23 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                 if (aa[gg].graphGroup == aa[row].graphGroup && aa[gg].annotations[res]!=null)\r
                   tip.append(aa[gg].label+" "+aa[gg].annotations[res].description+"<br>" );\r
               }\r
-              tip.setLength(tip.length()-4);\r
-              this.setToolTipText(tip.toString()+"</html>");\r
+              if(tip.length()!=6)\r
+              {\r
+                tip.setLength(tip.length() - 4);\r
+                this.setToolTipText(tip.toString() + "</html>");\r
+              }\r
             }\r
-            else\r
+            else if(aa[row].annotations[res] != null)\r
               this.setToolTipText(aa[row].annotations[res].description);\r
 \r
-            StringBuffer text = new StringBuffer("Sequence position " +\r
-                    (res + 1) + "  " + aa[row].annotations[res].description);\r
-            ap.alignFrame.statusBar.setText(text.toString());\r
+            if(aa[row].annotations[res]!=null)\r
+            {\r
+              StringBuffer text = new StringBuffer("Sequence position " +\r
+                                                   (res + 1) + "  " +\r
+                                                   aa[row].annotations[res].description);\r
+\r
+              ap.alignFrame.statusBar.setText(text.toString());\r
+            }\r
         }\r
     }\r
 \r
@@ -711,6 +716,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
             }\r
 \r
 \r
+\r
             if (row.graph>0)\r
             {\r
                 if(row.graphGroup>-1 && graphGroupDrawn[ row.graphGroup ] )\r
@@ -856,7 +862,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                 case 'E':\r
                     g.setColor(SHEET_COLOUR);\r
 \r
-                    if (row.annotations[endRes].secondaryStructure != 'E')\r
+                    if (row.annotations.length > endRes\r
+                        && row.annotations[endRes].secondaryStructure != 'E')\r
                     {\r
                       g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
                                  x - lastSSX[i] - 4, 7);\r
@@ -1047,6 +1054,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
       for (int j = sRes; j < eRes; j++)\r
       {\r
+\r
         if (aa.annotations[j] == null)\r
         {\r
           x += av.charWidth;\r