diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/JavaFXRoutines.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/JavaFXRoutines.java index af36ca20c2c105a75cafbd70f597677e8adce11c..636c4583731fe801217c1af599006cc2aef04e5e 100644 --- a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/JavaFXRoutines.java +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/JavaFXRoutines.java @@ -20,6 +20,7 @@ import javafx.fxml.FXMLLoader; import javafx.scene.control.TableColumn; import javafx.scene.control.TableRow; import javafx.scene.control.TableView; +import javafx.scene.paint.Color; public interface JavaFXRoutines { @@ -97,12 +98,15 @@ public interface JavaFXRoutines { return pred.test(j.getValue()); } - static public<T,U extends ObservableValue<T>>void setOnDoubleClickAction(TableView<U> tableView ,ExecutorService executorService,Predicate<T> openAllowed, Consumer<T> r) { + static public <T, U extends ObservableValue<T>> void setOnDoubleClickAction( + TableView<U> tableView, ExecutorService executorService, + Predicate<U> openAllowed, Consumer<U> r) + { tableView.setRowFactory(tv -> { TableRow<U> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { - T rowData = row.getItem().getValue(); + U rowData = row.getItem(); if (openAllowed.test(rowData)) { executorService.execute(() -> r.accept(rowData)); } @@ -111,4 +115,9 @@ public interface JavaFXRoutines { return row; }); } + + public static String toCss(Color color) { + return "rgb(" + Math.round(color.getRed() * 255.0) + "," + Math.round(color + .getGreen() * 255.0) + "," + Math.round(color.getBlue() * 255.0) + ")"; + } } diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java index b195e1cfd4ad30403da3f3fd5758c852ccbd7509..21d82ca287458a6132ba32ae45c06c19c52d4701 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java @@ -92,11 +92,12 @@ public class BenchmarkJobManager implements Closeable { public void setDownloadNotifier(Progress progress) { job.setDownloadNotifier(downloadNotifier = - createDownloadNotifierProcessingResultCSV(convertTo(progress))); + createDownloadNotifierProcessingResultCSV(convertToProgressNotifier( + progress))); } public void setUploadNotifier(Progress progress) { - job.setUploadNotifier(convertTo(progress)); + job.setUploadNotifier(convertToProgressNotifier(progress)); } public synchronized void startJob(Progress progress) throws IOException { @@ -292,7 +293,7 @@ public class BenchmarkJobManager implements Closeable { return job.getFileTransferInfo(); } - private ProgressNotifier convertTo(Progress progress) { + private ProgressNotifier convertToProgressNotifier(Progress progress) { return progress == null ? null : new ProgressNotifierAdapter(progress); } diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ObservableBenchmarkJob.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ObservableBenchmarkJob.java index 1ae29df84c3823884a4e38855047a38d7a0314b7..e270b8614768048df1efd0f71fe67a514f029490 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ObservableBenchmarkJob.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/ObservableBenchmarkJob.java @@ -130,6 +130,7 @@ public class ObservableBenchmarkJob extends UpdatableObservableValue<BenchmarkJo @Override public void itemDone(Object item) { + fireValueChangedEvent(); } @Override diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMControl.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMControl.java index 3ed4ea4ac45ed7625b5361272575c33fccc66621..ccaf19944bba4cfff02719e3b2981bb2dd9256bc 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMControl.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/BenchmarkSPIMControl.java @@ -149,8 +149,8 @@ public class BenchmarkSPIMControl extends BorderPane implements }), job -> JavaFXRoutines.notNullValue(job, j -> j .getState() == JobState.Running || j.getState() == JobState.Queued)); - menu.addItem("Job dashboard", job -> openJobDetailsWindow(job.getValue()), - job -> JavaFXRoutines.notNullValue(job, j -> true)); + menu.addItem("Job dashboard", obsBenchmarkJob -> openJobDetailsWindow( + obsBenchmarkJob), job -> JavaFXRoutines.notNullValue(job, j -> true)); menu.addItem("Open job subdirectory", j -> openJobSubdirectory(j .getValue()), x -> JavaFXRoutines.notNullValue(x, j -> true)); menu.addItem("Open in BigDataViewer", j -> openBigDataViewer(j.getValue()), @@ -333,7 +333,8 @@ public class BenchmarkSPIMControl extends BorderPane implements setCellValueFactory(6, j -> decorateTransfer(registry.get(j) .getDownloadProgress())); JavaFXRoutines.setOnDoubleClickAction(jobs, executorServiceJobState, - openJobDetailsWindow -> true, bj -> openJobDetailsWindow(bj)); + openJobDetailsWindow -> true, obsBenchmarkJob -> openJobDetailsWindow( + obsBenchmarkJob)); } private String decorateTransfer(TransferProgress progress) { @@ -378,7 +379,7 @@ public class BenchmarkSPIMControl extends BorderPane implements "Doubleclick to open Dashboard"))); } - private void openJobDetailsWindow(BenchmarkJob job) { + private void openJobDetailsWindow(ObservableBenchmarkJob job) { new JobDetailWindow(root, job).setVisible(true); } diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransferController.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransferController.java index c4f85b95d134b08f66595c4ebb8328680c76f0b7..563519048d4ecaa280a6e4979279f300c667bc15 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransferController.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransferController.java @@ -3,21 +3,25 @@ package cz.it4i.fiji.haas_spim_benchmark.ui; import java.util.LinkedList; import java.util.List; -import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cz.it4i.fiji.haas.ui.CloseableControl; import cz.it4i.fiji.haas.ui.JavaFXRoutines; -import cz.it4i.fiji.haas.ui.UpdatableObservableValue; -import cz.it4i.fiji.haas.ui.UpdatableObservableValue.UpdateStatus; +import cz.it4i.fiji.haas.ui.TableCellAdapter; import cz.it4i.fiji.haas_java_client.FileTransferInfo; -import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; -import javafx.beans.value.ObservableValue; +import cz.it4i.fiji.haas_java_client.FileTransferState; +import cz.it4i.fiji.haas_spim_benchmark.core.ObservableBenchmarkJob; +import javafx.beans.InvalidationListener; +import javafx.beans.Observable; +import javafx.beans.value.ObservableValueBase; import javafx.fxml.FXML; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableRow; import javafx.scene.control.TableView; import javafx.scene.layout.BorderPane; +import javafx.scene.paint.Color; public class DataTransferController extends BorderPane implements CloseableControl @@ -25,55 +29,110 @@ public class DataTransferController extends BorderPane implements private static final String FXML_FILE_NAME = "DataTransfer.fxml"; - @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger( cz.it4i.fiji.haas_spim_benchmark.ui.DataTransferController.class); @FXML - private TableView<ObservableValue<FileTransferInfo>> filesToUpload; + private TableView<SimpleObservableValue<FileTransferInfo>> files; - private BenchmarkJob job; + private ObservableBenchmarkJob job; + + private final InvalidationListener listener = new InvalidationListener() { + + @Override + public void invalidated(final Observable observable) { + + if (!ObservableBenchmarkJob.class.isAssignableFrom(observable + .getClass())) + { + log.debug( + "Invalidated Observable is not of the ObservableBenchmarkJob type."); + return; + } + + files.getItems().clear(); + + final List<SimpleObservableValue<FileTransferInfo>> tempList = + new LinkedList<>(); + + ((ObservableBenchmarkJob) observable).getValue().getFileTransferInfo() + .forEach(i -> { + tempList.add(new SimpleObservableValue<>(i)); + }); + + files.getItems().addAll(tempList); + } + + }; public DataTransferController() { JavaFXRoutines.initRootAndController(FXML_FILE_NAME, this); initTable(); } - public void setJob(final BenchmarkJob job) { + public void setJob(final ObservableBenchmarkJob job) { this.job = job; - fillTable(); + this.job.addListener(listener); + listener.invalidated(job); } // -- CloseableControl methods -- @Override public void close() { - // DO NOTHING + job.removeListener(listener); } // -- Helper methods -- private void initTable() { - setCellValueFactory(0, f -> f.getPathAsString()); - setCellValueFactory(1, f -> f.getState().toString()); - } - private void setCellValueFactory(final int columnIndex, - final Function<FileTransferInfo, String> mapper) - { - JavaFXRoutines.setCellValueFactory(filesToUpload, columnIndex, mapper); + final int columnIndexPath = 0; + final int columnIndexState = 1; + + JavaFXRoutines.setCellValueFactory(files, columnIndexPath, f -> f + .getPathAsString()); + JavaFXRoutines.setCellValueFactory(files, columnIndexState, f -> f + .getState()); + + final TableColumn<SimpleObservableValue<FileTransferInfo>, FileTransferState> stateColumn = + (TableColumn<SimpleObservableValue<FileTransferInfo>, FileTransferState>) files + .getColumns().get(columnIndexState); + + stateColumn.setCellFactory(column -> new TableCellAdapter<>((cell, val, + empty) -> { + if (val == null || empty) { + return; + } + TableRow<SimpleObservableValue<FileTransferInfo>> currentRow = cell + .getTableRow(); + cell.setText(val.toString()); + if (val.equals(FileTransferState.Finished)) { + currentRow.setStyle("-fx-text-background-color: " + JavaFXRoutines + .toCss(Color.rgb(0x41, 0xB2, 0x80))); + } + else { + currentRow.setStyle("-fx-text-background-color: " + JavaFXRoutines + .toCss(Color.rgb(0x30, 0xA2, 0xCC))); + } + })); } - private void fillTable() { + // -- Private classes -- + + private class SimpleObservableValue<T> extends ObservableValueBase<T> { + + private final T wrappedObject; - final List<ObservableValue<FileTransferInfo>> tempList = new LinkedList<>(); + public SimpleObservableValue(final T wrappedObject) { + this.wrappedObject = wrappedObject; + } - job.getFileTransferInfo().forEach(i -> { - tempList.add(new UpdatableObservableValue<>(i, - x -> UpdateStatus.NotUpdated, x -> x)); - }); + @Override + public T getValue() { + return wrappedObject; + } - filesToUpload.getItems().addAll(tempList); } } 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 19ab930546830376a669a005df597c7a89578cd5..a4bf11d611953de70e32f53257787bc639774ba7 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 @@ -11,8 +11,8 @@ import cz.it4i.fiji.haas.ui.InitiableControl; import cz.it4i.fiji.haas.ui.JavaFXRoutines; import cz.it4i.fiji.haas_java_client.JobState; import cz.it4i.fiji.haas_java_client.SynchronizableFileType; -import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; import cz.it4i.fiji.haas_spim_benchmark.core.Constants; +import cz.it4i.fiji.haas_spim_benchmark.core.ObservableBenchmarkJob; import javafx.fxml.FXML; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; @@ -47,13 +47,13 @@ public class JobDetailControl extends TabPane implements CloseableControl, private final HaaSOutputObservableValueRegistry observableValueRegistry; - private final BenchmarkJob job; + private final ObservableBenchmarkJob job; - public JobDetailControl(final BenchmarkJob job) { + public JobDetailControl(final ObservableBenchmarkJob job) { JavaFXRoutines.initRootAndController("JobDetail.fxml", this); progressView.setJob(job); - observableValueRegistry = new HaaSOutputObservableValueRegistry(job, - Constants.HAAS_UPDATE_TIMEOUT / + observableValueRegistry = new HaaSOutputObservableValueRegistry(job + .getValue(), Constants.HAAS_UPDATE_TIMEOUT / Constants.UI_TO_HAAS_FREQUENCY_UPDATE_RATIO); errorOutput.setObservable(observableValueRegistry.createObservable( SynchronizableFileType.StandardErrorFile)); @@ -70,9 +70,12 @@ public class JobDetailControl extends TabPane implements CloseableControl, @Override public void init(final Window parameter) { - if (job.getState() == JobState.Disposed) { + if (job.getValue().getState() == JobState.Disposed) { // TODO: Handle this? - log.debug("Job " + job.getId() + " state has been resolved as Disposed."); + if (log.isInfoEnabled()) { + log.info("Job " + job.getValue().getId() + + " state has been resolved as Disposed."); + } } disableNonPermanentTabs(); @@ -100,9 +103,10 @@ public class JobDetailControl extends TabPane implements CloseableControl, * Checks whether execution details are available */ private boolean areExecutionDetailsAvailable() { - return job.getState() == JobState.Running || job - .getState() == JobState.Finished || job.getState() == JobState.Failed || - job.getState() == JobState.Canceled; + return job.getValue().getState() == JobState.Running || job.getValue() + .getState() == JobState.Finished || job.getValue() + .getState() == JobState.Failed || job.getValue() + .getState() == JobState.Canceled; } /* 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 60f7cef2a5d4ced2cdc4e3eaacff72245211c5ce..14b537a839d0a7db77752105141fb4362892ea9c 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 @@ -4,17 +4,17 @@ package cz.it4i.fiji.haas_spim_benchmark.ui; import java.awt.Window; 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.ObservableBenchmarkJob; public class JobDetailWindow extends FXFrame<JobDetailControl> { private static final long serialVersionUID = 1L; - public JobDetailWindow(Window parentWindow, BenchmarkJob job) { + public JobDetailWindow(Window parentWindow, ObservableBenchmarkJob job) { super(parentWindow, () -> { return new JobDetailControl(job); }); - setTitle("Job dashboard for job #" + job.getId()); + setTitle("Job dashboard for job #" + job.getValue().getId()); } } diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobPropertiesControl.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobPropertiesControl.java index 3cb8955dc892fa294ceb6a877d8a1c8564252680..c3d143634c5d5069b311adb80c8481d1ac935092 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobPropertiesControl.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/JobPropertiesControl.java @@ -15,13 +15,14 @@ import cz.it4i.fiji.haas.ui.JavaFXRoutines; import cz.it4i.fiji.haas.ui.ShellRoutines; import cz.it4i.fiji.haas.ui.UpdatableObservableValue; import cz.it4i.fiji.haas.ui.UpdatableObservableValue.UpdateStatus; -import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; +import cz.it4i.fiji.haas_spim_benchmark.core.ObservableBenchmarkJob; import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; import javafx.scene.control.TableView; import javafx.scene.layout.BorderPane; public class JobPropertiesControl extends BorderPane implements Closeable { + private static final String FXML_FILE_NAME = "JobProperties.fxml"; public static final Logger log = LoggerFactory .getLogger(cz.it4i.fiji.haas_spim_benchmark.ui.JobPropertiesControl.class); @@ -29,7 +30,7 @@ public class JobPropertiesControl extends BorderPane implements Closeable { @FXML private TableView<ObservableValue<P_Value>> properties; - private BenchmarkJob job; + private ObservableBenchmarkJob job; private final ExecutorService executorServiceUI; @@ -39,7 +40,7 @@ public class JobPropertiesControl extends BorderPane implements Closeable { initTable(); } - public void setJob(BenchmarkJob job) { + public void setJob(ObservableBenchmarkJob job) { this.job = job; fillTable(); } @@ -53,9 +54,9 @@ public class JobPropertiesControl extends BorderPane implements Closeable { setCellValueFactory(0, s -> s.getName()); setCellValueFactory(1, s -> s.getValueAsString()); JavaFXRoutines.setOnDoubleClickAction(properties, executorServiceUI, - rowData -> rowData.isOpenAllowed(), rowData -> { + rowData -> rowData.getValue().isOpenAllowed(), rowData -> { try { - ShellRoutines.openDirectoryInBrowser(rowData.getPath()); + ShellRoutines.openDirectoryInBrowser(rowData.getValue().getPath()); } catch (UnsupportedOperationException | IOException e) { // TODO: Escalate an error to the end user @@ -65,15 +66,17 @@ public class JobPropertiesControl extends BorderPane implements Closeable { } private void fillTable() { - properties.getItems() - .add(new UpdatableObservableValue<>( - new P_Value("Input", job.getInputDirectory(), "Demo data on the Salomon IT4I cluster"), - x -> UpdateStatus.NotUpdated, x -> x)); - properties.getItems().add(new UpdatableObservableValue<>( - new P_Value("Output", job.getOutputDirectory(), "N/A"), x -> UpdateStatus.NotUpdated, x -> x)); - - properties.getItems().add(new UpdatableObservableValue<>( - new P_Value("Working", job.getDirectory(), "N/A"), x -> UpdateStatus.NotUpdated, x -> x)); + properties.getItems().add(new UpdatableObservableValue<>(new P_Value( + "Input", job.getValue().getInputDirectory(), + "Demo data on the Salomon IT4I cluster"), x -> UpdateStatus.NotUpdated, + x -> x)); + properties.getItems().add(new UpdatableObservableValue<>(new P_Value( + "Output", job.getValue().getOutputDirectory(), "N/A"), + x -> UpdateStatus.NotUpdated, x -> x)); + + properties.getItems().add(new UpdatableObservableValue<>(new P_Value( + "Working", job.getValue().getDirectory(), "N/A"), + x -> UpdateStatus.NotUpdated, x -> x)); } @@ -82,6 +85,7 @@ public class JobPropertiesControl extends BorderPane implements Closeable { } private class P_Value { + private final String name; private final Path path; private final String textIfNull; diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/ObservableTaskRegistry.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/ObservableTaskRegistry.java index ef8cb259893d2436a71c70bc25440e0083712504..cde26a1e528be18554a83bf08e4084ad948f1320 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/ObservableTaskRegistry.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/ObservableTaskRegistry.java @@ -8,23 +8,27 @@ import cz.it4i.fiji.haas.ui.ObservableValueRegistry; import cz.it4i.fiji.haas.ui.UpdatableObservableValue; import cz.it4i.fiji.haas.ui.UpdatableObservableValue.UpdateStatus; import cz.it4i.fiji.haas_java_client.JobState; -import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; +import cz.it4i.fiji.haas_spim_benchmark.core.ObservableBenchmarkJob; import cz.it4i.fiji.haas_spim_benchmark.core.Task; import cz.it4i.fiji.haas_spim_benchmark.core.TaskComputation; -public class ObservableTaskRegistry extends ObservableValueRegistry<Task, UpdatableObservableValue<Task>> { +public class ObservableTaskRegistry extends + ObservableValueRegistry<Task, UpdatableObservableValue<Task>> +{ - private final Supplier<BenchmarkJob> jobSupplier; + private final Supplier<ObservableBenchmarkJob> jobSupplier; - public ObservableTaskRegistry(Supplier<BenchmarkJob> jobSupplier,Consumer<Task> removeConsumer) { - super(t -> update(t), t -> t.getComputations().stream().map(tc -> tc.getState()).collect(Collectors.toList()), - removeConsumer); + public ObservableTaskRegistry(Supplier<ObservableBenchmarkJob> jobSupplier, + Consumer<Task> removeConsumer) + { + super(t -> update(t), t -> t.getComputations().stream().map(tc -> tc + .getState()).collect(Collectors.toList()), removeConsumer); this.jobSupplier = jobSupplier; } @Override public void update() { - jobSupplier.get().getTasks(); + jobSupplier.get().getValue().getTasks(); super.update(); } diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressViewController.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressViewController.java index de63984030eb541f8c8d6fe7ab4f1a1d466ddd50..dc7fa8c782b752da89916d9822a3533d2919880f 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressViewController.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressViewController.java @@ -26,9 +26,9 @@ import cz.it4i.fiji.haas.ui.ModalDialogs; import cz.it4i.fiji.haas.ui.TableCellAdapter; import cz.it4i.fiji.haas.ui.TableViewContextMenu; import cz.it4i.fiji.haas_java_client.JobState; -import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkJobManager.BenchmarkJob; import cz.it4i.fiji.haas_spim_benchmark.core.Constants; import cz.it4i.fiji.haas_spim_benchmark.core.FXFrameExecutorService; +import cz.it4i.fiji.haas_spim_benchmark.core.ObservableBenchmarkJob; import cz.it4i.fiji.haas_spim_benchmark.core.Task; import cz.it4i.fiji.haas_spim_benchmark.core.TaskComputation; import javafx.beans.value.ObservableValue; @@ -64,18 +64,13 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl } else { result = taskExecutionState2Color.get(jobState); } - return toCss(result != null ? result : Color.ORANGE); - } - - private static String toCss(Color color) { - return "rgb(" + Math.round(color.getRed() * 255.0) + "," + Math.round(color.getGreen() * 255.0) + "," - + Math.round(color.getBlue() * 255.0) + ")"; + return JavaFXRoutines.toCss(result != null ? result : Color.ORANGE); } @FXML private TableView<ObservableValue<Task>> tasks; - private BenchmarkJob job; + private ObservableBenchmarkJob job; private Timer timer; private ObservableTaskRegistry registry; private final ExecutorService executorServiceWS; @@ -87,13 +82,7 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl init(); } - public SPIMPipelineProgressViewController(BenchmarkJob job) { - executorServiceWS = Executors.newSingleThreadExecutor(); - init(); - setJob(job); - } - - public void setJob(BenchmarkJob job) { + public void setJob(final ObservableBenchmarkJob job) { if (this.job != null) { throw new IllegalStateException("Job already set"); } @@ -160,9 +149,10 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl } private void fillTable() { - List<Task> processedTasks = job.getTasks(); + List<Task> processedTasks = job.getValue().getTasks(); if (processedTasks == null) { timer.schedule(new TimerTask() { + @Override public void run() { fillTable(); diff --git a/haas-spim-benchmark/src/main/resources/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransfer.fxml b/haas-spim-benchmark/src/main/resources/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransfer.fxml index 6637b253d3a9f6a98c2ac411069640f939e66a01..8be106ee03244ec7e14dbfc7c49847295de5e9bf 100644 --- a/haas-spim-benchmark/src/main/resources/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransfer.fxml +++ b/haas-spim-benchmark/src/main/resources/cz/it4i/fiji/haas_spim_benchmark/ui/DataTransfer.fxml @@ -10,7 +10,7 @@ <center> <HBox> <children> - <TableView fx:id="filesToUpload" prefHeight="400.0" prefWidth="500.0" HBox.hgrow="ALWAYS"> + <TableView fx:id="files" prefHeight="400.0" prefWidth="500.0" HBox.hgrow="ALWAYS"> <columns> <TableColumn prefWidth="400.0" text="File" /> <TableColumn prefWidth="100.0" text="Status" />