From 18e6142e442c42442429c12ff48c7d637b855dca Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 25 Apr 2014 14:26:04 +0100 Subject: [PATCH] JAL-1177 patches to loader to cope with dataset only jalview xml documents --- src/jalview/gui/Jalview2XML.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 5f9a131..3499f6d 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1836,7 +1836,7 @@ public class Jalview2XML frefedSequence = new Vector(); } - jalview.gui.AlignFrame af = null; + jalview.gui.AlignFrame af= null,_af = null; Hashtable gatherToThisFrame = new Hashtable(); final String file = jprovider.getFilename(); try @@ -1863,10 +1863,15 @@ public class Jalview2XML object = (JalviewModel) unmar.unmarshal(in); if (true) // !skipViewport(object)) { - af = LoadFromObject(object, file, true, jprovider); - if (af.viewport.gatherViewsHere) + _af = LoadFromObject(object, file, true, jprovider); + if (object.getJalviewModelSequence().getViewportCount() > 0) { - gatherToThisFrame.put(af.viewport.getSequenceSetId(), af); + af = _af; + if (object.getJalviewModelSequence().getViewportCount() > 1 + && af.viewport.gatherViewsHere) + { + gatherToThisFrame.put(af.viewport.getSequenceSetId(), af); + } } } entryCount++; @@ -2089,7 +2094,8 @@ public class Jalview2XML JalviewModelSequence jms = object.getJalviewModelSequence(); - Viewport view = jms.getViewport(0); + Viewport view = (jms.getViewportCount()>0) ? jms.getViewport(0) : null; + // //////////////////////////////// // LOAD SEQUENCES @@ -2614,7 +2620,11 @@ public class Jalview2XML } } - + if (view==null) + { + // only dataset in this model, so just return. + return null; + } // /////////////////////////////// // LOAD VIEWPORT -- 1.7.10.2