diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java index d3b26eee0516d0327439d5cce03534c70097b4b3..23dda8e8dc97ad23bd3788559e814c3528e21897 100644 --- a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java @@ -30,11 +30,11 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog public FXFrame(Window parent, Supplier<T> fxSupplier) { super(parent, ModalityType.MODELESS); fxPanel = new JFXPanel<>(fxSupplier); + init(); if (fxPanel.getControl() instanceof InitiableControl) { InitiableControl control = (InitiableControl) fxPanel.getControl(); control.init(this); } - init(); } private void init() { diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ProgressDialog.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ProgressDialog.java index d32daed9ea44e1da7064025bda00b7d7d05047bd..c86acb066ac80fa35b9db30573361a743a3e55ba 100644 --- a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ProgressDialog.java +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ProgressDialog.java @@ -27,14 +27,13 @@ import net.imagej.updater.util.Progress; import net.imagej.updater.util.UpdateCanceledException; /** - * TODO * * @author Johannes Schindelin */ @SuppressWarnings("serial") public class ProgressDialog extends JDialog implements Progress { @SuppressWarnings("unused") - private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas.ui.ProgressDialog.class); + public final static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas.ui.ProgressDialog.class); JProgressBar progress; JButton detailsToggle; @@ -110,7 +109,6 @@ public class ProgressDialog extends JDialog implements Progress { if (title != null) setTitle(title); pack(); - //TASK: vyresit centrovani na predka if (owner != null) { final Dimension o = owner.getSize(); final Dimension size = getSize(); @@ -119,6 +117,8 @@ public class ProgressDialog extends JDialog implements Progress { setSize(size); } setLocation(owner.getX() + (o.width - size.width) / 2, owner.getY() + (o.height - size.height) / 2); + } else { + setLocationRelativeTo(owner); } final KeyAdapter keyAdapter = new KeyAdapter() { @@ -133,7 +133,6 @@ public class ProgressDialog extends JDialog implements Progress { detailsToggle.addKeyListener(keyAdapter); cancel.addKeyListener(keyAdapter); - setLocationRelativeTo(null); if (title != null) setVisible(true); } @@ -293,7 +292,7 @@ public class ProgressDialog extends JDialog implements Progress { return false; } - public static void main(final String[] args) { + private static void main(final String[] args) { final ProgressDialog dialog = new ProgressDialog(null, "Hello"); dialog.addItem("Bello"); dialog.setVisible(true); 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 bc42c23bdd874d22c6000783770e10247dfc7b67..bebabfe857c9584aefda302818241dc731f578a0 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 @@ -43,7 +43,7 @@ import net.imagej.updater.util.Progress; public class BenchmarkSPIMController extends BorderPane implements CloseableControl, InitiableControl { - @FXML + @FXML private TableView<ObservableValue<BenchmarkJob>> jobs; private BenchmarkJobManager manager; @@ -80,8 +80,7 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont }, Constants.HAAS_UPDATE_TIMEOUT, Constants.HAAS_UPDATE_TIMEOUT); initTable(); initMenu(); - updateJobs(); - + executorServiceFX.execute(this::updateJobs); } private void initMenu() { @@ -90,8 +89,8 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont menu.addItem("Start job", job -> executeWSCallAsync("Starting job", p -> { job.getValue().startJob(p); registry.get(job.getValue()).update(); - }), job -> JavaFXRoutines.notNullValue(job, j -> j.getState() == JobState.Configuring || j.getState() == JobState.Finished - || j.getState() == JobState.Failed)); + }), job -> JavaFXRoutines.notNullValue(job, j -> j.getState() == JobState.Configuring + || j.getState() == JobState.Finished || j.getState() == JobState.Failed)); menu.addItem("Cancel job", job -> executeWSCallAsync("Canceling job", p -> { job.getValue().cancelJob(); @@ -104,8 +103,9 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont } catch (IOException e) { log.error(e.getMessage(), e); } - }, job -> JavaFXRoutines.notNullValue(job, j -> j.getState() == JobState.Running || j.getState() == JobState.Finished - || j.getState() == JobState.Failed || j.getState() == JobState.Canceled)); + }, job -> JavaFXRoutines.notNullValue(job, + j -> j.getState() == JobState.Running || j.getState() == JobState.Finished + || j.getState() == JobState.Failed || j.getState() == JobState.Canceled)); menu.addItem("Download result", job -> executeWSCallAsync("Downloading data", p -> job.getValue().downloadData(p)), @@ -161,11 +161,11 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont if (manager == null) { return; } + Progress progress = showProgress + ? ModalDialogs.doModal(new ProgressDialog(root, "Updating jobs"), WindowConstants.DO_NOTHING_ON_CLOSE) + : new DummyProgress(); + executorServiceWS.execute(() -> { - Progress progress = showProgress - ? ModalDialogs.doModal(new ProgressDialog(root, "Updating jobs"), - WindowConstants.DO_NOTHING_ON_CLOSE) - : new DummyProgress(); try { List<BenchmarkJob> jobs = new LinkedList<>(manager.getJobs());