JAL-1767 refactor associated view logic to public method and synchronise PCAPanel...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 15 Jan 2019 13:10:42 +0000 (13:10 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 15 Jan 2019 13:10:42 +0000 (13:10 +0000)
src/jalview/gui/PCAPanel.java

index df0cd03..3388d4d 100644 (file)
@@ -508,11 +508,7 @@ public class PCAPanel extends GPCAPanel
         @Override
         public void actionPerformed(ActionEvent evt)
         {
-          getRotatableCanvas().setApplyToAllViews(false);
-          getRotatableCanvas().av = panel.av;
-          getRotatableCanvas().ap = panel;
-          PaintRefresher.Register(PCAPanel.this,
-                  panel.av.getSequenceSetId());
+          selectAssociatedView(panel);
         }
       });
 
@@ -778,4 +774,21 @@ public class PCAPanel extends GPCAPanel
   {
     this.top = top;
   }
+
+  /**
+   * set the associated view for this PCA.
+   * 
+   * @param panel
+   */
+  public void selectAssociatedView(AlignmentPanel panel)
+  {
+    getRotatableCanvas().setApplyToAllViews(false);
+
+    ap = panel;
+    av = panel.av;
+
+    getRotatableCanvas().av = panel.av;
+    getRotatableCanvas().ap = panel;
+    PaintRefresher.Register(PCAPanel.this, panel.av.getSequenceSetId());
+  }
 }