X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fcommands%2FTrimRegionCommand.js;h=2732ca0a27fe02ade5b4709dfa6cab0afe057d46;hp=ff067479b427cc32cc4a6472aa960c0105c0daf5;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/jalview/commands/TrimRegionCommand.js b/site/j2s/jalview/commands/TrimRegionCommand.js index ff06747..2732ca0 100644 --- a/site/j2s/jalview/commands/TrimRegionCommand.js +++ b/site/j2s/jalview/commands/TrimRegionCommand.js @@ -1,91 +1,91 @@ -Clazz.declarePackage ("jalview.commands"); -Clazz.load (["jalview.commands.EditCommand"], "jalview.commands.TrimRegionCommand", null, function () { -c$ = Clazz.decorateAsClass (function () { -this.colSel = null; -this.start = null; -this.shiftList = null; -this.selectionGroup = null; -this.deletedHiddenColumns = null; -this.columnsDeleted = 0; -Clazz.instantialize (this, arguments); -}, jalview.commands, "TrimRegionCommand", jalview.commands.EditCommand); -Clazz.makeConstructor (c$, -function (description, command, seqs, column, al, colSel, selectedRegion) { -Clazz.superConstructor (this, jalview.commands.TrimRegionCommand, []); -this.description = description; -this.selectionGroup = selectedRegion; -this.colSel = colSel; -if (command.equalsIgnoreCase (jalview.commands.TrimRegionCommand.TRIM_LEFT)) { -if (column == 0) { -return; -}this.columnsDeleted = column; -this.setEdit (Clazz.innerTypeInstance (jalview.commands.EditCommand.Edit, this, null, jalview.commands.EditCommand.Action.CUT, seqs, 0, column, al)); -} else if (command.equalsIgnoreCase (jalview.commands.TrimRegionCommand.TRIM_RIGHT)) { -var width = al.getWidth () - column - 1; -if (width < 2) { -return; -}this.columnsDeleted = width - 1; -this.setEdit (Clazz.innerTypeInstance (jalview.commands.EditCommand.Edit, this, null, jalview.commands.EditCommand.Action.CUT, seqs, column + 1, width, al)); -}var i; -var isize = this.getEdit (0).seqs.length; -this.start = Clazz.newIntArray (isize, 0); -for (i = 0; i < isize; i++) { -this.start[i] = this.getEdit (0).seqs[i].getStart (); -} -this.performEdit (0, null); -}, "~S,~S,~A,~N,jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup"); -Clazz.defineMethod (c$, "cut", -function (command) { -var column; -var j; -var jSize = command.seqs.length; -for (j = 0; j < jSize; j++) { -if (command.position == 0) { -column = command.seqs[j].findPosition (command.number); -command.seqs[j].setStart (column); -} else { -column = command.seqs[j].findPosition (command.position) - 1; -command.seqs[j].setEnd (column); -}} -Clazz.superCall (this, jalview.commands.TrimRegionCommand, "cut", [command, null]); -if (command.position == 0) { -this.deletedHiddenColumns = this.colSel.compensateForEdit (0, command.number); -if (this.selectionGroup != null) { -this.selectionGroup.adjustForRemoveLeft (command.number); -}} else { -this.deletedHiddenColumns = this.colSel.compensateForEdit (command.position, command.number); -if (this.selectionGroup != null) { -this.selectionGroup.adjustForRemoveRight (command.position); -}}}, "jalview.commands.EditCommand.Edit"); -Clazz.defineMethod (c$, "paste", -function (command) { -Clazz.superCall (this, jalview.commands.TrimRegionCommand, "paste", [command, null]); -var column; -var j; -var jSize = command.seqs.length; -for (j = 0; j < jSize; j++) { -if (command.position == 0) { -command.seqs[j].setStart (this.start[j]); -} else { -column = command.seqs[j].findPosition (command.number + command.position) - 1; -command.seqs[j].setEnd (column); -}} -if (command.position == 0) { -this.colSel.compensateForEdit (0, -command.number); -if (this.selectionGroup != null) { -this.selectionGroup.adjustForRemoveLeft (-command.number); -}}if (this.deletedHiddenColumns != null) { -var region; -for (var i = 0; i < this.deletedHiddenColumns.size (); i++) { -region = this.deletedHiddenColumns.get (i); -this.colSel.hideColumns (region[0], region[1]); -} -}}, "jalview.commands.EditCommand.Edit"); -Clazz.overrideMethod (c$, "getSize", -function () { -return this.columnsDeleted; -}); -Clazz.defineStatics (c$, -"TRIM_LEFT", "TrimLeft", -"TRIM_RIGHT", "TrimRight"); -}); +Clazz.declarePackage ("jalview.commands"); +Clazz.load (["jalview.commands.EditCommand"], "jalview.commands.TrimRegionCommand", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.colSel = null; +this.start = null; +this.shiftList = null; +this.selectionGroup = null; +this.deletedHiddenColumns = null; +this.columnsDeleted = 0; +Clazz.instantialize (this, arguments); +}, jalview.commands, "TrimRegionCommand", jalview.commands.EditCommand); +Clazz.makeConstructor (c$, +function (description, command, seqs, column, al, colSel, selectedRegion) { +Clazz.superConstructor (this, jalview.commands.TrimRegionCommand, []); +this.description = description; +this.selectionGroup = selectedRegion; +this.colSel = colSel; +if (command.equalsIgnoreCase (jalview.commands.TrimRegionCommand.TRIM_LEFT)) { +if (column == 0) { +return; +}this.columnsDeleted = column; +this.setEdit (Clazz.innerTypeInstance (jalview.commands.EditCommand.Edit, this, null, jalview.commands.EditCommand.Action.CUT, seqs, 0, column, al)); +} else if (command.equalsIgnoreCase (jalview.commands.TrimRegionCommand.TRIM_RIGHT)) { +var width = al.getWidth () - column - 1; +if (width < 2) { +return; +}this.columnsDeleted = width - 1; +this.setEdit (Clazz.innerTypeInstance (jalview.commands.EditCommand.Edit, this, null, jalview.commands.EditCommand.Action.CUT, seqs, column + 1, width, al)); +}var i; +var isize = this.getEdit (0).seqs.length; +this.start = Clazz.newIntArray (isize, 0); +for (i = 0; i < isize; i++) { +this.start[i] = this.getEdit (0).seqs[i].getStart (); +} +this.performEdit (0, null); +}, "~S,~S,~A,~N,jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup"); +Clazz.defineMethod (c$, "cut", +function (command) { +var column; +var j; +var jSize = command.seqs.length; +for (j = 0; j < jSize; j++) { +if (command.position == 0) { +column = command.seqs[j].findPosition (command.number); +command.seqs[j].setStart (column); +} else { +column = command.seqs[j].findPosition (command.position) - 1; +command.seqs[j].setEnd (column); +}} +Clazz.superCall (this, jalview.commands.TrimRegionCommand, "cut", [command, null]); +if (command.position == 0) { +this.deletedHiddenColumns = this.colSel.compensateForEdit (0, command.number); +if (this.selectionGroup != null) { +this.selectionGroup.adjustForRemoveLeft (command.number); +}} else { +this.deletedHiddenColumns = this.colSel.compensateForEdit (command.position, command.number); +if (this.selectionGroup != null) { +this.selectionGroup.adjustForRemoveRight (command.position); +}}}, "jalview.commands.EditCommand.Edit"); +Clazz.defineMethod (c$, "paste", +function (command) { +Clazz.superCall (this, jalview.commands.TrimRegionCommand, "paste", [command, null]); +var column; +var j; +var jSize = command.seqs.length; +for (j = 0; j < jSize; j++) { +if (command.position == 0) { +command.seqs[j].setStart (this.start[j]); +} else { +column = command.seqs[j].findPosition (command.number + command.position) - 1; +command.seqs[j].setEnd (column); +}} +if (command.position == 0) { +this.colSel.compensateForEdit (0, -command.number); +if (this.selectionGroup != null) { +this.selectionGroup.adjustForRemoveLeft (-command.number); +}}if (this.deletedHiddenColumns != null) { +var region; +for (var i = 0; i < this.deletedHiddenColumns.size (); i++) { +region = this.deletedHiddenColumns.get (i); +this.colSel.hideColumns (region[0], region[1]); +} +}}, "jalview.commands.EditCommand.Edit"); +Clazz.overrideMethod (c$, "getSize", +function () { +return this.columnsDeleted; +}); +Clazz.defineStatics (c$, +"TRIM_LEFT", "TrimLeft", +"TRIM_RIGHT", "TrimRight"); +});