JAL-1270 JUnit to TestNG refactoring
[jalview.git] / src / jalview / gui / AppJmol.java
index 04235be..c2a7299 100644 (file)
@@ -57,6 +57,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
+import jalview.gui.StructureViewer.ViewerType;
 import jalview.io.AppletFormatAdapter;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
@@ -147,7 +148,9 @@ public class AppJmol extends StructureViewerBase
     PDBEntry[] pdbentrys = new PDBEntry[files.length];
     for (int i = 0; i < pdbentrys.length; i++)
     {
-      PDBEntry pdbentry = new PDBEntry(files[i], ids[i]);
+      // PDBEntry pdbentry = new PDBEntry(files[i], ids[i]);
+      PDBEntry pdbentry = new PDBEntry(ids[i], null, PDBEntry.Type.PDB,
+              files[i]);
       pdbentrys[i] = pdbentry;
     }
     // / TODO: check if protocol is needed to be set, and if chains are
@@ -647,9 +650,7 @@ public class AppJmol extends StructureViewerBase
           }
           try
           {
-            pdbseq = pdbclient.getSequenceRecords(pdbid = jmb.getPdbEntry(
-                    pi)
-                    .getId());
+            pdbseq = pdbclient.getSequenceRecords(pdbid);
           } catch (OutOfMemoryError oomerror)
           {
             new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
@@ -666,8 +667,8 @@ public class AppJmol extends StructureViewerBase
           {
             // just transfer the file name from the first sequence's first
             // PDBEntry
-            file = new File(((PDBEntry) pdbseq.getSequenceAt(0).getPDBId()
-                    .elementAt(0)).getFile()).getAbsolutePath();
+            file = new File(pdbseq.getSequenceAt(0).getPDBId()
+                    .elementAt(0).getFile()).getAbsolutePath();
             jmb.getPdbEntry(pi).setFile(file);
 
             files.append(" \"" + Platform.escapeString(file) + "\"");
@@ -842,11 +843,7 @@ public class AppJmol extends StructureViewerBase
     jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer();
     try
     {
-      for (int pdbe = 0; pdbe < jmb.getPdbCount(); pdbe++)
-      {
-        cap.appendText(jmb.printMapping(jmb.getPdbEntry(pdbe).getFile()));
-        cap.appendText("\n");
-      }
+      cap.appendText(jmb.printMappings());
     } catch (OutOfMemoryError e)
     {
       new OOMWarning(
@@ -1087,7 +1084,7 @@ public class AppJmol extends StructureViewerBase
       getSize(currentSize);
       g.getClipBounds(rectClip);
 
-      if (jmb.fileLoadingError != null)
+      if (jmb != null && jmb.fileLoadingError != null)
       {
         g.setColor(Color.black);
         g.fillRect(0, 0, currentSize.width, currentSize.height);
@@ -1238,4 +1235,10 @@ public class AppJmol extends StructureViewerBase
     return jmb == null ? null : jmb.viewer.getStateInfo();
   }
 
+  @Override
+  public ViewerType getViewerType()
+  {
+    return ViewerType.JMOL;
+  }
+
 }