X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fappletgui%2FRedundancyPanel.js;h=647ac1ba201db3fba4e8a8e5b95a404704a6250a;hp=f6b850dc65679546c3ab508fb31bcb16a2fe2fe8;hb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/appletgui/RedundancyPanel.js b/bin/jalview/appletgui/RedundancyPanel.js index f6b850d..647ac1b 100644 --- a/bin/jalview/appletgui/RedundancyPanel.js +++ b/bin/jalview/appletgui/RedundancyPanel.js @@ -1,165 +1,165 @@ -Clazz.declarePackage ("jalview.appletgui"); -Clazz.load (["jalview.appletgui.SliderPanel", "java.awt.event.WindowListener", "java.util.Stack"], "jalview.appletgui.RedundancyPanel", ["awt2swing.Frame", "jalview.analysis.AlignSeq", "jalview.appletgui.PaintRefresher", "jalview.bin.JalviewLite", "jalview.commands.EditCommand", "jalview.util.MessageManager", "java.awt.event.AdjustmentListener", "java.lang.Thread", "java.util.ArrayList", "$.Vector"], function () { -c$ = Clazz.decorateAsClass (function () { -this.historyList = null; -this.redundancy = null; -this.originalSequences = null; -this.frame = null; -this.redundantSeqs = null; -Clazz.instantialize (this, arguments); -}, jalview.appletgui, "RedundancyPanel", jalview.appletgui.SliderPanel, [Runnable, java.awt.event.WindowListener]); -Clazz.prepareFields (c$, function () { -this.historyList = new java.util.Stack (); -}); -Clazz.makeConstructor (c$, -function (ap) { -Clazz.superConstructor (this, jalview.appletgui.RedundancyPanel, [ap, 0, false, null]); -this.redundantSeqs = new java.util.Vector (); -this.ap = ap; -this.undoButton.setVisible (true); -this.applyButton.setVisible (true); -this.allGroupsCheck.setVisible (false); -this.label.setText (jalview.util.MessageManager.getString ("label.enter_redundancy_threshold")); -this.valueField.setText ("100"); -this.slider.setVisibleAmount (1); -this.slider.setMinimum (0); -this.slider.setMaximum (100 + this.slider.getVisibleAmount ()); -this.slider.setValue (100); -this.slider.addAdjustmentListener (((Clazz.isClassDefined ("jalview.appletgui.RedundancyPanel$1") ? 0 : jalview.appletgui.RedundancyPanel.$RedundancyPanel$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.RedundancyPanel$1, this, null))); -this.frame = new awt2swing.Frame (); -this.frame.add (this); -jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.redundancy_threshold_selection"), 400, 100); -this.frame.addWindowListener (this); -var worker = new Thread (this); -worker.start (); -}, "jalview.appletgui.AlignmentPanel"); -Clazz.overrideMethod (c$, "run", -function () { -this.label.setText (jalview.util.MessageManager.getString ("label.calculating")); -this.slider.setVisible (false); -this.applyButton.setEnabled (false); -this.valueField.setVisible (false); -this.validate (); -var omitHidden = null; -var sg = this.ap.av.getSelectionGroup (); -var height; -var start; -var end; -if ((sg != null) && (sg.getSize () >= 1)) { -this.originalSequences = sg.getSequencesInOrder (this.ap.av.getAlignment ()); -start = sg.getStartRes (); -end = sg.getEndRes (); -} else { -this.originalSequences = this.ap.av.getAlignment ().getSequencesArray (); -start = 0; -end = this.ap.av.getAlignment ().getWidth (); -}height = this.originalSequences.length; -this.redundancy = jalview.analysis.AlignSeq.computeRedundancyMatrix (this.originalSequences, omitHidden, start, end, false); -this.label.setText (jalview.util.MessageManager.getString ("label.enter_redundancy_threshold")); -this.slider.setVisible (true); -this.applyButton.setEnabled (true); -this.valueField.setVisible (true); -this.validate (); -this.sliderValueChanged (); -}); -Clazz.defineMethod (c$, "sliderValueChanged", -function () { -if (this.redundancy == null) { -return; -}var value = this.slider.getValue (); -var redundantSequences = new java.util.ArrayList (); -for (var i = 0; i < this.redundancy.length; i++) { -if (value <= this.redundancy[i]) { -redundantSequences.add (this.originalSequences[i]); -}} -this.ap.idPanel.idCanvas.setHighlighted (redundantSequences); -jalview.appletgui.PaintRefresher.Refresh (this, this.ap.av.getSequenceSetId (), true, true); -}); -Clazz.overrideMethod (c$, "applyButton_actionPerformed", -function () { -var del = new java.util.Vector (); -this.undoButton.setEnabled (true); -var value = this.slider.getValue (); -var sg = this.ap.av.getSelectionGroup (); -for (var i = 0; i < this.redundancy.length; i++) { -if (value <= this.redundancy[i]) { -del.addElement (this.originalSequences[i]); -}} -if (del.size () > 0) { -var deleted = new Array (del.size ()); -var width = 0; -for (var i = 0; i < del.size (); i++) { -deleted[i] = del.elementAt (i); -if (deleted[i].getLength () > width) { -width = deleted[i].getLength (); -}} -var cut = new jalview.commands.EditCommand (jalview.util.MessageManager.getString ("action.remove_redundancy"), jalview.commands.EditCommand.Action.CUT, deleted, 0, width, this.ap.av.getAlignment ()); -var alignment = this.ap.av.getAlignment (); -for (var i = 0; i < del.size (); i++) { -alignment.deleteSequence (deleted[i]); -if (sg != null) { -sg.deleteSequence (deleted[i], false); -}} -this.historyList.push (cut); -this.ap.alignFrame.addHistoryItem (cut); -jalview.appletgui.PaintRefresher.Refresh (this, this.ap.av.getSequenceSetId (), true, true); -this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ()); -}}); -Clazz.overrideMethod (c$, "undoButton_actionPerformed", -function () { -var command = this.historyList.pop (); -command.undoCommand (null); -if (this.ap.av.getHistoryList ().contains (command)) { -this.ap.av.getHistoryList ().remove (command); -this.ap.alignFrame.updateEditMenuBar (); -this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ()); -}this.ap.paintAlignment (true); -if (this.historyList.size () == 0) { -this.undoButton.setEnabled (false); -}}); -Clazz.defineMethod (c$, "valueField_actionPerformed", -function (e) { -try { -var i = Integer.parseInt (this.valueField.getText ()); -this.slider.setValue (i); -} catch (ex) { -if (Clazz.exceptionOf (ex, Exception)) { -this.valueField.setText (this.slider.getValue () + ""); -} else { -throw ex; -} -} -}, "java.awt.event.ActionEvent"); -Clazz.overrideMethod (c$, "windowOpened", -function (evt) { -}, "java.awt.event.WindowEvent"); -Clazz.overrideMethod (c$, "windowClosing", -function (evt) { -this.ap.idPanel.idCanvas.setHighlighted (null); -}, "java.awt.event.WindowEvent"); -Clazz.overrideMethod (c$, "windowClosed", -function (evt) { -}, "java.awt.event.WindowEvent"); -Clazz.overrideMethod (c$, "windowActivated", -function (evt) { -}, "java.awt.event.WindowEvent"); -Clazz.overrideMethod (c$, "windowDeactivated", -function (evt) { -}, "java.awt.event.WindowEvent"); -Clazz.overrideMethod (c$, "windowIconified", -function (evt) { -}, "java.awt.event.WindowEvent"); -Clazz.overrideMethod (c$, "windowDeiconified", -function (evt) { -}, "java.awt.event.WindowEvent"); -c$.$RedundancyPanel$1$ = function () { -Clazz.pu$h (); -c$ = Clazz.declareAnonymous (jalview.appletgui, "RedundancyPanel$1", null, java.awt.event.AdjustmentListener); -Clazz.overrideMethod (c$, "adjustmentValueChanged", -function (evt) { -this.b$["jalview.appletgui.RedundancyPanel"].valueField.setText (this.b$["jalview.appletgui.RedundancyPanel"].slider.getValue () + ""); -this.b$["jalview.appletgui.RedundancyPanel"].sliderValueChanged (); -}, "java.awt.event.AdjustmentEvent"); -c$ = Clazz.p0p (); -}; -}); +Clazz.declarePackage ("jalview.appletgui"); +Clazz.load (["jalview.appletgui.SliderPanel", "java.awt.event.WindowListener", "java.util.Stack"], "jalview.appletgui.RedundancyPanel", ["awt2swing.Frame", "jalview.analysis.AlignSeq", "jalview.appletgui.PaintRefresher", "jalview.bin.JalviewLite", "jalview.commands.EditCommand", "jalview.util.MessageManager", "java.awt.event.AdjustmentListener", "java.lang.Thread", "java.util.ArrayList", "$.Vector"], function () { +c$ = Clazz.decorateAsClass (function () { +this.historyList = null; +this.redundancy = null; +this.originalSequences = null; +this.frame = null; +this.redundantSeqs = null; +Clazz.instantialize (this, arguments); +}, jalview.appletgui, "RedundancyPanel", jalview.appletgui.SliderPanel, [Runnable, java.awt.event.WindowListener]); +Clazz.prepareFields (c$, function () { +this.historyList = new java.util.Stack (); +}); +Clazz.makeConstructor (c$, +function (ap) { +Clazz.superConstructor (this, jalview.appletgui.RedundancyPanel, [ap, 0, false, null]); +this.redundantSeqs = new java.util.Vector (); +this.ap = ap; +this.undoButton.setVisible (true); +this.applyButton.setVisible (true); +this.allGroupsCheck.setVisible (false); +this.label.setText (jalview.util.MessageManager.getString ("label.enter_redundancy_threshold")); +this.valueField.setText ("100"); +this.slider.setVisibleAmount (1); +this.slider.setMinimum (0); +this.slider.setMaximum (100 + this.slider.getVisibleAmount ()); +this.slider.setValue (100); +this.slider.addAdjustmentListener (((Clazz.isClassDefined ("jalview.appletgui.RedundancyPanel$1") ? 0 : jalview.appletgui.RedundancyPanel.$RedundancyPanel$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.RedundancyPanel$1, this, null))); +this.frame = new awt2swing.Frame (); +this.frame.add (this); +jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.redundancy_threshold_selection"), 400, 100); +this.frame.addWindowListener (this); +var worker = new Thread (this); +worker.start (); +}, "jalview.appletgui.AlignmentPanel"); +Clazz.overrideMethod (c$, "run", +function () { +this.label.setText (jalview.util.MessageManager.getString ("label.calculating")); +this.slider.setVisible (false); +this.applyButton.setEnabled (false); +this.valueField.setVisible (false); +this.validate (); +var omitHidden = null; +var sg = this.ap.av.getSelectionGroup (); +var height; +var start; +var end; +if ((sg != null) && (sg.getSize () >= 1)) { +this.originalSequences = sg.getSequencesInOrder (this.ap.av.getAlignment ()); +start = sg.getStartRes (); +end = sg.getEndRes (); +} else { +this.originalSequences = this.ap.av.getAlignment ().getSequencesArray (); +start = 0; +end = this.ap.av.getAlignment ().getWidth (); +}height = this.originalSequences.length; +this.redundancy = jalview.analysis.AlignSeq.computeRedundancyMatrix (this.originalSequences, omitHidden, start, end, false); +this.label.setText (jalview.util.MessageManager.getString ("label.enter_redundancy_threshold")); +this.slider.setVisible (true); +this.applyButton.setEnabled (true); +this.valueField.setVisible (true); +this.validate (); +this.sliderValueChanged (); +}); +Clazz.defineMethod (c$, "sliderValueChanged", +function () { +if (this.redundancy == null) { +return; +}var value = this.slider.getValue (); +var redundantSequences = new java.util.ArrayList (); +for (var i = 0; i < this.redundancy.length; i++) { +if (value <= this.redundancy[i]) { +redundantSequences.add (this.originalSequences[i]); +}} +this.ap.idPanel.idCanvas.setHighlighted (redundantSequences); +jalview.appletgui.PaintRefresher.Refresh (this, this.ap.av.getSequenceSetId (), true, true); +}); +Clazz.overrideMethod (c$, "applyButton_actionPerformed", +function () { +var del = new java.util.Vector (); +this.undoButton.setEnabled (true); +var value = this.slider.getValue (); +var sg = this.ap.av.getSelectionGroup (); +for (var i = 0; i < this.redundancy.length; i++) { +if (value <= this.redundancy[i]) { +del.addElement (this.originalSequences[i]); +}} +if (del.size () > 0) { +var deleted = new Array (del.size ()); +var width = 0; +for (var i = 0; i < del.size (); i++) { +deleted[i] = del.elementAt (i); +if (deleted[i].getLength () > width) { +width = deleted[i].getLength (); +}} +var cut = new jalview.commands.EditCommand (jalview.util.MessageManager.getString ("action.remove_redundancy"), jalview.commands.EditCommand.Action.CUT, deleted, 0, width, this.ap.av.getAlignment ()); +var alignment = this.ap.av.getAlignment (); +for (var i = 0; i < del.size (); i++) { +alignment.deleteSequence (deleted[i]); +if (sg != null) { +sg.deleteSequence (deleted[i], false); +}} +this.historyList.push (cut); +this.ap.alignFrame.addHistoryItem (cut); +jalview.appletgui.PaintRefresher.Refresh (this, this.ap.av.getSequenceSetId (), true, true); +this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ()); +}}); +Clazz.overrideMethod (c$, "undoButton_actionPerformed", +function () { +var command = this.historyList.pop (); +command.undoCommand (null); +if (this.ap.av.getHistoryList ().contains (command)) { +this.ap.av.getHistoryList ().remove (command); +this.ap.alignFrame.updateEditMenuBar (); +this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ()); +}this.ap.paintAlignment (true); +if (this.historyList.size () == 0) { +this.undoButton.setEnabled (false); +}}); +Clazz.defineMethod (c$, "valueField_actionPerformed", +function (e) { +try { +var i = Integer.parseInt (this.valueField.getText ()); +this.slider.setValue (i); +} catch (ex) { +if (Clazz.exceptionOf (ex, Exception)) { +this.valueField.setText (this.slider.getValue () + ""); +} else { +throw ex; +} +} +}, "java.awt.event.ActionEvent"); +Clazz.overrideMethod (c$, "windowOpened", +function (evt) { +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod (c$, "windowClosing", +function (evt) { +this.ap.idPanel.idCanvas.setHighlighted (null); +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod (c$, "windowClosed", +function (evt) { +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod (c$, "windowActivated", +function (evt) { +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod (c$, "windowDeactivated", +function (evt) { +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod (c$, "windowIconified", +function (evt) { +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod (c$, "windowDeiconified", +function (evt) { +}, "java.awt.event.WindowEvent"); +c$.$RedundancyPanel$1$ = function () { +Clazz.pu$h (); +c$ = Clazz.declareAnonymous (jalview.appletgui, "RedundancyPanel$1", null, java.awt.event.AdjustmentListener); +Clazz.overrideMethod (c$, "adjustmentValueChanged", +function (evt) { +this.b$["jalview.appletgui.RedundancyPanel"].valueField.setText (this.b$["jalview.appletgui.RedundancyPanel"].slider.getValue () + ""); +this.b$["jalview.appletgui.RedundancyPanel"].sliderValueChanged (); +}, "java.awt.event.AdjustmentEvent"); +c$ = Clazz.p0p (); +}; +});