From: kjvdheide Date: Fri, 24 Nov 2017 18:46:59 +0000 (+0000) Subject: JAL-2794 binding now exclusively supports single tab Aptx views X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=3df539f3c7d81504e3a8f6b297343505dc0f3c89 JAL-2794 binding now exclusively supports single tab Aptx views --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 138ed2c..67af027 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -387,6 +387,7 @@ label.not_enough_sequences = Not enough sequences label.selected_region_to_tree_may_only_contain_residues_or_gaps = The selected region to create a tree may\nonly contain residues or gaps.\nTry using the Pad function in the edit menu,\nor one of the multiple sequence alignment web services. label.sequences_selection_not_aligned = Sequences in selection are not aligned label.problem_reading_tree_file = Problem reading tree file +label.tabs_detected_archaeopteryx = Warning, multiple trees detected in a single tree viewer instance. This will cause problems! label.possible_problem_with_tree_file = Possible problem with tree file label.tree_url_example = Please enter a complete URL, for example \"http://www.jalview.org/examples/ferredoxin.nw\" label.from_database = From Database... diff --git a/src/jalview/ext/archaeopteryx/JalviewBinding.java b/src/jalview/ext/archaeopteryx/JalviewBinding.java index dae01f1..f59bdd9 100644 --- a/src/jalview/ext/archaeopteryx/JalviewBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewBinding.java @@ -5,9 +5,12 @@ import jalview.datamodel.HiddenColumns; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.ext.treeviewer.ExternalTreeViewerBindingI; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; import jalview.gui.PaintRefresher; import jalview.structure.SelectionSource; import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; import java.awt.event.ActionEvent; @@ -18,10 +21,7 @@ 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; @@ -43,7 +43,6 @@ public final class JalviewBinding private AlignmentViewport parentAvport; - private JTabbedPane treeTabs; private final StructureSelectionManager ssm; @@ -71,15 +70,25 @@ public final class JalviewBinding final Map alignMappedToNodes, final Map nodesMappedToAlign) { + + if (archaeopteryx.getMainPanel().getTabbedPane().getTabCount() > 1) + { + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager.getString("label.tabs_detected_archaeopteryx"), + MessageManager.getString("label.problem_reading_tree_file"), + JvOptionPane.WARNING_MESSAGE); + ; + } + // deal with/prohibit null values here as that will cause problems parentAvport = jalviewAlignmentViewport; sequencesBoundToNodes = alignMappedToNodes; nodesBoundToSequences = nodesMappedToAlign; treeView = archaeopteryx.getMainPanel().getCurrentTreePanel(); - treeTabs = archaeopteryx.getMainPanel().getTabbedPane(); ssm = parentAvport.getStructureSelectionManager(); + // archaeopteryx.getMainPanel().getControlPanel().setColorBranches(true); ssm.addSelectionListener(this); @@ -87,35 +96,36 @@ public final class JalviewBinding 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() - { - 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()); + // + // } + // }); + // + // } + // + // }); } @@ -239,7 +249,10 @@ public final class JalviewBinding } - + /** + * may or may not need an extra repaint on the alignment view (check what kira + * does) + */ @Override public void showNodeSelectionOnAlign(final PhylogenyNode node) { @@ -254,6 +267,7 @@ public final class JalviewBinding showMatchingSequence(node); } + PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); }