Merge branch 'Jalview-BH/JAL-3026' of https://source.jalview.org/git/jalview.git...
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 22 Jun 2018 13:49:22 +0000 (14:49 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 22 Jun 2018 13:49:22 +0000 (14:49 +0100)
1  2 
src/jalview/bin/JalviewJS.java

@@@ -3,9 -3,7 +3,8 @@@ package jalview.bin
  import jalview.analysis.AlignmentUtils;
  import jalview.datamodel.AlignmentI;
  import jalview.gui.AlignFrame;
 +import jalview.gui.Desktop;
  import jalview.gui.SplitFrame;
- import jalview.io.AppletFormatAdapter;
  import jalview.io.DataSourceType;
  import jalview.io.FileFormatException;
  import jalview.io.FileFormatI;
@@@ -35,6 -33,20 +34,20 @@@ import javax.swing.JInternalFrame
  // TODO or format as file=/examples/uniref50.fa (etc)?
  public class JalviewJS
  {
+   static
+   {
+     /**
+      * @j2sNative
+      * 
+      *            thisApplet.__Info.args =
+      *            ["file","examples/uniref50.fa","features",
+      *            "examples/exampleFeatures.txt",
+      *            "props","/Users/gmcarstairs/.jalview_properties"];
+      */
+   }
    private static final String PARAM_FILE = "file";
  
    private static final String PARAM_FILE2 = "file2";
      /*
       * convert to SplitFrame if a valid file2 is supplied
       */
 +    int height = AlignFrame.DEFAULT_HEIGHT;
      AlignFrame alignFrame2 = createAlignFrame(PARAM_FILE2);
      if (alignFrame2 != null)
      {
        if (splitFrame != null)
        {
          internalFrame = splitFrame;
 +        height *= 2;
        }
      }
  
  
      // fudge so that dialogs can be opened with this frame as parent
      // todo JAL-3031 also override Desktop.addInternalFrame etc
 -    // Desktop.parent = frame.getContentPane();
 +    Desktop.parent = frame.getContentPane();
  
      frame.pack();
 -    frame.setSize(AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
 +    frame.setSize(AlignFrame.DEFAULT_WIDTH, height);
      frame.setVisible(true);
    }
  
        // todo extract helper for protocol resolution from JalviewLite
        DataSourceType sourceType = featureFile.startsWith("http")
                ? DataSourceType.URL
-               : DataSourceType.FILE;
+               : DataSourceType.LOCALURL;
        alignFrame.parseFeaturesFile(featureFile, sourceType);
      }
    }
      String file = getParameter(fileParam);
      if (file != null)
      {
-       DataSourceType protocol = AppletFormatAdapter.checkProtocol(file);
+       DataSourceType protocol = file.startsWith("http") ? DataSourceType.URL
+               : DataSourceType.LOCALURL;
+       // DataSourceType protocol = AppletFormatAdapter.checkProtocol(file);
        FileFormatI format = new IdentifyFile().identify(file, protocol);
        FileLoader fileLoader = new FileLoader(false);
        af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format);