*/
String fileName = null;
+ File fileObject;
+
/**
* Creates a new AlignFrame object with specific width and height.
*
setFileFormat(format);
reload.setEnabled(true);
}
+
+ /**
+ * JavaScript will have this, maybe others. More dependable than a file name
+ * and maintains a reference to the actual bytes loaded.
+ *
+ * @param file
+ */
+ public void setFileObject(File file) {
+ this.fileObject = file;
+ }
/**
* Add a KeyListener with handlers for various KeyPressed and KeyReleased
FileLoader loader = new FileLoader();
DataSourceType protocol = fileName.startsWith("http:")
- ? DataSourceType.URL
- : DataSourceType.FILE;
+ ? DataSourceType.URL : DataSourceType.FILE;
loader.LoadFile(viewport, fileName, protocol, currentFileFormat);
}
else
Rectangle bounds = this.getBounds();
FileLoader loader = new FileLoader();
- DataSourceType protocol = fileName.startsWith("http:")
- ? DataSourceType.URL
- : DataSourceType.FILE;
- AlignFrame newframe = loader.LoadFileWaitTillLoaded(fileName,
- protocol, currentFileFormat);
+
+ AlignFrame newframe = null;
+
+ if (fileObject == null)
+ {
+
+ DataSourceType protocol = (fileName.startsWith("http:")
+ ? DataSourceType.URL : DataSourceType.FILE);
+ newframe = loader.LoadFileWaitTillLoaded(fileName, protocol,
+ currentFileFormat);
+ }
+ else
+ {
+ newframe = loader.LoadFileWaitTillLoaded(fileObject, DataSourceType.FILE, currentFileFormat);
+ }
newframe.setBounds(bounds);
if (featureSettings != null && featureSettings.isShowing())
}
/**
+ * Load alignment from (file, protocol) of type format and wait till loaded
+ *
+ * @param file
+ * @param sourceType
+ * @param format
+ * @return alignFrame constructed from file contents
+ */
+ public AlignFrame LoadFileWaitTillLoaded(File file,
+ DataSourceType sourceType, FileFormatI format)
+ {
+ this.selectedFile = file;
+ this.file = file.getPath();
+ this.protocol = sourceType;
+ this.format = format;
+ return _LoadFileWaitTillLoaded();
+ }
+
+ /**
* Load alignment from FileParse source of type format and wait till loaded
*
* @param source
if (!(protocol == DataSourceType.PASTE))
{
alignFrame.setFileName(file, format);
+ alignFrame.setFileObject(selectedFile); // BH 2018 SwingJS
}
if (proxyColourScheme != null)
{