JAL-3878 Fix progress updater bar to account for cancelled state.
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Tue, 19 Oct 2021 13:25:37 +0000 (15:25 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Tue, 19 Oct 2021 13:25:37 +0000 (15:25 +0200)
src/jalview/ws2/gui/ProgressBarUpdater.java

index 476308c..24c71d7 100644 (file)
@@ -3,7 +3,6 @@ package jalview.ws2.gui;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 
-import jalview.gui.AlignFrame;
 import jalview.gui.IProgressIndicator;
 import jalview.ws2.WSJob;
 import jalview.ws2.WSJobStatus;
@@ -33,13 +32,11 @@ public class ProgressBarUpdater implements PropertyChangeListener
     var job = (WSJob) evt.getSource();
     var oldStatus = (WSJobStatus) evt.getOldValue();
     var newStatus = (WSJobStatus) evt.getNewValue();
-    boolean wasRunning = oldStatus.isRunning() || oldStatus.isSubmitted();
-    boolean isRunning = newStatus.isRunning() || newStatus.isSubmitted();
-    if (!wasRunning && isRunning)
+    if (!oldStatus.isSubmitted() && newStatus.isSubmitted())
     {
       progressIndicator.setProgressBar(job.getServiceName(), job.getUid());
     }
-    else if (wasRunning && !isRunning)
+    if (newStatus.isDone() || newStatus.isCancelled())
     {
       progressIndicator.removeProgressBar(job.getUid());
     }