From 6746132759f6de25a29c113c724e805d114c9c1d Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 29 May 2015 14:56:36 +0100 Subject: [PATCH] JAL-1753 declare field with interface type; check for null dereference --- src/jalview/gui/AlignFrame.java | 7 +------ src/jalview/gui/PCAPanel.java | 2 +- src/jalview/gui/ProgressBar.java | 7 ++++++- src/jalview/gui/WebserviceInfo.java | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c659233..1b228d6 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -870,12 +870,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, updateEditMenuBar(); } - // methods for implementing IProgressIndicator - // need to refactor to a reusable stub class - // Map progressBars; - // - // Map progressBarHandlers; - private ProgressBar progressBar; + private IProgressIndicator progressBar; /* * (non-Javadoc) diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index cff9104..f4fd70b 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -58,7 +58,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, IProgressIndicator { - private ProgressBar progressBar; + private IProgressIndicator progressBar; RotatableCanvas rc; diff --git a/src/jalview/gui/ProgressBar.java b/src/jalview/gui/ProgressBar.java index 8ebc98d..5307f26 100644 --- a/src/jalview/gui/ProgressBar.java +++ b/src/jalview/gui/ProgressBar.java @@ -1,6 +1,7 @@ package jalview.gui; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -148,7 +149,11 @@ public class ProgressBar implements IProgressIndicator /* * lay out progress bar container hierarchy */ - SwingUtilities.getRoot(statusPanel).validate(); + Component root = SwingUtilities.getRoot(statusPanel); + if (root != null) + { + root.validate(); + } } /** diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index f530018..8e78b93 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -92,7 +92,7 @@ public class WebserviceInfo extends GWebserviceInfo implements JInternalFrame frame; - private ProgressBar progressBar; + private IProgressIndicator progressBar; @Override public void setVisible(boolean aFlag) -- 1.7.10.2