JAL-3127 use AlignViewportI.addGroup to create & propagate groups to complement view...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 16 Oct 2018 15:38:10 +0000 (16:38 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 16 Oct 2018 15:38:10 +0000 (16:38 +0100)
src/jalview/controller/AlignViewController.java
src/jalview/gui/AlignFrame.java

index d992e4e..a5a3591 100644 (file)
@@ -35,6 +35,7 @@ import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.io.DataSourceType;
 import jalview.io.FeaturesFile;
+import jalview.schemes.ColourSchemeI;
 import jalview.util.MessageManager;
 
 import java.awt.Color;
@@ -97,19 +98,23 @@ public class AlignViewController implements AlignViewControllerI
       viewport.getAlignment().deleteAllGroups();
       viewport.clearSequenceColours();
       viewport.setSelectionGroup(null);
+      ColourSchemeI colours = viewport.getGlobalColourScheme();
       // set view properties for each group
       for (int g = 0; g < gps.length; g++)
       {
         // gps[g].setShowunconserved(viewport.getShowUnconserved());
         gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
         viewport.getAlignment().addGroup(gps[g]);
-        Color col = new Color((int) (Math.random() * 255),
-                (int) (Math.random() * 255), (int) (Math.random() * 255));
-        col = col.brighter();
-        for (SequenceI sq : gps[g].getSequences(null))
+        if (colours != null)
         {
-          viewport.setSequenceColour(sq, col);
+          gps[g].setColourScheme(colours.getInstance(viewport, gps[g],
+                  viewport.getHiddenRepSequences()));
         }
+        Color col = new Color((int) (Math.random() * 255),
+                (int) (Math.random() * 255), (int) (Math.random() * 255));
+        gps[g].idColour = col;
+        viewport.setUpdateStructures(true);
+        viewport.addSequenceGroup(gps[g]);
       }
       return true;
     }
index 4d1f800..0c8c8a6 100644 (file)
@@ -5285,7 +5285,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       PaintRefresher.Refresh(this, viewport.getSequenceSetId());
       alignPanel.updateAnnotation();
-      alignPanel.paintAlignment(true, true);
+      alignPanel.paintAlignment(true,
+              viewport.needToUpdateStructureViews());
     }
   }