JAL-2799 re-enabled change listener for Aptx's tabs (for future work)
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Mon, 27 Nov 2017 16:25:40 +0000 (16:25 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Mon, 27 Nov 2017 16:25:40 +0000 (16:25 +0000)
src/jalview/ext/archaeopteryx/JalviewBinding.java

index 2331204..5ddc336 100644 (file)
@@ -22,7 +22,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.swing.JTabbedPane;
 import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
 
 import org.forester.archaeopteryx.MainFrame;
 import org.forester.phylogeny.Phylogeny;
@@ -44,6 +47,7 @@ public final class JalviewBinding
 
   private AlignmentViewport parentAvport;
 
+  private final JTabbedPane treeTabs;
 
   private final StructureSelectionManager ssm;
 
@@ -87,46 +91,44 @@ public final class JalviewBinding
     nodesBoundToSequences = nodesMappedToAlign;
 
     treeView = archaeopteryx.getMainPanel().getCurrentTreePanel();
+    treeTabs = archaeopteryx.getMainPanel().getTabbedPane();
     ssm = parentAvport.getStructureSelectionManager();
-
-
-    // archaeopteryx.getMainPanel().getControlPanel().setColorBranches(true);
     
     ssm.addSelectionListener(this);
     treeView.addMouseListener(this);
     PaintRefresher.Register(treeView, parentAvport.getSequenceSetId());
 
 
-    // treeTabs.addChangeListener(new ChangeListener()
-    // {
-    //
-    // @Override
-    // public void stateChanged(ChangeEvent e)
-    // {
-    //
-    // SwingUtilities.invokeLater(new Runnable()
-    // {
-    //
-    // @Override
-    // /**
-    // * Resend the selection to the tree view when tabs get switched, this
-    // * has to be buried in invokeLater as Forester first resets the tree
-    // * view on switching tabs, without invokeLater this would get called
-    // * before Forester resets which would nullify the selection.
-    // */
-    // public void run()
-    // {
-    // treeView = archaeopteryx.getMainPanel().getCurrentTreePanel();
-    // parentAvport.sendSelection();
-    // // PaintRefresher.Refresh(treeView,
-    // // parentAvport.getSequenceSetId());
-    //
-    // }
-    // });
-    //
-    // }
-    //
-    // });
+    treeTabs.addChangeListener(new ChangeListener()
+    {
+
+      @Override
+      public void stateChanged(ChangeEvent e)
+      {
+
+        SwingUtilities.invokeLater(new Runnable()
+        {
+
+          @Override
+          /**
+           * Resend the selection to the tree view when tabs get switched, this
+           * has to be buried in invokeLater as Forester first resets the tree
+           * view on switching tabs, without invokeLater this would get called
+           * before Forester resets which would nullify the selection.
+           */
+          public void run()
+          {
+            treeView = archaeopteryx.getMainPanel().getCurrentTreePanel();
+            parentAvport.sendSelection();
+            // PaintRefresher.Refresh(treeView,
+            // parentAvport.getSequenceSetId());
+
+          }
+        });
+
+      }
+
+    });
 
   }