import jalview.datamodel.AlignmentI;
import jalview.gui.AlignFrame;
import jalview.gui.SplitFrame;
-import jalview.io.AppletFormatAdapter;
import jalview.io.DataSourceType;
import jalview.io.FileFormatException;
import jalview.io.FileFormatI;
// 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";
// 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);
import java.net.URL;
import java.util.zip.GZIPInputStream;
+import javajs.util.Rdr;
+
/**
* implements a random access wrapper around a particular datasource, for
* passing to identifyFile and AlignFile objects.
}
}
}
+ else if (sourceType == DataSourceType.LOCALURL)
+ {
+ String data = null;
+ /**
+ * BH 2018 hack for no support for access-origin
+ *
+ * @j2sNative
+ *
+ * data = $.ajax({url:fileStr, async:false}).responseText;
+ *
+ */
+
+ System.out.println(data);
+ dataIn = Rdr.getBR(data);
+ dataName = fileStr;
+
+ }
else if (sourceType == DataSourceType.URL)
{
try