JAL-1807 test
[jalviewjs.git] / bin / jalview / commands / OrderCommand.js
1 Clazz.declarePackage ("jalview.commands");
2 Clazz.load (["jalview.commands.CommandI"], "jalview.commands.OrderCommand", ["jalview.analysis.AlignmentSorter"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.description = null;
5 this.seqs = null;
6 this.seqs2 = null;
7 this.al = null;
8 Clazz.instantialize (this, arguments);
9 }, jalview.commands, "OrderCommand", null, jalview.commands.CommandI);
10 Clazz.makeConstructor (c$, 
11 function (description, seqs, al) {
12 this.description = description;
13 this.seqs = seqs;
14 this.seqs2 = al.getSequencesArray ();
15 this.al = al;
16 this.doCommand (null);
17 }, "~S,~A,jalview.datamodel.AlignmentI");
18 Clazz.overrideMethod (c$, "getDescription", 
19 function () {
20 return this.description;
21 });
22 Clazz.overrideMethod (c$, "getSize", 
23 function () {
24 return 1;
25 });
26 Clazz.overrideMethod (c$, "doCommand", 
27 function (views) {
28 jalview.analysis.AlignmentSorter.setOrder (this.al, this.seqs2);
29 }, "~A");
30 Clazz.overrideMethod (c$, "undoCommand", 
31 function (views) {
32 jalview.analysis.AlignmentSorter.setOrder (this.al, this.seqs);
33 }, "~A");
34 Clazz.defineMethod (c$, "getSequenceOrder", 
35 function (undo) {
36 return undo ? this.seqs : this.seqs2;
37 }, "~B");
38 });