JAL-1923 add groups to codon-complement and notify annotation update for all linked...
authorJim Procter <jprocter@issues.jalview.org>
Thu, 15 Oct 2015 12:59:22 +0000 (13:59 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 15 Oct 2015 12:59:22 +0000 (13:59 +0100)
src/jalview/gui/TreeCanvas.java

index 68573ef..aa79451 100755 (executable)
@@ -891,12 +891,13 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
           aps[a].av.setSelectionGroup(null);
           aps[a].av.getAlignment().deleteAllGroups();
           aps[a].av.clearSequenceColours();
-        }
-        if (av.getCodingComplement() != null)
-        {
-          av.getCodingComplement().setSelectionGroup(null);
-          av.getCodingComplement().getAlignment().deleteAllGroups();
-          av.getCodingComplement().clearSequenceColours();
+          if (aps[a].av.getCodingComplement() != null)
+          {
+            aps[a].av.getCodingComplement().setSelectionGroup(null);
+            aps[a].av.getCodingComplement().getAlignment()
+                    .deleteAllGroups();
+            aps[a].av.getCodingComplement().clearSequenceColours();
+          }
         }
         colourGroups();
       }
@@ -977,41 +978,45 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
         }
 
         aps[a].av.getAlignment().addGroup(new SequenceGroup(sg));
-      }
-
-      // TODO can we push all of the below into AlignViewportI?
-      final AlignViewportI codingComplement = av.getCodingComplement();
-      if (codingComplement != null)
-      {
-        SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, av,
-                codingComplement);
-        if (mappedGroup.getSequences().size() > 0)
+        // TODO can we push all of the below into AlignViewportI?
+        final AlignViewportI codingComplement = aps[a].av
+                .getCodingComplement();
+        if (codingComplement != null)
         {
-          codingComplement.getAlignment().addGroup(mappedGroup);
-          for (SequenceI seq : mappedGroup.getSequences())
+          if (codingComplement != null)
           {
-            codingComplement.setSequenceColour(seq, col.brighter());
+            SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
+                    av, codingComplement);
+            if (mappedGroup.getSequences().size() > 0)
+            {
+              codingComplement.getAlignment().addGroup(mappedGroup);
+              for (SequenceI seq : mappedGroup.getSequences())
+              {
+                codingComplement.setSequenceColour(seq, col.brighter());
+              }
+            }
           }
         }
       }
     }
 
-    // notify the panel to redo any group specific stuff.
+    // notify the panel(s) to redo any group specific stuff.
     for (int a = 0; a < aps.length; a++)
     {
       aps[a].updateAnnotation();
       // TODO: JAL-868 - need to ensure view colour change message is broadcast
       // to any Jmols listening in
-    }
+      final AlignViewportI codingComplement = aps[a].av
+              .getCodingComplement();
+      if (codingComplement != null)
+      {
+        ((AlignViewport) codingComplement).getAlignPanel()
+                .updateAnnotation();
+
+      }
 
-    if (av.getCodingComplement() != null)
-    {
-      ((AlignViewport) av.getCodingComplement()).getAlignPanel()
-              .updateAnnotation();
-      /*
-       * idPanel. repaint ()
-       */
     }
+
   }
 
   /**