JAL-2794 comments comments comments
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 10 Nov 2017 14:17:18 +0000 (14:17 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 10 Nov 2017 14:17:18 +0000 (14:17 +0000)
src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java
src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java
src/jalview/ext/archaeopteryx/JalviewAptxBinding.java
src/jalview/ext/archaeopteryx/JalviewTreeViewerBindingI.java

index 86f0020..744bf04 100644 (file)
@@ -13,10 +13,17 @@ import org.forester.archaeopteryx.MainFrame;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyNode;
 
+/**
+ * Static class for creating Archaeopteryx tree viewer instances from calculated
+ * trees and letting them be bound to Jalview.
+ * 
+ * @author kjvanderheide
+ *
+ */
 public final class ArchaeopteryxInit
 {
   /**
-   * This method should generally not be used as it does not bind the tree to
+   * Test method, should generally not be used as it does not bind the tree to
    * its alignment
    * 
    * @param aptxTrees
index 0bdd4e2..21a4e30 100644 (file)
@@ -16,8 +16,11 @@ import org.forester.phylogeny.data.NodeData;
 import org.forester.phylogeny.data.Sequence;
 
 /**
- * Note that this currently demands a 1:1 relationship between nodes and
- * sequences
+ * Class for converting trees made in Jalview (through TreeBuilder) to trees
+ * compatible with Forester (Phylogeny objects).
+ * 
+ * Note that this currently demands a 1:1 relationship between tree nodes and
+ * the sequences used for generating them.
  * 
  * @author kjvanderheide
  *
index 9466924..6a6b3f1 100644 (file)
@@ -18,23 +18,47 @@ import java.util.Map;
 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;
@@ -43,6 +67,7 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
     ssm.addSelectionListener(this);
     treeView.addMouseListener(this);
     PaintRefresher.Register(treeView, parentAvport.getSequenceSetId());
+
   }
 
   @Override
@@ -128,8 +153,7 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
         else
         {
           parentAvport.setSelectionGroup(null); // reset selection if shift
-                                                // isn't
-          // pressed
+                                                // isn't pressed
         }
 
         treeSelectionChanged(matchingSequence);
@@ -144,9 +168,10 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
   }
 
   /**
-   * Refactored from TreeCanvas
+   * Refactored from TreeCanvas.
    * 
    * @param sequence
+   *          of the node selected in the tree viewer.
    */
   public void treeSelectionChanged(final SequenceI sequence)
   {
index cb2f6ab..e9d6f81 100644 (file)
@@ -28,7 +28,8 @@ import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 
 /**
- * interface for binding a tree viewer to Jalview alignments
+ * Interface for binding a tree viewer to Jalview alignments. Assumes a tree
+ * viewer will both want to receive and send selection events
  * 
  * @author kjvanderheide
  *