From 6c2b68627777b6731f3e1081fb7437b9678c9670 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 16 Oct 2018 16:38:10 +0100 Subject: [PATCH] JAL-3127 use AlignViewportI.addGroup to create & propagate groups to complement view and update structure views accordingly --- src/jalview/controller/AlignViewController.java | 15 ++++++++++----- src/jalview/gui/AlignFrame.java | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index d992e4e..a5a3591 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -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; } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 4d1f800..0c8c8a6 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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()); } } -- 1.7.10.2