Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / jalview / workers / AlignCalcWorker.js
1 Clazz.declarePackage ("jalview.workers");
2 Clazz.load (["jalview.api.AlignCalcWorkerI", "swingjs.JSThread"], "jalview.workers.AlignCalcWorker", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.iFirst = 0;
5 this.iLast = 0;
6 this.nPer = 2;
7 this.started = 0;
8 this.alignment = null;
9 this.aWidth = 0;
10 this.alignViewport = null;
11 this.calcMan = null;
12 this.ap = null;
13 this.ourAnnots = null;
14 Clazz.instantialize (this, arguments);
15 }, jalview.workers, "AlignCalcWorker", swingjs.JSThread, jalview.api.AlignCalcWorkerI);
16 Clazz.makeConstructor (c$, 
17 function (alignViewport, alignPanel) {
18 Clazz.superConstructor (this, jalview.workers.AlignCalcWorker, [null, "AlignCalcWorker"]);
19 this.alignViewport = alignViewport;
20 this.calcMan = alignViewport.getCalcManager ();
21 this.ap = alignPanel;
22 }, "jalview.api.AlignViewportI,jalview.api.AlignmentViewPanel");
23 Clazz.defineMethod (c$, "abortAndDestroy", 
24 function () {
25 if (this.calcMan != null) {
26 this.calcMan.workerComplete (this);
27 }this.alignViewport = null;
28 this.calcMan = null;
29 this.ap = null;
30 });
31 Clazz.overrideMethod (c$, "involves", 
32 function (i) {
33 return this.ourAnnots != null && this.ourAnnots.contains (i);
34 }, "jalview.datamodel.AlignmentAnnotation");
35 Clazz.overrideMethod (c$, "removeOurAnnotation", 
36 function () {
37 if (this.ourAnnots != null && this.alignViewport != null) {
38 var alignment = this.alignViewport.getAlignment ();
39 {
40 for (var aa, $aa = this.ourAnnots.iterator (); $aa.hasNext () && ((aa = $aa.next ()) || true);) {
41 alignment.deleteAnnotation (aa, true);
42 }
43 }}});
44 Clazz.defineMethod (c$, "notifyDone", 
45 function () {
46 if (this.ap != null) {
47 this.ap.paintAlignment (true);
48 }this.calcMan.workerComplete (this);
49 });
50 Clazz.defineStatics (c$,
51 "LOOP_STANDBY", 3,
52 "LOOP_CALCULATE", 4,
53 "MS_MAX", 500);
54 });