From 88d5ff9b60bc7c99a427c2d6fc9d04823e185d68 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 25 Mar 2016 14:52:04 +0000 Subject: [PATCH] =?utf8?q?JAL-2034=20make=20colour=20scheme=20update=20optio?= =?utf8?q?nal=20when=20group=20conservation=20is=20calculated,=20and=20pass=20?= =?utf8?q?back=20a=20=E2=80=98change=E2=80=99=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/datamodel/SequenceGroup.java | 33 +++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index c9afec7..ee4d7c2 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -504,14 +504,31 @@ public class SequenceGroup implements AnnotatedCollectionI } /** - * calculate residue conservation for group - but only if necessary. + * calculate residue conservation and colourschemes for group - but only if + * necessary. returns true if the calculation resulted in a visible change to + * group */ - public void recalcConservation() + public boolean recalcConservation() + { + return recalcConservation(false); + } + + /** + * calculate residue conservation for group - but only if necessary. returns + * true if the calculation resulted in a visible change to group + * + * @param defer + * when set, colourschemes for this group are not refreshed after + * recalculation + */ + public boolean recalcConservation(boolean defer) { if (cs == null && consensus == null && conservation == null) { - return; + return false; } + // TODO: try harder to detect changes in state in order to minimise + // recalculation effort try { Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes, @@ -545,16 +562,22 @@ public class SequenceGroup implements AnnotatedCollectionI } } } - if (cs != null) + if (cs != null && !defer) { + // TODO: JAL-2034 should cs.alignmentChanged modify return state cs.alignmentChanged(context != null ? context : this, null); + return true; + } + else + { + return false; } } catch (java.lang.OutOfMemoryError err) { // TODO: catch OOM System.out.println("Out of memory loading groups: " + err); } - + return false; } private void _updateConservationRow(Conservation c) -- 1.7.10.2