From 18669497085ed86d73c77eb2f076943980bbc508 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 24 Oct 2012 17:04:11 +0100 Subject: [PATCH] JAL-1193 call setLoadingFromArchiveFinished(true) for any new structure views, but only after all windows have been loaded and gathered --- src/jalview/gui/Jalview2XML.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index b4bc3c7..41dd71d 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1670,6 +1670,8 @@ public class Jalview2XML try { + // create list to store references for any new Jmol viewers created + newStructureViewers=new Vector(); // 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 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, -- 1.7.10.2