JAL-1193 call setLoadingFromArchiveFinished(true) for any new structure views, but...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Wed, 24 Oct 2012 16:04:11 +0000 (17:04 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Wed, 24 Oct 2012 16:04:11 +0000 (17:04 +0100)
src/jalview/gui/Jalview2XML.java

index b4bc3c7..41dd71d 100644 (file)
@@ -1670,6 +1670,8 @@ public class Jalview2XML
 
     try
     {
+      // create list to store references for any new Jmol viewers created
+      newStructureViewers=new Vector<AppJmol>();
       // UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING
       // Workaround is to make sure caller implements the JarInputStreamProvider
       // interface
@@ -1677,6 +1679,7 @@ public class Jalview2XML
 
       jarInputStreamProvider jprovider = createjarInputStreamProvider(file);
       af = LoadJalviewAlign(jprovider);
+      setLoadingFinishedForNewStructureViewers();
     } catch (MalformedURLException e)
     {
       errorMessage = "Invalid URL format for '" + file + "'";
@@ -2969,6 +2972,7 @@ public class Jalview2XML
                       sview = new AppJmol(pdbf, id, sq, alf.alignPanel,
                               useinJmolsuperpos, usetoColourbyseq,
                               jmolColouring, fileloc, rect, vid);
+                      addNewStructureViewer(sview);
                     } catch (OutOfMemoryError ex)
                     {
                       new OOMWarning("restoring structure view for PDB id "
@@ -3038,6 +3042,27 @@ public class Jalview2XML
     // and finally return.
     return af;
   }
+  Vector<AppJmol> newStructureViewers=null;
+  protected void addNewStructureViewer(AppJmol sview)
+  {
+    if (newStructureViewers!=null)
+    {
+      sview.jmb.setFinishedLoadingFromArchive(false);
+      newStructureViewers.add(sview);
+    }
+  }
+  protected void setLoadingFinishedForNewStructureViewers()
+  {
+    if (newStructureViewers!=null)
+    {
+      for (AppJmol sview:newStructureViewers)
+      {
+        sview.jmb.setFinishedLoadingFromArchive(true);
+      }
+      newStructureViewers.clear();
+      newStructureViewers=null;
+    }
+  }
 
   AlignFrame loadViewport(String file, JSeq[] JSEQ, Vector hiddenSeqs,
           Alignment al, JalviewModelSequence jms, Viewport view,