From: jprocter Date: Fri, 21 Sep 2012 16:18:34 +0000 (+0100) Subject: JAL-1171 refactor code to allow gui update for global status before and after results... X-Git-Tag: Jalview_2_9~307^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=13e2ec04aa9db3447f2888c604d1479d0b901d56;p=jalview.git JAL-1171 refactor code to allow gui update for global status before and after results are parsed --- diff --git a/src/jalview/ws/AWSThread.java b/src/jalview/ws/AWSThread.java index 7300462..eea756e 100644 --- a/src/jalview/ws/AWSThread.java +++ b/src/jalview/ws/AWSThread.java @@ -163,30 +163,7 @@ public abstract class AWSThread extends Thread jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); } // Decide on overall state based on collected jobs[] states - if (jstate.running > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); - } - else if (jstate.queuing > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_QUEUING); - } - else - { - jobComplete = true; - if (jstate.finished > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); - } - else if (jstate.error > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - } - else if (jstate.serror > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - } - } + updateGlobalStatus(jstate); if (!jobComplete) { try @@ -214,6 +191,34 @@ public abstract class AWSThread extends Thread } } + protected void updateGlobalStatus(JobStateSummary jstate) + { + if (jstate.running > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); + } + else if (jstate.queuing > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_QUEUING); + } + else + { + jobComplete = true; + if (jstate.finished > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); + } + else if (jstate.error > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } + else if (jstate.serror > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + } + } + } + public AWSThread() { super(); diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index 393f475..86f5fbc 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -845,9 +845,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI } else { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); wsInfo.setFinishedNoResults(); } + updateGlobalStatus(finalState); wsInfo.setProgressBar(null, progbar); }