From 1d9ed8ea1705fd5ed1cdc569fa1574363ad0a749 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Tue, 5 Dec 2017 03:50:27 +0000 Subject: [PATCH] JAL-2838 filled in actionPerformed of the tree sort menu items --- src/jalview/ext/archaeopteryx/JalviewBinding.java | 75 ++++++++++++++++++++- src/jalview/gui/AlignFrame.java | 4 +- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/archaeopteryx/JalviewBinding.java b/src/jalview/ext/archaeopteryx/JalviewBinding.java index 61171b3..b4bcd61 100644 --- a/src/jalview/ext/archaeopteryx/JalviewBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewBinding.java @@ -2,6 +2,7 @@ package jalview.ext.archaeopteryx; import jalview.analysis.Conservation; import jalview.api.AlignViewportI; +import jalview.commands.CommandI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.HiddenColumns; import jalview.datamodel.SequenceGroup; @@ -572,8 +573,80 @@ public final class JalviewBinding } } - public void sortByTree_actionPerformed() { + @Override + public void sortByTree_actionPerformed()// modify for Aptx + { + // + // if (treeCanvas.applyToAllViews) + // { + // final ArrayList commands = new ArrayList<>(); + // for (AlignmentPanel ap : PaintRefresher + // .getAssociatedPanels(av.getSequenceSetId())) + // { + // commands.add(sortAlignmentIn(ap.av.getAlignPanel())); + // } + // av.getAlignPanel().alignFrame.addHistoryItem(new CommandI() + // { + // + // @Override + // public void undoCommand(AlignmentI[] views) + // { + // for (CommandI tsort : commands) + // { + // tsort.undoCommand(views); + // } + // } + // + // @Override + // public int getSize() + // { + // return commands.size(); + // } + // + // @Override + // public String getDescription() + // { + // return "Tree Sort (many views)"; + // } + // + // @Override + // public void doCommand(AlignmentI[] views) + // { + // + // for (CommandI tsort : commands) + // { + // tsort.doCommand(views); + // } + // } + // }); + // for (AlignmentPanel ap : PaintRefresher + // .getAssociatedPanels(av.getSequenceSetId())) + // { + // // ensure all the alignFrames refresh their GI after adding an undo item + // ap.alignFrame.updateEditMenuBar(); + // } + // } + // else + // { + // treeCanvas.ap.alignFrame + // .addHistoryItem(sortAlignmentIn(treeCanvas.ap)); + // } + + } + + public CommandI sortAlignmentIn(AlignmentPanel ap) + { + // // TODO: move to alignment view controller + // AlignmentViewport viewport = ap.av; + // SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + // AlignmentSorter.sortByTree(viewport.getAlignment(), tree); + // CommandI undo; + // undo = new OrderCommand("Tree Sort", oldOrder, viewport.getAlignment()); + // + // ap.paintAlignment(true, false); + // return undo; + return null; } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index afe7ce5..5654c54 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3800,8 +3800,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void actionPerformed(ActionEvent e) { - // tp.sortByTree_actionPerformed(); - // addHistoryItem(tp.sortAlignmentIn(alignPanel)); + binding.sortByTree_actionPerformed(); + addHistoryItem(binding.sortAlignmentIn(alignPanel)); } }); -- 1.7.10.2