Dont duplicate annotations in multiple views
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 May 2007 07:13:03 +0000 (07:13 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 May 2007 07:13:03 +0000 (07:13 +0000)
src/jalview/gui/AlignFrame.java

index 5b56680..70752be 100755 (executable)
@@ -1614,21 +1614,24 @@ public class AlignFrame
        {
          // Duplicate sequence annotation in all views.
          AlignmentI[] alview = this.getViewAlignments();
-         for (int avnum=0;avnum<alview.length; avnum++)
+         for (int i = 0; i < sequences.length; i++)
          {
-           if (alview[avnum]!=alignment)
+           AlignmentAnnotation sann[] = sequences[i].getAnnotation();
+           if (sann == null)
+             continue;
+           for (int avnum = 0; avnum < alview.length; avnum++)
            {
-             // duplicate in a view other than the one with input focus
-             int avwidth = alview[avnum].getWidth()+1;
-             for (int i=0; i < sequences.length; i++)
+
+             if (alview[avnum] != alignment)
              {
-               AlignmentAnnotation sann[] = sequences[i].getAnnotation();
-               if (sann==null)
-                 continue;
+               // duplicate in a view other than the one with input focus
+               int avwidth = alview[avnum].getWidth() + 1;
+
                // this relies on sann being preserved after we modify the sequence's annotation array
                for (int a=0; a<sann.length; a++)
                {
                  AlignmentAnnotation newann = new AlignmentAnnotation(sann[a]);
+
                  sequences[i].addAlignmentAnnotation(newann);
                  newann.padAnnotation(avwidth);
                  alview[avnum].addAnnotation(newann); // annotation was duplicated earlier