+ for (AlignmentViewPanel avp : cra_views)
+ {
+
+ SequenceI[] xrseqs = avp.getAlignment().getSequencesArray();
+ nextxref = first + " -> " + db + "{" + p++ + "}";
+
+ viewsourcedb.put(avp, nextxref);
+ stringify(dbtoviewBit, savedProjects, nextxref, avp);
+ keyseq.add(nextxref);
+
+ List<String> xrptypes = (seqs == null || seqs.length == 0) ? null
+ : new CrossRef(xrseqs, dataset)
+ .findXrefSourcesForSequences(avp
+ .getAlignViewport().isNucleotide());
+ for (String xrefdb : xrptypes)
+ {
+ pass3 = 0;
+ do // 3rd cross ref and recover crossref loop
+ {
+ List<AlignmentViewPanel> cra_views2 = new ArrayList<AlignmentViewPanel>();
+ int q = 0;
+ String nextnextxref = "{" + p + "}" + nextxref + " -> "
+ + xrefdb + "{" + q + "}";
+
+ AlignFrame nextaf = Desktop.getAlignFrameFor(avp
+ .getAlignViewport());
+ if (pass3 == 0)
+ {
+
+ cra = new CrossRefAction(nextaf, xrseqs, avp
+ .getAlignViewport().isNucleotide(), xrefdb);
+ cra.run();
+ Assert.assertTrue(cra.getXrefViews().size() > 0,
+ "No crossrefs found for '" + nextxref + "' to "
+ + xrefdb + " via '" + nextaf.getTitle()
+ + "'");
+ cra_views2 = cra.getXrefViews();
+ }
+ else
+ {
+ Desktop.instance.closeAll_actionPerformed(null);
+ // recover stored project
+ AlignFrame af2 = new FileLoader(false)
+ .LoadFileWaitTillLoaded(
+ savedProjects.get(nextnextxref)
+ .toString(), FormatAdapter.FILE);
+ // gymnastics to recover the alignPanel/Complementary
+ // alignPanel
+ if (af2.getViewport().isNucleotide())
+ {
+ // top view, then bottom
+ cra_views2.add(af2.getViewport().getAlignPanel());
+ cra_views2.add(((jalview.gui.AlignViewport) af2
+ .getViewport().getCodingComplement())
+ .getAlignPanel());
+
+ }
+ else
+ {
+ // bottom view, then top
+ cra_views2.add(((jalview.gui.AlignViewport) af2
+ .getViewport().getCodingComplement())
+ .getAlignPanel());
+ cra_views2.add(af2.getViewport().getAlignPanel());
+ }
+ Assert.assertEquals(cra_views2.size(), 2);
+ Assert.assertNotNull(cra_views2.get(0));
+ Assert.assertNotNull(cra_views2.get(1));
+ }
+
+ for (AlignmentViewPanel nextavp : cra_views2)
+ {
+ nextnextxref = "{" + p + "}" + nextxref + " -> "
+ + xrefdb + "{" + q++ + "}";
+ viewsourcedb.put(nextavp, nextnextxref);
+ stringify(dbtoviewBit, savedProjects, nextnextxref,
+ nextavp);
+ keyseq.add(nextnextxref);
+ }
+ } while (pass3++ < 2 && pass2 < 1);
+ }
+ }
+ } while (pass2++ < 2 && pass1 < 1);