Merge remote-tracking branch 'origin/develop' into
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index dc5f7cc..885d79d 100644 (file)
@@ -107,6 +107,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
   private PropertyChangeListener propertyChangeListener;
 
+  private CalculationChooser calculationDialog;
+
   /**
    * Creates a new AlignmentPanel object.
    * 
@@ -170,6 +172,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
   {
     av.alignmentChanged(this);
 
+    if (getCalculationDialog() != null)
+    {
+      getCalculationDialog().validateCalcTypes();
+    }
+
     alignFrame.updateEditMenuBar();
 
     paintAlignment(true);
@@ -1654,6 +1661,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
     PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas());
     PaintRefresher.RemoveComponent(this);
 
+    closeChildFrames();
+
     /*
      * try to ensure references are nulled
      */
@@ -1685,6 +1694,17 @@ public class AlignmentPanel extends GAlignmentPanel implements
   }
 
   /**
+   * Close any open dialogs that would be orphaned when this one is closed
+   */
+  protected void closeChildFrames()
+  {
+    if (calculationDialog != null)
+    {
+      calculationDialog.closeFrame();
+    }
+  }
+
+  /**
    * hides or shows dynamic annotation rows based on groups and av state flags
    */
   public void updateAnnotation()
@@ -1913,4 +1933,24 @@ public class AlignmentPanel extends GAlignmentPanel implements
       repaint();
     }
   }
+
+  /**
+   * Set the reference to the PCA/Tree chooser dialog for this panel. This
+   * reference should be nulled when the dialog is closed.
+   * 
+   * @param calculationChooser
+   */
+  public void setCalculationDialog(CalculationChooser calculationChooser)
+  {
+    calculationDialog = calculationChooser;
+  }
+
+  /**
+   * Returns the reference to the PCA/Tree chooser dialog for this panel (null
+   * if none is open)
+   */
+  public CalculationChooser getCalculationDialog()
+  {
+    return calculationDialog;
+  }
 }