From 3f2bb67fd23b74e0258fdb312b543b7c62dd6e75 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Mon, 29 Jan 2018 18:15:00 +0000 Subject: [PATCH] JAL-2800 start on validating input --- src/jalview/gui/TreeCalculationFrame.java | 31 +++++++++++++++++++++++++---- src/jalview/gui/TreeCalculationPanel.java | 2 ++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/TreeCalculationFrame.java b/src/jalview/gui/TreeCalculationFrame.java index 3a3208c..e037d22 100644 --- a/src/jalview/gui/TreeCalculationFrame.java +++ b/src/jalview/gui/TreeCalculationFrame.java @@ -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(); + } } diff --git a/src/jalview/gui/TreeCalculationPanel.java b/src/jalview/gui/TreeCalculationPanel.java index 9cdec7b..c9ea650 100644 --- a/src/jalview/gui/TreeCalculationPanel.java +++ b/src/jalview/gui/TreeCalculationPanel.java @@ -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); } } -- 1.7.10.2