X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fstructures%2Fmodels%2FAAStructureBindingModel.java;h=61597573f2b62fd5a88dc85181f0a821de0f0bde;hb=9811278f9e18ee6cb88470dbae98da046734a0af;hp=21b0e3d33e95da8fba6c3b1aa478a824f7a49190;hpb=defb4c1d5b4edbd8fbd490f25c15ef1f1de6fe37;p=jalview.git diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 21b0e3d..6159757 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -796,13 +796,20 @@ public abstract class AAStructureBindingModel public abstract void colourByCharge(); /** - * colour any structures associated with sequences in the given alignment - * using the getFeatureRenderer() and getSequenceRenderer() renderers but only - * if colourBySequence is enabled. + * Recolours the displayed structures, if they are coloured by sequence, or + * 'show only visible alignment' is selected. This supports updating structure + * colours on either change of alignment colours, or change to the visible + * region of the alignment. */ public void colourBySequence(AlignmentViewPanel alignmentv) { - if (!colourBySequence || !isLoadingFinished()) + if (!isLoadingFinished()) + { + return; + } + // todo: property change event for visibleAlignment + // to avoid unnecessary redraws here + if (!colourBySequence && !isShowAlignmentOnly()) { return; } @@ -856,5 +863,23 @@ public abstract class AAStructureBindingModel * * @param alignViewportI */ - public abstract void showStructures(AlignViewportI alignViewportI); + public void showStructures(AlignViewportI alignViewportI) + { + // override with implementation + } + + @Override + public void updateColours(Object source) + { + AlignmentViewPanel ap = (AlignmentViewPanel) source; + // ignore events from panels not used to colour this view + if (!getViewer().isUsedforcolourby(ap)) + { + return; + } + if (!isLoadingFromArchive()) + { + colourBySequence(ap); + } + } }