From: Jim Procter Date: Fri, 25 Mar 2016 14:52:04 +0000 (+0000) Subject: JAL-2034 make colour scheme update optional when group conservation is calculated... X-Git-Tag: Release_2_10_0~120^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=88d5ff9b60bc7c99a427c2d6fc9d04823e185d68;p=jalview.git JAL-2034 make colour scheme update optional when group conservation is calculated, and pass back a ‘change’ flag --- 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)