patches for # JAL-254 and JAL-548
authorjprocter <Jim Procter>
Tue, 1 Jun 2010 11:29:30 +0000 (11:29 +0000)
committerjprocter <Jim Procter>
Tue, 1 Jun 2010 11:29:30 +0000 (11:29 +0000)
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AnnotationLabels.java
src/jalview/gui/Jalview2XML.java

index 59d7b97..84e5efe 100755 (executable)
@@ -1343,6 +1343,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
     Hashtable oldrfs = new Hashtable();
+    if (aan != null)
+    {
     for (int an = 0; an < aan.length; an++)
     {
       if (aan[an].autoCalculated && aan[an].groupRef != null)
@@ -1352,7 +1354,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
         aan[an] = null;
       }
     }
+    }
     SequenceGroup sg;
+    if (gr != null)
+    {
     for (int g = 0; g < gr.size(); g++)
     {
       updateCalcs = false;
@@ -1379,6 +1384,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
         sg.recalcConservation();
       }
     }
+    }
     oldrfs.clear();
     adjustAnnotationHeight();
   }
index 18bda61..bd46613 100755 (executable)
@@ -153,6 +153,8 @@ public class AnnotationLabels extends JPanel implements MouseListener,
           break;
         }
       }
+    } else {
+      selectedRow = -1;
     }
   }
 
@@ -429,7 +431,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
     AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
     if (SwingUtilities.isLeftMouseButton(evt))
     {
-      if (selectedRow < aa.length)
+      if (aa!=null && selectedRow < aa.length)
       {
         if (aa[selectedRow].groupRef != null)
         {
index 22977a9..7a403a0 100755 (executable)
@@ -2946,6 +2946,7 @@ public class Jalview2XML
     // TODO: we don't need to do this if the viewport is aready visible.
     Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), view
             .getHeight());
+    af.alignPanel.updateAnnotation(false); // recompute any autoannotation
     return af;
   }