From: jprocter Date: Wed, 24 Oct 2012 16:00:59 +0000 (+0100) Subject: JAL-1193 patch prevents JalviewJmolBinding from handling colourBySequence events... X-Git-Tag: Release_2_8~2^2~36 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e644829fd3fd8f07c9dd493c0eed9ab82bc8e636;p=jalview.git JAL-1193 patch prevents JalviewJmolBinding from handling colourBySequence events until setLoadingFromArchiveFinished(true) called --- diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 025b970..257ca8c 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -65,6 +65,12 @@ public abstract class JalviewJmolBinding implements StructureListener, * time. */ private boolean loadingFromArchive = false; + + /** + * second flag to indicate if the jmol viewer should ignore sequence colouring + * events from the structure manager because the GUI is still setting up + */ + private boolean loadingFinished = true; /** * state flag used to check if the Jmol viewer's paint method can be called @@ -566,7 +572,7 @@ public abstract class JalviewJmolBinding implements StructureListener, public void colourBySequence(boolean showFeatures, jalview.api.AlignmentViewPanel alignmentv) { - if (!colourBySequence) + if (!colourBySequence || !loadingFinished) return; if (ssm == null) { @@ -1438,10 +1444,24 @@ public abstract class JalviewJmolBinding implements StructureListener, { this.loadingFromArchive = loadingFromArchive; } - + + /** + * + * @return true if Jmol is still restoring state or loading is still going on (see setFinsihedLoadingFromArchive) + */ public boolean isLoadingFromArchive() { - return loadingFromArchive; + return loadingFromArchive && !loadingFinished; + } + + /** + * modify flag which controls if sequence colouring events are honoured by the binding. + * Should be true for normal operation + * @param finishedLoading + */ + public void setFinishedLoadingFromArchive(boolean finishedLoading) + { + loadingFinished = finishedLoading; } public void setBackgroundColour(java.awt.Color col)