From: gmungoc Date: Tue, 16 May 2017 13:10:40 +0000 (+0100) Subject: JAL-2517 restore complex colour scheme on Cancel in User Defined Colours X-Git-Tag: Release_2_10_2~3^2~60^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-2517cancelAppletColour;p=jalview.git JAL-2517 restore complex colour scheme on Cancel in User Defined Colours --- diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 95e36b5..845110e 100644 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -20,11 +20,14 @@ */ package jalview.appletgui; +import jalview.analysis.AAFrequency; import jalview.api.FeatureColourI; import jalview.datamodel.SequenceGroup; import jalview.renderer.ResidueShader; +import jalview.schemes.Blosum62ColourScheme; import jalview.schemes.ColourSchemeI; import jalview.schemes.FeatureColour; +import jalview.schemes.PIDColourScheme; import jalview.schemes.ResidueProperties; import jalview.schemes.UserColourScheme; import jalview.util.MessageManager; @@ -579,35 +582,25 @@ public class UserDefinedColours extends Panel implements ActionListener, return; } - Color[] newColours = new Color[24]; - for (int i = 0; i < 24; i++) - { - newColours[i] = oldColours.elementAt(i); - buttonPanel.getComponent(i).setBackground(newColours[i]); - } - - UserColourScheme ucs = new UserColourScheme(newColours); - if (ap != null) { if (seqGroup != null) { - seqGroup.cs = new ResidueShader(ucs); + seqGroup.cs = new ResidueShader(oldColourScheme); + if (oldColourScheme instanceof PIDColourScheme + || oldColourScheme instanceof Blosum62ColourScheme) + { + seqGroup.cs.setConsensus(AAFrequency.calculate( + seqGroup.getSequences(ap.av.getHiddenRepSequences()), 0, + ap.av.getAlignment().getWidth())); + } } else { - ap.av.setGlobalColourScheme(ucs); + ap.av.setGlobalColourScheme(oldColourScheme); } ap.paintAlignment(true); } - else if (jmol != null) - { - jmol.setJalviewColourScheme(ucs); - } - else if (pdbcanvas != null) - { - pdbcanvas.pdb.setColours(ucs); - } frame.setVisible(false); }