JAL-4155 Viewport holds a reference to its AlignmentViewPanel - getter on gui.AlignVi...
[jalview.git] / src / jalview / gui / AlignViewport.java
index 2d82579..79a16ba 100644 (file)
@@ -529,6 +529,16 @@ public class AlignViewport extends AlignmentViewport
                     this);
   }
 
+  
+  public boolean getSortByTree()
+  {
+    return sortByTree;
+  }
+
+  public void setSortByTree(boolean sort)
+  {
+    sortByTree = sort;
+  }
   /**
    * return the alignPanel containing the given viewport. Use this to get the
    * components currently handling the given viewport.
@@ -537,30 +547,11 @@ public class AlignViewport extends AlignmentViewport
    * @return null or an alignPanel guaranteed to have non-null alignFrame
    *         reference
    */
+  
   public AlignmentPanel getAlignPanel()
   {
-    AlignmentPanel[] aps = PaintRefresher
-            .getAssociatedPanels(this.getSequenceSetId());
-    for (int p = 0; aps != null && p < aps.length; p++)
-    {
-      if (aps[p].av == this)
-      {
-        return aps[p];
-      }
-    }
-    return null;
-  }
-
-  public boolean getSortByTree()
-  {
-    return sortByTree;
+    return (AlignmentPanel) alignPanel;
   }
-
-  public void setSortByTree(boolean sort)
-  {
-    sortByTree = sort;
-  }
-
   /**
    * Returns the (Desktop) instance of the StructureSelectionManager
    */