JAL-1632 validate CalculationChooser when selection or alignment changes
authorJim Procter <jprocter@issues.jalview.org>
Tue, 2 May 2017 16:59:01 +0000 (17:59 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 2 May 2017 16:59:01 +0000 (17:59 +0100)
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/SeqPanel.java

index ccb3464..04de50b 100644 (file)
@@ -171,6 +171,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
   {
     av.alignmentChanged(this);
 
+    if (getCalculationDialog() != null)
+    {
+      getCalculationDialog().validateCalcTypes();
+    }
+
     alignFrame.updateEditMenuBar();
 
     paintAlignment(true);
index e0b80fe..ab53c58 100644 (file)
@@ -1956,9 +1956,20 @@ public class SeqPanel extends JPanel implements MouseListener,
     // shared between viewports.
     boolean iSentTheSelection = (av == source || (source instanceof AlignViewport && ((AlignmentViewport) source)
             .getSequenceSetId().equals(av.getSequenceSetId())));
-    if (iSentTheSelection || !av.followSelection)
+
+    if (iSentTheSelection)
     {
-      return;
+      // respond to our own event by updating dependent dialogs
+      if (ap.getCalculationDialog() != null)
+      {
+        ap.getCalculationDialog().validateCalcTypes();
+      }
+
+      // process further ?
+      if (!av.followSelection)
+      {
+        return;
+      }
     }
 
     /*
@@ -2056,6 +2067,13 @@ public class SeqPanel extends JPanel implements MouseListener,
       PaintRefresher.Refresh(this, av.getSequenceSetId());
       // ap.paintAlignment(false);
     }
+
+    // lastly, update dependent dialogs
+    if (ap.getCalculationDialog() != null)
+    {
+      ap.getCalculationDialog().validateCalcTypes();
+    }
+
   }
 
   /**
@@ -2095,6 +2113,12 @@ public class SeqPanel extends JPanel implements MouseListener,
             av);
     av.setColumnSelection(cs);
 
+    // lastly, update any dependent dialogs
+    if (ap.getCalculationDialog() != null)
+    {
+      ap.getCalculationDialog().validateCalcTypes();
+    }
+
     PaintRefresher.Refresh(this, av.getSequenceSetId());
 
     return true;