import org.forester.archaeopteryx.MainFrame;
import org.forester.phylogeny.PhylogenyNode;
-public class JalviewAptxBinding implements JalviewTreeViewerBindingI
+/**
+ * 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.
+ *
+ * @author kjvanderheide
+ *
+ */
+public final class JalviewAptxBinding implements JalviewTreeViewerBindingI
{
- org.forester.archaeopteryx.TreePanel treeView;
+ private org.forester.archaeopteryx.TreePanel treeView;
- AlignmentViewport parentAvport;
+ private AlignmentViewport parentAvport;
- final StructureSelectionManager ssm;
+ private final StructureSelectionManager ssm;
- Map<SequenceI, PhylogenyNode> sequencesBoundToNodes;
+ private Map<SequenceI, PhylogenyNode> sequencesBoundToNodes;
- Map<PhylogenyNode, SequenceI> nodesBoundToSequences;
+ private Map<PhylogenyNode, SequenceI> nodesBoundToSequences;
+ /**
+ *
+ * @param archaeopteryx
+ *
+ * @param jalviewAlignmentViewport
+ * alignment viewport from which the tree was calculated.
+ *
+ * @param alignMappedToNodes
+ * map with sequences used to calculate the tree and matching tree
+ * nodes as key, value pair respectively.
+ *
+ * @param nodesMappedToAlign
+ * map with tree nodes and matching sequences used to calculate the
+ * tree as key, value pair respectively.
+ */
public JalviewAptxBinding(final MainFrame archaeopteryx,
final AlignmentViewport jalviewAlignmentViewport,
final Map<SequenceI, PhylogenyNode> alignMappedToNodes,
final Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
{
+ // deal with/prohibit null values here as that will cause problems
parentAvport = jalviewAlignmentViewport;
sequencesBoundToNodes = alignMappedToNodes;
nodesBoundToSequences = nodesMappedToAlign;
ssm.addSelectionListener(this);
treeView.addMouseListener(this);
PaintRefresher.Register(treeView, parentAvport.getSequenceSetId());
+
}
@Override
else
{
parentAvport.setSelectionGroup(null); // reset selection if shift
- // isn't
- // pressed
+ // isn't pressed
}
treeSelectionChanged(matchingSequence);
}
/**
- * Refactored from TreeCanvas
+ * Refactored from TreeCanvas.
*
* @param sequence
+ * of the node selected in the tree viewer.
*/
public void treeSelectionChanged(final SequenceI sequence)
{