Skip to content
Snippets Groups Projects
Commit bcd252ae authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Merge branch 'miscStuff' into 'master'

miscStuff: perform auto-formatting

See merge request fiji/haas-java-client!17
parents 54c707cc b91b20e3
No related branches found
No related tags found
1 merge request!17miscStuff: perform auto-formatting
package cz.it4i.fiji.haas.ui; package cz.it4i.fiji.haas.ui;
import java.awt.BorderLayout; import java.awt.BorderLayout;
...@@ -15,19 +16,21 @@ import org.slf4j.LoggerFactory; ...@@ -15,19 +16,21 @@ import org.slf4j.LoggerFactory;
import javafx.scene.Parent; import javafx.scene.Parent;
public abstract class FXFrame<T extends Parent & CloseableControl> extends
public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog { JDialog
{
@SuppressWarnings("unused") @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 static final long serialVersionUID = 1L;
private JFXPanel<T> fxPanel; private final JFXPanel<T> fxPanel;
public FXFrame(Supplier<T> fxSupplier) { public FXFrame(Supplier<T> fxSupplier) {
this(null, fxSupplier); this(null, fxSupplier);
} }
public FXFrame(Window parent, Supplier<T> fxSupplier){ public FXFrame(Window parent, Supplier<T> fxSupplier) {
super(parent, ModalityType.MODELESS); super(parent, ModalityType.MODELESS);
fxPanel = new JFXPanel<>(fxSupplier); fxPanel = new JFXPanel<>(fxSupplier);
init(); init();
...@@ -40,16 +43,16 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog ...@@ -40,16 +43,16 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog
public JFXPanel<T> getFxPanel() { public JFXPanel<T> getFxPanel() {
return fxPanel; return fxPanel;
} }
public void executeAdjustment(Runnable command) { public void executeAdjustment(Runnable command) {
JavaFXRoutines.runOnFxThread(() -> { JavaFXRoutines.runOnFxThread(() -> {
command.run(); command.run();
}); });
} }
private void init() { private void init() {
addWindowListener(new WindowAdapter() { addWindowListener(new WindowAdapter() {
@Override @Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
getFxPanel().getControl().close(); getFxPanel().getControl().close();
...@@ -58,14 +61,15 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog ...@@ -58,14 +61,15 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog
if (fxPanel.getControl() instanceof ResizeableControl) { if (fxPanel.getControl() instanceof ResizeableControl) {
ResizeableControl resizable = (ResizeableControl) fxPanel.getControl(); ResizeableControl resizable = (ResizeableControl) fxPanel.getControl();
addComponentListener(new ComponentAdapter() { addComponentListener(new ComponentAdapter() {
@Override @Override
public void componentResized(ComponentEvent e) { 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()); this.setLayout(new BorderLayout());
//JScrollPane scrollPane = new JScrollPane(this.fxPanel);
this.add(fxPanel, BorderLayout.CENTER); this.add(fxPanel, BorderLayout.CENTER);
JavaFXRoutines.runOnFxThread(() -> { JavaFXRoutines.runOnFxThread(() -> {
this.pack(); this.pack();
......
package cz.it4i.fiji.haas_spim_benchmark.ui; package cz.it4i.fiji.haas_spim_benchmark.ui;
import java.awt.Window; import java.awt.Window;
...@@ -16,33 +17,43 @@ import javafx.fxml.FXML; ...@@ -16,33 +17,43 @@ import javafx.fxml.FXML;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.control.TabPane; import javafx.scene.control.TabPane;
public class JobDetailControl extends TabPane implements CloseableControl, InitiableControl { public class JobDetailControl extends TabPane implements CloseableControl,
InitiableControl
{
@SuppressWarnings("unused") @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 HaaSOutputObservableValueRegistry observableValueRegistry;
private final BenchmarkJob job; private final BenchmarkJob job;
public JobDetailControl(BenchmarkJob job) { public JobDetailControl(BenchmarkJob job) {
JavaFXRoutines.initRootAndController("JobDetail.fxml", this); JavaFXRoutines.initRootAndController("JobDetail.fxml", this);
progressView.setJob(job); progressView.setJob(job);
observableValueRegistry = new HaaSOutputObservableValueRegistry(job, observableValueRegistry = new HaaSOutputObservableValueRegistry(job,
Constants.HAAS_UPDATE_TIMEOUT / Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO); Constants.HAAS_UPDATE_TIMEOUT /
errorOutput.setObservable(observableValueRegistry.createObservable(SynchronizableFileType.StandardErrorFile)); Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO);
standardOutput errorOutput.setObservable(observableValueRegistry.createObservable(
.setObservable(observableValueRegistry.createObservable(SynchronizableFileType.StandardOutputFile)); SynchronizableFileType.StandardErrorFile));
standardOutput.setObservable(observableValueRegistry.createObservable(
SynchronizableFileType.StandardOutputFile));
jobProperties.setJob(job); jobProperties.setJob(job);
observableValueRegistry.start(); observableValueRegistry.start();
this.job = job; this.job = job;
...@@ -54,16 +65,18 @@ public class JobDetailControl extends TabPane implements CloseableControl, Initi ...@@ -54,16 +65,18 @@ public class JobDetailControl extends TabPane implements CloseableControl, Initi
enableOnlySpecificTab(jobPropertiesTab); enableOnlySpecificTab(jobPropertiesTab);
} }
} }
private void enableOnlySpecificTab(Tab tabToLeaveEnabled) { 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); getSelectionModel().select(jobPropertiesTab);
} }
private boolean isExecutionDetailsAvailable(BenchmarkJob inspectedJob) { private boolean isExecutionDetailsAvailable(BenchmarkJob inspectedJob) {
return inspectedJob.getState() == JobState.Running || inspectedJob.getState() == JobState.Finished return inspectedJob.getState() == JobState.Running || inspectedJob
|| inspectedJob.getState() == JobState.Failed || inspectedJob.getState() == JobState.Canceled; .getState() == JobState.Finished || inspectedJob
.getState() == JobState.Failed || inspectedJob
.getState() == JobState.Canceled;
} }
@Override @Override
......
package cz.it4i.fiji.haas_spim_benchmark.ui; package cz.it4i.fiji.haas_spim_benchmark.ui;
import java.awt.Window; import java.awt.Window;
...@@ -5,18 +6,15 @@ import java.awt.Window; ...@@ -5,18 +6,15 @@ import java.awt.Window;
import cz.it4i.fiji.haas.ui.FXFrame; import cz.it4i.fiji.haas.ui.FXFrame;
import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; 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; private static final long serialVersionUID = 1L;
public JobDetailWindow(Window parentWindow, BenchmarkJob job) { public JobDetailWindow(Window parentWindow, BenchmarkJob job) {
super(parentWindow,()->{ super(parentWindow, () -> {
return new JobDetailControl(job); return new JobDetailControl(job);
}); });
setTitle("Job dashboard for #" + job.getId()); setTitle("Job dashboard for job #" + job.getId());
} }
} }
\ No newline at end of file
package cz.it4i.fiji.haas_spim_benchmark.ui; package cz.it4i.fiji.haas_spim_benchmark.ui;
import java.awt.Window; import java.awt.Window;
...@@ -5,30 +6,26 @@ import java.nio.file.Path; ...@@ -5,30 +6,26 @@ import java.nio.file.Path;
import cz.it4i.fiji.haas.ui.FXFrame; 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; private static final long serialVersionUID = 1L;
public NewJobWindow(Window parentWindow) { public NewJobWindow(Window parentWindow) {
super(parentWindow,()->{ super(parentWindow, () -> {
return new NewJobController(); return new NewJobController();
}); });
setTitle("Create job"); setTitle("Create job");
} }
public Path getInputDirectory(Path workingDirectory) { public Path getInputDirectory(Path workingDirectory) {
return getFxPanel().getControl().getInputDirectory(workingDirectory); return getFxPanel().getControl().getInputDirectory(workingDirectory);
} }
public Path getOutputDirectory(Path workingDirectory) { public Path getOutputDirectory(Path workingDirectory) {
return getFxPanel().getControl().getOutputDirectory(workingDirectory); return getFxPanel().getControl().getOutputDirectory(workingDirectory);
} }
public void setCreatePressedNotifier(Runnable runnable) { public void setCreatePressedNotifier(Runnable runnable) {
getFxPanel().getControl().setCreatePressedNotifier(runnable); getFxPanel().getControl().setCreatePressedNotifier(runnable);
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment