JAL-2838 filled in actionPerformed of the tree sort menu items
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 5 Dec 2017 03:50:27 +0000 (03:50 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 5 Dec 2017 03:50:27 +0000 (03:50 +0000)
src/jalview/ext/archaeopteryx/JalviewBinding.java
src/jalview/gui/AlignFrame.java

index 61171b3..b4bcd61 100644 (file)
@@ -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<CommandI> 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;
   }
   
 
index afe7ce5..5654c54 100644 (file)
@@ -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));
             }
 
           });