First attempt to install hidden regions
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index 3a4a197..69ae398 100755 (executable)
@@ -363,20 +363,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                 }\r
                 else if(aa[i].graph>0)\r
                 {\r
-                  if(SwingUtilities.isRightMouseButton(evt)\r
-                      && aa[i].graphLines!=null\r
-                       && aa[i].graphLines.size()>0)\r
-                  {\r
-                    SliderPanel sp = new SliderPanel(aa[i], ap);\r
-                    return;\r
-                  }\r
-                  else\r
-                  {\r
                     //Stretch Graph\r
                     graphStretch = i;\r
                     graphStretchY = evt.getY();\r
                     activeRes = null;\r
-                  }\r
                 }\r
                 else\r
                 {\r
@@ -539,11 +529,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 +539,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
@@ -622,7 +617,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
      */\r
     public void fastPaint(int horizontal)\r
     {\r
-        if ((horizontal == 0) ||\r
+        if ((horizontal == 0) || gg==null ||\r
                 (av.alignment.getAlignmentAnnotation() == null) ||\r
                 (av.alignment.getAlignmentAnnotation().length < 1))\r
         {\r
@@ -711,6 +706,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 +852,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[endRes] !=null\r
+                        && row.annotations[endRes].secondaryStructure != 'E')\r
                     {\r
                       g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
                                  x - lastSSX[i] - 4, 7);\r
@@ -971,21 +968,18 @@ public class AnnotationPanel extends JPanel implements MouseListener,
       g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);\r
 \r
 \r
-      if(aa.graphLines!=null)\r
+      if(aa.threshold!=null)\r
       {\r
-        for(int l=0; l<aa.graphLines.size(); l++)\r
-        {\r
-          g.setColor(aa.getGraphLine(l).colour);\r
+          g.setColor(aa.threshold.colour);\r
           Graphics2D g2 = (Graphics2D)g;\r
           g2.setStroke(new BasicStroke(1,\r
                                         BasicStroke.CAP_SQUARE,\r
                                         BasicStroke.JOIN_ROUND, 3f,\r
                                         new float[] { 5f, 3f }, 0f));\r
 \r
-          y2 = (int)(y - ((aa.getGraphLine(l).value-min) / range)*graphHeight);\r
+          y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);\r
           g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);\r
           g2.setStroke(new BasicStroke());\r
-        }\r
       }\r
 \r
       eRes = Math.min(eRes, aa.annotations.length);\r
@@ -1016,21 +1010,18 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
       float range = max - min;\r
 \r
-      if(aa.graphLines!=null)\r
+      if(aa.threshold!=null)\r
       {\r
-        for(int l=0; l<aa.graphLines.size(); l++)\r
-        {\r
-          g.setColor(aa.getGraphLine(l).colour);\r
+          g.setColor(aa.threshold.colour);\r
           Graphics2D g2 = (Graphics2D)g;\r
           g2.setStroke(new BasicStroke(1,\r
                                         BasicStroke.CAP_SQUARE,\r
                                         BasicStroke.JOIN_ROUND, 3f,\r
                                         new float[] { 5f, 3f }, 0f));\r
 \r
-          y2 = (int)(y - ((aa.getGraphLine(l).value-min) / range)*aa.graphHeight);\r
+          y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);\r
           g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);\r
           g2.setStroke(new BasicStroke());\r
-        }\r
       }\r
 \r
       y1 = y2 = y;\r
@@ -1039,13 +1030,15 @@ public class AnnotationPanel extends JPanel implements MouseListener,
         y2 = (int)(y - (0-min / (range))*aa.graphHeight);\r
 \r
       g.setColor(Color.gray);\r
-      g.drawLine(x,y2,eRes*av.charWidth,y2);\r
+\r
+      g.drawLine(x,y2,(eRes-sRes+1)*av.charWidth,y2);\r
 \r
       eRes = Math.min(eRes, aa.annotations.length-1);\r
 \r
 \r
       for (int j = sRes; j < eRes; j++)\r
       {\r
+\r
         if (aa.annotations[j] == null)\r
         {\r
           x += av.charWidth;\r