JAL-2794 comments, selected node now doesn't have to be external per se
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 10 Nov 2017 13:38:33 +0000 (13:38 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 10 Nov 2017 13:38:33 +0000 (13:38 +0000)
src/jalview/ext/archaeopteryx/JalviewAptxBinding.java

index a3bff2d..755828d 100644 (file)
@@ -48,20 +48,17 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
   @Override
   public void actionPerformed(ActionEvent e)
   {
-
   }
 
   @Override
   public void mouseClicked(MouseEvent e)
   {
-
   }
 
   @Override
   public void mousePressed(MouseEvent e)
   {
     showNodeSelectionOnAlign(e);
-
   }
 
   @Override
@@ -72,13 +69,11 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
   @Override
   public void mouseEntered(MouseEvent e)
   {
-
   }
 
   @Override
   public void mouseExited(MouseEvent e)
   {
-
   }
 
   @Override
@@ -91,9 +86,9 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
       treeView.setFoundNodes0(
               new HashSet<Long>(seqsel.getSequences().size()));
 
-      for (SequenceI sequence : seqsel.getSequences())
+      for (SequenceI selectedSequence : seqsel.getSequences())
       {
-        PhylogenyNode matchingNode = sequencesBoundToNodes.get(sequence);
+        PhylogenyNode matchingNode = sequencesBoundToNodes.get(selectedSequence);
         if (matchingNode != null)
         {
           treeView.getFoundNodes0().add(matchingNode.getId());
@@ -107,33 +102,41 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI
 
   }
 
+  /**
+   * Note that this currently only checks external nodes
+   */
   @Override
   public void showNodeSelectionOnAlign(MouseEvent e)
   {
     final PhylogenyNode node = treeView.findNode(e.getX(), e.getY());
-    if (node != null && node.isExternal())
+    if (node != null)
     {
       SequenceI matchingSequence = nodesBoundToSequences.get(node);
-
-      if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) // shift is pressed
-      // (so multiple nodes
-      // can be selected)
+      if (matchingSequence != null)
       {
 
-      }
-      else
-      {
-        parentAvport.setSelectionGroup(null); // reset selection if shift isn't
-                                              // pressed
-      }
+        if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) // shift is pressed
+        // (so multiple nodes
+        // can be selected)
+        {
+          // something?
+
+        }
+        else
+        {
+          parentAvport.setSelectionGroup(null); // reset selection if shift
+                                                // isn't
+          // pressed
+        }
 
-      treeSelectionChanged(matchingSequence);
-      parentAvport.sendSelection(); // not actually needed?
+        treeSelectionChanged(matchingSequence);
+        parentAvport.sendSelection(); // not actually needed?
 
-      PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId());
+        PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId());
+      }
     }
 
-    }
+  }
 
   /**
    * Refactored from TreeCanvas