JAL-4155 Viewport holds a reference to its AlignmentViewPanel - getter on gui.AlignVi...
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index 0e3bb9e..2b4074e 100644 (file)
@@ -138,6 +138,24 @@ public abstract class AlignmentViewport
     ranges = new ViewportRanges(al);
   }
 
+  protected AlignmentViewPanel alignPanel=null;
+  public void setAlignPanel(AlignmentViewPanel ap)
+  {
+    alignPanel = ap;
+  }
+  /**
+   * return the AlignmentViewPanel containing the given viewport. Use this to get the
+   * components currently handling the given viewport.
+   * 
+   * @param av
+   * @return null or an alignPanel guaranteed to have non-null alignFrame
+   *         reference
+   */
+  
+  public AlignmentViewPanel getAlignPanel()
+  {
+    return alignPanel;
+  }
   /**
    * @param name
    * @see jalview.api.ViewStyleI#setFontName(java.lang.String)
@@ -1027,6 +1045,7 @@ public abstract class AlignmentViewport
      * defensively null out references to large objects in case
      * this object is not garbage collected (as if!)
      */
+    alignPanel=null;
     consensus = null;
     complementConsensus = null;
     strucConsensus = null;