From: gmungoc Date: Thu, 14 Sep 2017 09:03:50 +0000 (+0100) Subject: JAL-2727 method to check if PCAPanel thread is working X-Git-Tag: Release_2_10_3b1~74^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=df0df46c6900f9f425666ccfda9433411b801824;p=jalview.git JAL-2727 method to check if PCAPanel thread is working --- diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index a9f3966..e403dba 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -105,6 +105,11 @@ public class CalculationChooser extends JPanel List tips = new ArrayList(); + /* + * the most recently opened PCA results panel + */ + private PCAPanel pcaPanel; + /** * Constructor * @@ -534,7 +539,7 @@ public class CalculationChooser extends JPanel JvOptionPane.WARNING_MESSAGE); return; } - new PCAPanel(af.alignPanel, modelName, params); + pcaPanel = new PCAPanel(af.alignPanel, modelName, params); } /** @@ -592,4 +597,9 @@ public class CalculationChooser extends JPanel { } } + + public PCAPanel getPcaPanel() + { + return pcaPanel; + } } diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index f861a7c..9f52d26 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -79,6 +79,8 @@ public class PCAPanel extends GPCAPanel int top = 0; + private boolean working; + /** * Creates a new PCAPanel object using default score model and parameters * @@ -234,6 +236,7 @@ public class PCAPanel extends GPCAPanel message = MessageManager.getString("label.pca_calculating"); } progress.setProgressBar(message, progId); + working = true; try { calcSettings.setEnabled(false); @@ -252,6 +255,7 @@ public class PCAPanel extends GPCAPanel } catch (OutOfMemoryError er) { new OOMWarning("calculating PCA", er); + working = false; return; } finally { @@ -266,6 +270,7 @@ public class PCAPanel extends GPCAPanel .getString("label.principal_component_analysis"), 475, 450); this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); } + working = false; } @Override @@ -788,4 +793,14 @@ public class PCAPanel extends GPCAPanel top = t; zCombobox.setSelectedIndex(2); } + + /** + * Answers true if PCA calculation is in progress, else false + * + * @return + */ + public boolean isWorking() + { + return working; + } }