File size: 1,642 Bytes
233f6d4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | Clazz.declarePackage ("JS");
Clazz.load (["J.thread.JmolThread"], "JS.FileLoadThread", null, function () {
c$ = Clazz.decorateAsClass (function () {
this.fileName = null;
this.cacheName = null;
this.key = null;
Clazz.instantialize (this, arguments);
}, JS, "FileLoadThread", J.thread.JmolThread);
Clazz.makeConstructor (c$,
function (eval, vwr, fileName, key, cacheName) {
this.setViewer (vwr, "FileLoadThread");
this.fileName = fileName;
this.key = key;
this.cacheName = cacheName;
this.setEval (eval);
this.sc.pc--;
}, "J.api.JmolScriptEvaluator,JV.Viewer,~S,~S,~S");
Clazz.overrideMethod (c$, "run1",
function (mode) {
while (true) switch (mode) {
case -1:
mode = 0;
break;
case 0:
if (this.stopped || !this.vwr.testAsync && this.eval.isStopped ()) {
mode = -2;
break;
}var jmol = null;
{
jmol = Jmol;
}if (jmol != null) jmol._loadFileAsynchronously (this, this.vwr.html5Applet, this.fileName, null);
{
}return;
case 1:
var data = this.vwr.fm.getFileAsBytes (this.fileName, null);
this.setData (this.fileName, this.fileName, data, null);
return;
case -2:
this.resumeEval ();
return;
}
}, "~N");
Clazz.defineMethod (c$, "setData",
function (fileName, fileName0, data, myData) {
var isCanceled = fileName.equals ("#CANCELED#");
this.sc.parentContext.htFileCache.put (this.key, (isCanceled ? fileName : (this.cacheName = this.cacheName.substring (0, this.cacheName.lastIndexOf ("_") + 1) + fileName)));
this.vwr.cachePut (this.cacheName, data);
if (fileName0 != null) {
this.vwr.cachePut (this.vwr.fm.getFilePath (fileName, true, false), data);
}this.run1 (-2);
}, "~S,~S,~O,~O");
});
|