From: amwaterhouse Date: Fri, 11 Feb 2005 12:44:39 +0000 (+0000) Subject: move sequences up and down X-Git-Tag: Release_2_0~662 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ae4a9966d39ef82d1c37374b7bcabb3d436fce39;p=jalview.git move sequences up and down --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 7f8b8e9..3a38769 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -197,6 +197,50 @@ public class AlignFrame extends GAlignFrame alignPanel.RefreshPanels(); } + public void moveSelectedSequences(boolean up) + { + SequenceGroup sg = viewport.getRubberbandGroup(); + if (sg == null) + return; + + if (up) + { + for (int i = 1; i < viewport.alignment.getHeight(); i++) + { + SequenceI seq = viewport.alignment.getSequenceAt(i); + if (!sg.sequences.contains(seq)) + continue; + + SequenceI temp = viewport.alignment.getSequenceAt(i - 1); + if (sg.sequences.contains(temp)) + continue; + + viewport.alignment.getSequences().setElementAt(temp, i); + viewport.alignment.getSequences().setElementAt(seq, i - 1); + } + } + else + { + for (int i = viewport.alignment.getHeight() - 2; i > -1; i--) + { + SequenceI seq = viewport.alignment.getSequenceAt(i); + if (!sg.sequences.contains(seq)) + continue; + + SequenceI temp = viewport.alignment.getSequenceAt(i + 1); + if (sg.sequences.contains(temp)) + continue; + + viewport.alignment.getSequences().setElementAt(temp, i); + viewport.alignment.getSequences().setElementAt(seq, i + 1); + } + } + + alignPanel.RefreshPanels(); + } + + + protected void copy_actionPerformed(ActionEvent e) { if(viewport.getRubberbandGroup()==null)