Jalview-JS/JAL-3253-applet more argument parsing
[jalview.git] / src / jalview / bin / Jalview.java
index b39f0e2..c27d7af 100755 (executable)
@@ -510,18 +510,18 @@ public class Jalview implements ApplicationSingletonI
       }
     }
 
-
     // script to execute after all loading is
     // completed one way or another
     // extract groovy argument and execute if necessary
     String groovyscript = (isJS ? null
             : aparser.getValue(ArgsParser.GROOVY, true));
     String file = aparser.getValue(ArgsParser.OPEN, true);
-    String file2 = (isJavaAppletTag ? aparser.getAppletValue("file2", null)
-            : null);
+    // BH this here to allow split frame; not working as of 5/17/2019
+    String file2 = aparser.getValue(ArgsParser.OPEN2, true);
     String fileFormat = (isJavaAppletTag
             ? aparser.getAppletValue("format", null)
             : null);
+
     FileFormatI format = null;
     DataSourceType protocol = null;
 
@@ -533,6 +533,22 @@ public class Jalview implements ApplicationSingletonI
     boolean haveImport = checkStartVamas(aparser);
     // Finally, deal with the remaining input data.
     long progress = -1;
+    if (file == null && isJavaAppletTag)
+    {
+      // Maybe the sequences are added as parameters
+      StringBuffer data = new StringBuffer("PASTE");
+      int i = 1;
+      while ((file = aparser.getAppletValue("sequence" + i, null)) != null)
+      {
+        data.append(file.toString() + "\n");
+        i++;
+      }
+      if (data.length() > 5)
+      {
+        file = data.toString();
+      }
+    }
+
     if (file != null)
     {
       if (!headless)
@@ -582,8 +598,7 @@ public class Jalview implements ApplicationSingletonI
       }
 
       AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
-              protocol,
-              format);
+              protocol, format);
       if (af == null)
       {
         System.out.println("error");
@@ -602,9 +617,8 @@ public class Jalview implements ApplicationSingletonI
           {
             // TODO ?
           }
-          AlignFrame af2 = new FileLoader(!headless).loadFileWaitTillLoaded(
-                  file2,
-                  protocol, format);
+          AlignFrame af2 = new FileLoader(!headless)
+                  .loadFileWaitTillLoaded(file2, protocol, format);
           if (af2 == null)
           {
             System.out.println("error");
@@ -615,6 +629,8 @@ public class Jalview implements ApplicationSingletonI
                     af.getViewport().getAlignment(),
                     af2.getViewport().getAlignment(), "",
                     AlignViewport.SPLIT_FRAME);
+            System.out.println(
+                    "CMD [-open2 " + file2 + "] executed successfully!");
           }
         }
 
@@ -792,8 +808,7 @@ public class Jalview implements ApplicationSingletonI
       }
 
       startUpAlframe = new FileLoader(!headless)
-              .loadFileWaitTillLoaded(file, protocol,
-              format);
+              .loadFileWaitTillLoaded(file, protocol, format);
       // extract groovy arguments before anything else.
     }