else if (menu.getText().contains("View"))
{
menu.addSeparator();
+
JMenuItem sortByTree = new JMenuItem("Sort alignment by tree");
JMenuItem refreshJalview = new JMenuItem(
"Filter alignment to show only currently visible sequences");
+ JMenuItem hideCollapsed = new JMenuItem(
+ "Hide sequences of collapsed nodes");
refreshJalview.setFont(menu.getFont());
refreshJalview.addActionListener(new ActionListener() {
});
+ hideCollapsed.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ TreeViewerBindingI bindingManager = TreeViewerUtils
+ .getActiveTreeViews().get(AptxFrame.this);
+ bindingManager.hideCollapsedSequences_actionPerformed();
+
+ }
+
+ });
+
menu.add(sortByTree);
menu.add(refreshJalview);
+ menu.add(hideCollapsed);
sortByTree.setFont(menu.getFont());
TreeViewerUtils.associateNodesWithJalviewSequences(aptxFrame,
parentAvport, sequencesBoundToNodes, nodesBoundToSequences);
+
for (SequenceI seq : parentAvport.getAlignment().getSequencesArray())
{
if (!sequencesBoundToNodes.containsKey(seq))
{
parentAvport.hideSequence(new SequenceI[] { seq });
+
}
}
}
return nodesBoundToSequences;
}
+ @Override
+ public void hideCollapsedSequences_actionPerformed()
+ {
+ parentAvport.showAllHiddenSeqs();
+
+ for (TreeNodeI node : treeView.getTree().getAllNodes())
+ {
+ if (node.isCollapsed())
+ {
+ SequenceI seqToHide = nodesBoundToSequences.get(node);
+ if (seqToHide != null)
+ {
+ parentAvport.hideSequence(new SequenceI[] { seqToHide });
+
+
+ }
+
+ }
+ }
+
+
+ }
}
public void addFrameListener(InternalFrameListener listener);
/**
- * Method for adding the actual frame to Jalview, probably through
+ * Method for adding the actual frame to Jalview, probably by calling
* {@link jalview.gui.Desktop#addInternalFrame(javax.swing.JInternalFrame, String, boolean, int, int, boolean, boolean)}
*
* @param title
public CommandI sortAlignmentIn(AlignmentPanel alignPanel);
/**
- * This should be triggered when the user wants to sort the Jalview alignment
- * by the sequence order of the tree.
+ * Is triggered when the user wants to sort the Jalview alignment by the
+ * sequence order of the tree.
*/
public void sortByTree_actionPerformed();
/**
+ * Is triggered when the users wants to hide sequences in the Jalview
+ * alignment view that are part of a currently collapsed sub tree.
+ */
+ public void hideCollapsedSequences_actionPerformed();
+
+ /**
* If the nodes that should be matched have changed (different one selected by
* the user), this method notifies the Jalview alignment view that the
* matching sequences have changed as well.