From 0dedee69ebd69d3a25b5c4b1a49dc59d2c4a7d0a Mon Sep 17 00:00:00 2001 From: Jan Kozusznik <jan@kozusznik.cz> Date: Thu, 25 Jan 2018 16:33:13 +0100 Subject: [PATCH] enable rerun --- .../ui/BenchmarkSPIMController.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMController.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMController.java index 78a9ef0d..d1b196b3 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMController.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMController.java @@ -91,9 +91,9 @@ public class BenchmarkSPIMController implements FXFrame.Controller { private void initMenu() { TableViewContextMenu<Job> menu = new TableViewContextMenu<>(jobs); - menu.addItem("Create job", x -> executeJobActionAsync("Creating job", p -> manager.createJob()), j -> true); + menu.addItem("Create job", x -> executeJobActionAsync("Creating job", false, p -> manager.createJob()), j -> true); menu.addItem("Start job", job -> executeJobActionAsync("Starting job", p -> job.startJob(p)), - job -> notNullValue(job, j -> j.getState() == JobState.Configuring)); + job -> notNullValue(job, j -> j.getState() == JobState.Configuring || j.getState() == JobState.Finished)); menu.addItem("Download result", job -> executeJobActionAsync("Downloading data", p -> job.downloadData(p)), job -> notNullValue(job, j -> EnumSet.of(JobState.Failed, JobState.Finished).contains(j.getState()) && !j.downloaded())); @@ -118,15 +118,21 @@ public class BenchmarkSPIMController implements FXFrame.Controller { log.error(e.getMessage(), e); }}); } - + private void executeJobActionAsync(String title, P_JobAction action) { + executeJobActionAsync(title, true, action); + } + + private void executeJobActionAsync(String title, boolean update, P_JobAction action) { executorService.execute(() -> { try { ProgressDialog dialog = ModalDialogs.doModal(new ProgressDialog(root, title), WindowConstants.DO_NOTHING_ON_CLOSE); action.doAction(dialog); dialog.done(); - updateJobs(); + if(update) { + updateJobs(); + } } catch (IOException e) { log.error(e.getMessage(), e); } -- GitLab