X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Farchaeopteryx%2FJalviewAptxBinding.java;h=e0a143ce1b41484ce0977ee50a820fb40ad3615b;hb=b6c5f18ed142f770c8ff9bbe4a5000dbb277080e;hp=6a6b3f14025614a3e5102794fa1684f3bc7cc5e9;hpb=3e82604b61ab50eea950f3ba2804c6bd75c204a6;p=jalview.git diff --git a/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java b/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java index 6a6b3f1..e0a143c 100644 --- a/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java @@ -13,9 +13,11 @@ import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.util.HashSet; +import java.util.List; import java.util.Map; import org.forester.archaeopteryx.MainFrame; +import org.forester.phylogeny.PhylogenyMethods; import org.forester.phylogeny.PhylogenyNode; /** @@ -131,7 +133,8 @@ public final class JalviewAptxBinding implements JalviewTreeViewerBindingI /** * If a node is selected in the tree panel this method highlights the - * corresponding sequence in the Jalview alignment view. + * corresponding sequence in the Jalview alignment view. If an internal node + * is selected all child sequences get highlighted as well. */ @Override public void showNodeSelectionOnAlign(final MouseEvent e) @@ -139,32 +142,57 @@ public final class JalviewAptxBinding implements JalviewTreeViewerBindingI final PhylogenyNode node = treeView.findNode(e.getX(), e.getY()); if (node != null) { - SequenceI matchingSequence = nodesBoundToSequences.get(node); - if (matchingSequence != null) + if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) // clear previous + // selection if shift + // IS NOT pressed { + parentAvport.setSelectionGroup(null); + } - if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) // shift is pressed - // (so multiple nodes - // can be selected) - { - // something? + if (node.isInternal()) + { + showMatchingChildSequences(node); - } - else - { - parentAvport.setSelectionGroup(null); // reset selection if shift - // isn't pressed - } + } + else + { + showMatchingSequence(node); - treeSelectionChanged(matchingSequence); - parentAvport.sendSelection(); // not actually needed? - PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); + } + } + } - } + + + + public void showMatchingSequence(final PhylogenyNode nodeToMatch) + { + SequenceI matchingSequence = nodesBoundToSequences.get(nodeToMatch); + if (matchingSequence != null) + { + treeSelectionChanged(matchingSequence); + parentAvport.sendSelection(); + PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); } + } + + public void showMatchingChildSequences(final PhylogenyNode parentNode) + { + final List childNodes = PhylogenyMethods + .getAllDescendants(parentNode); + for (PhylogenyNode childNode : childNodes) + { + SequenceI matchingSequence = nodesBoundToSequences.get(childNode); + if (matchingSequence != null) + { + treeSelectionChanged(matchingSequence); + } + } + parentAvport.sendSelection(); + PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); } /**