From 43aba7eb2064785994c924ab4667ec3a1f7e45c0 Mon Sep 17 00:00:00 2001 From: "j.procter@dundee.ac.uk" Date: Tue, 8 Jul 2014 15:16:49 -0400 Subject: [PATCH] JAL-1333 allow reuse of existing viewers (of a specified or currently preferred type) --- src/jalview/gui/StructureViewer.java | 40 ++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index e307aa9..ccb3c18 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -68,16 +68,40 @@ public class StructureViewer { return viewStructures(getViewerType(), ap, pr, collateForPDB); } - public JalviewStructureDisplayI viewStructures(Viewer viewerType,AlignmentPanel ap, - PDBEntry[] pr, SequenceI[][] collateForPDB) + + public JalviewStructureDisplayI viewStructures(Viewer viewerType, + AlignmentPanel ap, PDBEntry[] pr, SequenceI[][] collateForPDB) { JalviewStructureDisplayI sview = null; - if (viewerType.equals(Viewer.JMOL)){ + if (viewerType.equals(Viewer.JMOL)) + { sview = new AppJmol(ap, pr, ap.av.collateForPDB(pr)); - } else - if (viewerType.equals(Viewer.CHIMERA)) { + } + else if (viewerType.equals(Viewer.CHIMERA)) + { sview = new ChimeraViewFrame(ap, pr, ap.av.collateForPDB(pr)); - }else + } + else + { + Cache.log.error("Unknown structure viewer type " + + getViewerType().toString()); + } + return sview; + } + + public JalviewStructureDisplayI viewStructures(Viewer viewerType, + AlignmentPanel ap, PDBEntry pr, SequenceI[] collateForPDB) + { + JalviewStructureDisplayI sview = null; + if (viewerType.equals(Viewer.JMOL)) + { + sview = new AppJmol(pr, collateForPDB, null, ap); + } + else if (viewerType.equals(Viewer.CHIMERA)) + { + sview = new ChimeraViewFrame(pr, collateForPDB, null, ap); + } + else { Cache.log.error("Unknown structure viewer type " + getViewerType().toString()); @@ -88,9 +112,7 @@ public class StructureViewer public JalviewStructureDisplayI viewStructures(PDBEntry pdb, SequenceI[] sequenceIs, Object object, AlignmentPanel ap) { - return viewStructures(ap, new PDBEntry[] - { pdb }, new SequenceI[][] - { sequenceIs }); + return viewStructures(getViewerType(), ap, pdb, sequenceIs); } public JalviewStructureDisplayI createView(Viewer jmol, String[] pdbf, -- 1.7.10.2