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 74f56f8125cbbe89bf6ca1d2dafd7ed56d5c8dcb..20baa48cd0e0463e3b73b219a80ae1cfbe68591c 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 @@ -1,3 +1,4 @@ + package cz.it4i.fiji.haas.ui; import java.awt.BorderLayout; @@ -15,19 +16,21 @@ import org.slf4j.LoggerFactory; import javafx.scene.Parent; - -public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog { +public abstract class FXFrame<T extends Parent & CloseableControl> extends + JDialog +{ @SuppressWarnings("unused") - private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas.ui.FXFrame.class); + private static Logger log = LoggerFactory.getLogger( + cz.it4i.fiji.haas.ui.FXFrame.class); private static final long serialVersionUID = 1L; - private JFXPanel<T> fxPanel; - + private final JFXPanel<T> fxPanel; + public FXFrame(Supplier<T> fxSupplier) { this(null, fxSupplier); } - - public FXFrame(Window parent, Supplier<T> fxSupplier){ + + public FXFrame(Window parent, Supplier<T> fxSupplier) { super(parent, ModalityType.MODELESS); fxPanel = new JFXPanel<>(fxSupplier); init(); @@ -40,16 +43,16 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog public JFXPanel<T> getFxPanel() { return fxPanel; } - + public void executeAdjustment(Runnable command) { JavaFXRoutines.runOnFxThread(() -> { command.run(); }); } - private void init() { addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent e) { getFxPanel().getControl().close(); @@ -58,14 +61,15 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog if (fxPanel.getControl() instanceof ResizeableControl) { ResizeableControl resizable = (ResizeableControl) fxPanel.getControl(); addComponentListener(new ComponentAdapter() { + @Override public void componentResized(ComponentEvent e) { - resizable.setSize(e.getComponent().getSize().getWidth(), e.getComponent().getSize().getHeight()); + resizable.setSize(e.getComponent().getSize().getWidth(), e + .getComponent().getSize().getHeight()); } }); } this.setLayout(new BorderLayout()); - //JScrollPane scrollPane = new JScrollPane(this.fxPanel); this.add(fxPanel, BorderLayout.CENTER); JavaFXRoutines.runOnFxThread(() -> { this.pack(); diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailControl.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailControl.java index db5d36219508e1c6cddffc0c0540c7824168be1f..cfdb1b38f676a32d6fb11470a4e70f60857a7a34 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailControl.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailControl.java @@ -1,3 +1,4 @@ + package cz.it4i.fiji.haas_spim_benchmark.ui; import java.awt.Window; @@ -16,33 +17,43 @@ import javafx.fxml.FXML; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; -public class JobDetailControl extends TabPane implements CloseableControl, InitiableControl { +public class JobDetailControl extends TabPane implements CloseableControl, + InitiableControl +{ + @SuppressWarnings("unused") - private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_spim_benchmark.ui.JobDetailControl.class); + private static Logger log = LoggerFactory.getLogger( + cz.it4i.fiji.haas_spim_benchmark.ui.JobDetailControl.class); + + @FXML + private SPIMPipelineProgressViewController progressView; - @FXML private SPIMPipelineProgressViewController progressView; + @FXML + private LogViewControl errorOutput; - @FXML private LogViewControl errorOutput; + @FXML + private LogViewControl standardOutput; + + @FXML + private JobPropertiesControl jobProperties; + + @FXML + private Tab jobPropertiesTab; - @FXML private LogViewControl standardOutput; - - @FXML private JobPropertiesControl jobProperties; - - @FXML private Tab jobPropertiesTab; - private final HaaSOutputObservableValueRegistry observableValueRegistry; private final BenchmarkJob job; - public JobDetailControl(BenchmarkJob job) { JavaFXRoutines.initRootAndController("JobDetail.fxml", this); progressView.setJob(job); observableValueRegistry = new HaaSOutputObservableValueRegistry(job, - Constants.HAAS_UPDATE_TIMEOUT / Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO); - errorOutput.setObservable(observableValueRegistry.createObservable(SynchronizableFileType.StandardErrorFile)); - standardOutput - .setObservable(observableValueRegistry.createObservable(SynchronizableFileType.StandardOutputFile)); + Constants.HAAS_UPDATE_TIMEOUT / + Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO); + errorOutput.setObservable(observableValueRegistry.createObservable( + SynchronizableFileType.StandardErrorFile)); + standardOutput.setObservable(observableValueRegistry.createObservable( + SynchronizableFileType.StandardOutputFile)); jobProperties.setJob(job); observableValueRegistry.start(); this.job = job; @@ -54,16 +65,18 @@ public class JobDetailControl extends TabPane implements CloseableControl, Initi enableOnlySpecificTab(jobPropertiesTab); } } - - + private void enableOnlySpecificTab(Tab tabToLeaveEnabled) { - getTabs().stream().filter(node -> node != tabToLeaveEnabled).forEach(node -> node.setDisable(true)); + getTabs().stream().filter(node -> node != tabToLeaveEnabled).forEach( + node -> node.setDisable(true)); getSelectionModel().select(jobPropertiesTab); } private boolean isExecutionDetailsAvailable(BenchmarkJob inspectedJob) { - return inspectedJob.getState() == JobState.Running || inspectedJob.getState() == JobState.Finished - || inspectedJob.getState() == JobState.Failed || inspectedJob.getState() == JobState.Canceled; + return inspectedJob.getState() == JobState.Running || inspectedJob + .getState() == JobState.Finished || inspectedJob + .getState() == JobState.Failed || inspectedJob + .getState() == JobState.Canceled; } @Override diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailWindow.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailWindow.java index fb7e4fcb337014d4489940621f0afa2bfc33344c..60f7cef2a5d4ced2cdc4e3eaacff72245211c5ce 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailWindow.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobDetailWindow.java @@ -1,3 +1,4 @@ + package cz.it4i.fiji.haas_spim_benchmark.ui; import java.awt.Window; @@ -5,18 +6,15 @@ import java.awt.Window; import cz.it4i.fiji.haas.ui.FXFrame; import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; -public class JobDetailWindow extends FXFrame<JobDetailControl>{ +public class JobDetailWindow extends FXFrame<JobDetailControl> { private static final long serialVersionUID = 1L; - - public JobDetailWindow(Window parentWindow, BenchmarkJob job) { - super(parentWindow,()->{ + super(parentWindow, () -> { return new JobDetailControl(job); - }); - setTitle("Job dashboard for #" + job.getId()); + setTitle("Job dashboard for job #" + job.getId()); } - -} \ No newline at end of file + +} diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java index 7d62083e06f1ff9712c663c13e2f1a9098805f64..ab0ce9fa8bcaa25c7bc1157cb8d40a76684c663c 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java @@ -1,3 +1,4 @@ + package cz.it4i.fiji.haas_spim_benchmark.ui; import java.awt.Window; @@ -5,30 +6,26 @@ import java.nio.file.Path; import cz.it4i.fiji.haas.ui.FXFrame; -public class NewJobWindow extends FXFrame<NewJobController>{ +public class NewJobWindow extends FXFrame<NewJobController> { private static final long serialVersionUID = 1L; - - public NewJobWindow(Window parentWindow) { - super(parentWindow,()->{ + super(parentWindow, () -> { return new NewJobController(); - }); setTitle("Create job"); } - + public Path getInputDirectory(Path workingDirectory) { return getFxPanel().getControl().getInputDirectory(workingDirectory); } - + public Path getOutputDirectory(Path workingDirectory) { return getFxPanel().getControl().getOutputDirectory(workingDirectory); } - public void setCreatePressedNotifier(Runnable runnable) { getFxPanel().getControl().setCreatePressedNotifier(runnable); } -} \ No newline at end of file +}