From f57f66a270e20cbeca4ba1cc39b9568fe92acd60 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Mon, 27 Nov 2017 16:25:40 +0000 Subject: [PATCH] JAL-2799 re-enabled change listener for Aptx's tabs (for future work) --- src/jalview/ext/archaeopteryx/JalviewBinding.java | 68 +++++++++++---------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/src/jalview/ext/archaeopteryx/JalviewBinding.java b/src/jalview/ext/archaeopteryx/JalviewBinding.java index 2331204..5ddc336 100644 --- a/src/jalview/ext/archaeopteryx/JalviewBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewBinding.java @@ -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()); + + } + }); + + } + + }); } -- 1.7.10.2