TreeViewerUtils.associateNodesWithJalviewSequences(aptxApp, jalviewAlignport,
bindAptxNodes.getAlignmentWithNodes(),
bindAptxNodes.getNodesWithAlignment());
- TreeViewerUtils.addTreeViewFrameToJalview(aptxApp);
+ TreeViewerUtils.addTreeViewFrameToJalview(aptxApp, 400, 500);
// adaptAptxGui(aptxApp); //moved to AptxFrame
return aptxApp;
TreeViewerUtils.associateNodesWithJalviewSequences(aptxApp, jalviewAlignport,
bindAptxNodes.getAlignmentWithNodes(),
bindAptxNodes.getNodesWithAlignment());
- TreeViewerUtils.addTreeViewFrameToJalview(aptxApp);
+ TreeViewerUtils.addTreeViewFrameToJalview(aptxApp, 400, 500);
return aptxApp;
}
-package jalview.ext.archaeopteryx;
+package jalview.ext.treeviewer;
import jalview.analysis.AlignmentSorter;
import jalview.analysis.Conservation;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
-import jalview.ext.treeviewer.TreeFrameI;
-import jalview.ext.treeviewer.TreeI;
-import jalview.ext.treeviewer.TreeNodeI;
-import jalview.ext.treeviewer.TreePanelI;
-import jalview.ext.treeviewer.TreeViewerBindingI;
-import jalview.ext.treeviewer.TreeViewerUtils;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.Desktop;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.swing.SwingUtilities;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
/**
- * Class for binding the Archaeopteryx tree viewer to the Jalview alignment that
- * it originates from, meaning that selecting sequences in the tree viewer also
- * selects them in the alignment view and vice versa.
+ * Class for binding the tree viewer to the Jalview alignment that it originates
+ * from, meaning that selecting sequences in the tree viewer also selects them
+ * in the alignment view and vice versa.
*
* @author kjvanderheide
*
if (matchingSequence != null)
{
long nodeId = nodeToMatch.getId();
- addOrRemoveInSet(treeView.getMatchingNodesIds(), nodeId);
+ addOrRemoveInCollection(treeView.getMatchingNodesIds(), nodeId);
treeSelectionChanged(matchingSequence);
parentAvport.sendSelection();
if (matchingSequence != null)
{
long nodeId = childNode.getId();
- addOrRemoveInSet(treeView.getMatchingNodesIds(), nodeId);
+ addOrRemoveInCollection(treeView.getMatchingNodesIds(), nodeId);
treeSelectionChanged(matchingSequence);
/**
* TO BE MOVED
*
- * @param set
- * @param objectToCheck
+ * @param collection
+ * @param nodeId
*/
- public static <E> void addOrRemoveInSet(Set<E> set, E objectToCheck)
+ public static <E> void addOrRemoveInCollection(Collection<Long> collection,
+ long nodeId)
{
- if (set.contains(objectToCheck))
+ if (collection.contains(nodeId))
{
- set.remove(objectToCheck);
+ collection.remove(nodeId);
}
else
{
- set.add(objectToCheck);
+ collection.add(nodeId);
}
}
public int getHeight();
+ /**
+ * Method for adding a tree node to the Set of nodes that are associated with
+ * some operation outside of the tree, such as nodes belonging to currently
+ * selected Jalview alignment sequences.
+ *
+ * @param matchedNode
+ */
public void addToMatchingNodes(TreeNodeI matchedNode);
public abstract Set<Long> getMatchingNodesIds();
public abstract TreeI getTree();
+ /**
+ * Gets the File from where the Tree originates.
+ *
+ * @return
+ */
public abstract File getTreeFile();
public abstract Rectangle getVisibleArea();
public void setPreferredSize(Dimension preferredSize);
- /**
- *
- * @param file
- */
public abstract void setTreeFile(File file);
/**
+ * Checks if the tree has been cut to display just a sub tree.
*
- * @return
+ * @return True if the panel is currently showing only a subtree, otherwise
+ * false.
*/
public boolean showingSubTree();
import java.io.IOException;
/**
+ * Interface for reading in trees from a given source.
*
* @author kjvanderheide
*
public TreeI[] getParsedTrees();
+ /**
+ *
+ * @return Trees that were successfully parsed.
+ * @throws IOException
+ */
public TreeI[] parse() throws IOException;
public void setSource(Object source) throws IOException;
*/
public void partitionTree(final int x);
+ /**
+ * Looks up the given TreeNodeI in the tree and highlights Jalview sequences
+ * that belong to it or its descendants.
+ *
+ * @param parentNode
+ * node from where the descendants should get matched, this node
+ * should be internal.
+ */
public void showMatchingChildSequences(TreeNodeI parentNode);
+ /**
+ * Highlights the Jalview sequence belonging to the given TreeNodeI (if
+ * possible).
+ *
+ * @param nodeToMatch
+ */
public void showMatchingSequence(TreeNodeI nodeToMatch);
/**
* tree.
*
* @param alignPanel
- * Panel containing the alignment to be sorted.
+ * panel containing the alignment to be sorted.
* @return the sorting Command
*/
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.
+ */
public void sortByTree_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.
+ *
+ * @param sequence
+ * the new SequenceI that should be matched.
+ */
public void treeSelectionChanged(SequenceI sequence);
}
package jalview.ext.treeviewer;
import jalview.datamodel.SequenceI;
-import jalview.ext.archaeopteryx.JalviewBinding;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
import java.util.Map;
/**
- * Static class containing generic methods for
+ * Static class containing generic methods for communicating between the tree
+ * viewer frame and Jalview, currently includes adding the frame to the Jalview
+ * Desktop and triggering an association between an {@link AlignmentViewport}
+ * and {@link TreeFrameI}.
*
* @author kjvanderheide
*
private static Map<TreeFrameI, TreeViewerBindingI> activeViews = new HashMap<>();
/**
+ * Adds the given tree frame to the Jalview {@link Desktop}.
*
* @param treeFrame
- * @return
+ * @return the same tree frame but now as part of Jalview.
*/
public static TreeFrameI addTreeViewFrameToJalview(
- final TreeFrameI treeFrame)
+ final TreeFrameI treeFrame, int width, int height)
{
- int width = 400;
- int height = 550;
treeFrame.setMinimumSize(new Dimension(width, height));
// aptxApp.setFont(Desktop.instance.getFont());
// aptxApp.getMainPanel().setFont(Desktop.instance.getFont());
}
/**
+ * Convience method for building the association between Jalview's alignment
+ * and the tree frame.
*
* @param treeFrame
* @param jalviewAlignViewport