From: Jim Procter Date: Tue, 16 Oct 2018 15:34:53 +0000 (+0100) Subject: viewport flag to indicate when structure view needs updating X-Git-Tag: Release_2_11_0~17^2~46^2~16 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=90b92c1738543661c2ab1e52d6662620ed705499;p=jalview.git viewport flag to indicate when structure view needs updating JAL-3127 fix regression on JAL-868 due to JAL-2773 --- diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index 931eba6..5180e20 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -490,4 +490,24 @@ public interface AlignViewportI extends ViewStyleI public abstract TreeModel getCurrentTree(); public abstract void setCurrentTree(TreeModel tree); + + /** + * @param update + * - set the flag for updating structures on next repaint + */ + void setUpdateStructures(boolean update); + + /** + * + * @return true if structure views will be updated on next refresh + */ + boolean isUpdateStructures(); + + /** + * check if structure views need to be updated, and clear the flag afterwards. + * + * @return if an update is needed + */ + boolean needToUpdateStructureViews(); + } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 60ef480..86e7489 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -536,7 +536,7 @@ public class AlignmentPanel extends GAlignmentPanel implements addNotify(); // TODO: many places call this method and also paintAlignment with various // different settings. this means multiple redraws are triggered... - paintAlignment(true, false); + paintAlignment(true, av.needToUpdateStructureViews()); } /** diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 278e682..dbb7e2b 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -1065,15 +1065,16 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } } } + // indicate that associated structure views will need an update + aps[a].av.setUpdateStructures(true); } } - // notify the panel(s) to redo any group specific stuff. + // notify the panel(s) to redo any group specific stuff + // also updates structure views if necessary for (int a = 0; a < aps.length; a++) { aps[a].updateAnnotation(); - // TODO: JAL-868 - need to ensure view colour change message is broadcast - // to any Jmols listening in final AlignViewportI codingComplement = aps[a].av .getCodingComplement(); if (codingComplement != null) diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 1366ada..c4923cf 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -2954,4 +2954,32 @@ public abstract class AlignmentViewport { return currentTree; } + + /** + * flag set to indicate if structure views might be out of sync with sequences + * in the alignment + */ + + private boolean needToUpdateStructureViews = false; + + @Override + public boolean isUpdateStructures() + { + return needToUpdateStructureViews; + } + + @Override + public void setUpdateStructures(boolean update) + { + needToUpdateStructureViews = update; + } + + @Override + public boolean needToUpdateStructureViews() + { + boolean update = needToUpdateStructureViews; + needToUpdateStructureViews = false; + return update; + } + }