JAL-2800 start on validating input
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Mon, 29 Jan 2018 18:15:00 +0000 (18:15 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Mon, 29 Jan 2018 18:15:00 +0000 (18:15 +0000)
src/jalview/gui/TreeCalculationFrame.java
src/jalview/gui/TreeCalculationPanel.java

index 3a3208c..e037d22 100644 (file)
@@ -1,18 +1,22 @@
 package jalview.gui;
 
-import java.awt.BorderLayout;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
 
 import javax.swing.JInternalFrame;
 
 public class TreeCalculationFrame extends JInternalFrame
 {
+  private AlignFrame af;
+
   private TreeCalculationPanel treeCalcPanel;
 
   public TreeCalculationFrame(AlignFrame alignFrame)
   {
-    treeCalcPanel = new TreeCalculationPanel(alignFrame);
+    af = alignFrame;
+    treeCalcPanel = new TreeCalculationPanel(af);
     init();
-    alignFrame.alignPanel.setTreeCalcPanel(this);
+    af.alignPanel.setTreeCalcPanel(this);
 
 
   }
@@ -20,8 +24,27 @@ public class TreeCalculationFrame extends JInternalFrame
   private void init()
   {
     this.setContentPane(treeCalcPanel);
-    setLayout(new BorderLayout());
+    this.addFocusListener(new FocusAdapter()
+    {
+
+      @Override
+      public void focusGained(FocusEvent e)
+      {
+        revalidateInput();
+      }
+    });
+
+
 
+  }
+
+  public void revalidateInput()
+  {
+    int nrSeqsChosen = af.getViewport().getAlignment().getHeight();
+    if (af.getViewport().getSelectionGroup() != null)
+    {
+      nrSeqsChosen = af.getViewport().getSelectionGroup().getSize();
+    }
 
 
   }
index 9cdec7b..c9ea650 100644 (file)
@@ -1,6 +1,7 @@
 package jalview.gui;
 
 import java.awt.BorderLayout;
+import java.awt.Color;
 
 import javax.swing.JPanel;
 
@@ -20,6 +21,7 @@ public class TreeCalculationPanel extends JPanel
   private void init()
   {
     setLayout(new BorderLayout());
+    this.setBackground(Color.WHITE);
 
   }
 }