1 Clazz.declarePackage ("jalview.commands");
\r
2 Clazz.load (["jalview.commands.EditCommand"], "jalview.commands.TrimRegionCommand", null, function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
6 this.shiftList = null;
\r
7 this.selectionGroup = null;
\r
8 this.deletedHiddenColumns = null;
\r
9 this.columnsDeleted = 0;
\r
10 Clazz.instantialize (this, arguments);
\r
11 }, jalview.commands, "TrimRegionCommand", jalview.commands.EditCommand);
\r
12 Clazz.makeConstructor (c$,
\r
13 function (description, command, seqs, column, al, colSel, selectedRegion) {
\r
14 Clazz.superConstructor (this, jalview.commands.TrimRegionCommand, []);
\r
15 this.description = description;
\r
16 this.selectionGroup = selectedRegion;
\r
17 this.colSel = colSel;
\r
18 if (command.equalsIgnoreCase (jalview.commands.TrimRegionCommand.TRIM_LEFT)) {
\r
21 }this.columnsDeleted = column;
\r
22 this.setEdit (Clazz.innerTypeInstance (jalview.commands.EditCommand.Edit, this, null, jalview.commands.EditCommand.Action.CUT, seqs, 0, column, al));
\r
23 } else if (command.equalsIgnoreCase (jalview.commands.TrimRegionCommand.TRIM_RIGHT)) {
\r
24 var width = al.getWidth () - column - 1;
\r
27 }this.columnsDeleted = width - 1;
\r
28 this.setEdit (Clazz.innerTypeInstance (jalview.commands.EditCommand.Edit, this, null, jalview.commands.EditCommand.Action.CUT, seqs, column + 1, width, al));
\r
30 var isize = this.getEdit (0).seqs.length;
\r
31 this.start = Clazz.newIntArray (isize, 0);
\r
32 for (i = 0; i < isize; i++) {
\r
33 this.start[i] = this.getEdit (0).seqs[i].getStart ();
\r
35 this.performEdit (0, null);
\r
36 }, "~S,~S,~A,~N,jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup");
\r
37 Clazz.defineMethod (c$, "cut",
\r
38 function (command) {
\r
41 var jSize = command.seqs.length;
\r
42 for (j = 0; j < jSize; j++) {
\r
43 if (command.position == 0) {
\r
44 column = command.seqs[j].findPosition (command.number);
\r
45 command.seqs[j].setStart (column);
\r
47 column = command.seqs[j].findPosition (command.position) - 1;
\r
48 command.seqs[j].setEnd (column);
\r
50 Clazz.superCall (this, jalview.commands.TrimRegionCommand, "cut", [command, null]);
\r
51 if (command.position == 0) {
\r
52 this.deletedHiddenColumns = this.colSel.compensateForEdit (0, command.number);
\r
53 if (this.selectionGroup != null) {
\r
54 this.selectionGroup.adjustForRemoveLeft (command.number);
\r
56 this.deletedHiddenColumns = this.colSel.compensateForEdit (command.position, command.number);
\r
57 if (this.selectionGroup != null) {
\r
58 this.selectionGroup.adjustForRemoveRight (command.position);
\r
59 }}}, "jalview.commands.EditCommand.Edit");
\r
60 Clazz.defineMethod (c$, "paste",
\r
61 function (command) {
\r
62 Clazz.superCall (this, jalview.commands.TrimRegionCommand, "paste", [command, null]);
\r
65 var jSize = command.seqs.length;
\r
66 for (j = 0; j < jSize; j++) {
\r
67 if (command.position == 0) {
\r
68 command.seqs[j].setStart (this.start[j]);
\r
70 column = command.seqs[j].findPosition (command.number + command.position) - 1;
\r
71 command.seqs[j].setEnd (column);
\r
73 if (command.position == 0) {
\r
74 this.colSel.compensateForEdit (0, -command.number);
\r
75 if (this.selectionGroup != null) {
\r
76 this.selectionGroup.adjustForRemoveLeft (-command.number);
\r
77 }}if (this.deletedHiddenColumns != null) {
\r
79 for (var i = 0; i < this.deletedHiddenColumns.size (); i++) {
\r
80 region = this.deletedHiddenColumns.get (i);
\r
81 this.colSel.hideColumns (region[0], region[1]);
\r
83 }}, "jalview.commands.EditCommand.Edit");
\r
84 Clazz.overrideMethod (c$, "getSize",
\r
86 return this.columnsDeleted;
\r
88 Clazz.defineStatics (c$,
\r
89 "TRIM_LEFT", "TrimLeft",
\r
90 "TRIM_RIGHT", "TrimRight");
\r