JAL-3390 unit tests and command and menu refinements
[jalview.git] / src / jalview / ext / jmol / JmolCommands.java
index 35ee8d2..1340822 100644 (file)
@@ -122,31 +122,6 @@ public class JmolCommands extends StructureCommandsBase
     return FOCUS_VIEW;
   }
 
-  @Override
-  public List<StructureCommandI> showChains(List<String> toShow)
-  {
-    StringBuilder atomSpec = new StringBuilder(128);
-    boolean first = true;
-    for (String chain : toShow)
-    {
-      String[] tokens = chain.split(":");
-      if (tokens.length == 2)
-      {
-        if (!first)
-        {
-          atomSpec.append(" or ");
-        }
-        first = false;
-        atomSpec.append(":").append(tokens[1]).append(" /").append(tokens[0]);
-      }
-    }
-
-    String spec = atomSpec.toString();
-    String command = "select *;restrict " + spec + ";cartoon;center "
-            + spec;
-    return Arrays.asList(new StructureCommand(command));
-  }
-
   /**
    * Returns a command to superpose atoms in {@code atomSpec} to those in
    * {@code refAtoms}, restricted to alpha carbons only (Phosphorous for rna).
@@ -483,4 +458,28 @@ public class JmolCommands extends StructureCommandsBase
   {
     return loadFile(filepath);
   }
+
+  @Override
+  public StructureCommandI showStructures(AtomSpecModel restrictTo)
+  {
+    if (restrictTo == null)
+    {
+      return new StructureCommand("display *; cartoon only");
+    }
+    String atomSpec = getAtomSpec(restrictTo, false);
+    String cmd = "display " + atomSpec + "; select displayed; cartoon only";
+    return new StructureCommand(cmd);
+  }
+
+  @Override
+  public StructureCommandI hideChain(String modelId, String chainId)
+  {
+    return new StructureCommand("hide add :" + chainId + "/" + modelId);
+  }
+
+  @Override
+  public StructureCommandI hideAll()
+  {
+    return new StructureCommand("hide *");
+  }
 }