From dc1f37dde43ea16ea2afa729b3f9a02d766a21f0 Mon Sep 17 00:00:00 2001 From: Jan Kozusznik <jan@kozusznik.cz> Date: Fri, 23 Feb 2018 10:26:31 +0100 Subject: [PATCH] UI modifications --- .../it4i/fiji/haas/ui/ObservableValueRegistry.java | 4 ++-- .../ui/BenchmarkSPIMController.java | 13 +++++++------ .../ui/SPIMPipelineProgressView.fxml | 10 ++++------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ObservableValueRegistry.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ObservableValueRegistry.java index 355ab320..b47f0739 100644 --- a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ObservableValueRegistry.java +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/ObservableValueRegistry.java @@ -1,7 +1,7 @@ package cz.it4i.fiji.haas.ui; import java.util.Collection; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.Map; import java.util.function.Consumer; @@ -29,7 +29,7 @@ public class ObservableValueRegistry<T> { } - private Map<T,UpdatableObservableValue<T>> map = new HashMap<>(); + private Map<T,UpdatableObservableValue<T>> map = new LinkedHashMap<>(); public ObservableValue<T> addIfAbsent(T value) { UpdatableObservableValue<T> uov = map.computeIfAbsent(value, v-> new UpdatableObservableValue<T>(v, updateFunction, stateProvider)); 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 8a87a53e..c27c53b2 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 @@ -3,9 +3,10 @@ package cz.it4i.fiji.haas_spim_benchmark.ui; import java.awt.Desktop; import java.awt.Window; import java.io.IOException; -import java.util.Collection; import java.util.EnumSet; import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; import java.util.Set; import java.util.Timer; import java.util.TimerTask; @@ -177,8 +178,8 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont : new DummyProgress(); try { - Collection<BenchmarkJob> jobs = manager.getJobs(); - //jobs.forEach(bj->bj.getStateAsync(executorServiceJobState)); + List<BenchmarkJob> jobs = new LinkedList<>(manager.getJobs()); + jobs.sort((bj1, bj2) -> (int) (bj1.getId() - bj2.getId())); Set<ObservableValue<BenchmarkJob>> actual = new HashSet<>(this.jobs.getItems()); for (BenchmarkJob bj : jobs) { registry.addIfAbsent(bj); @@ -200,13 +201,13 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont } private void initTable() { - registry = new ObservableBenchmarkJobRegistry(bj -> remove(bj),executorServiceJobState); + registry = new ObservableBenchmarkJobRegistry(bj -> remove(bj), executorServiceJobState); setCellValueFactory(0, j -> j.getId() + ""); - setCellValueFactoryCompletable(1, - j -> j.getStateAsync(executorServiceJobState).thenApply(state -> "" + state)); + setCellValueFactoryCompletable(1, j -> j.getStateAsync(executorServiceJobState).thenApply(state -> "" + state)); setCellValueFactory(2, j -> j.getCreationTime().toString()); setCellValueFactory(3, j -> j.getStartTime().toString()); setCellValueFactory(4, j -> j.getEndTime().toString()); + // jobs.getSortOrder().add(jobs.getColumns().get(0)); } private void remove(BenchmarkJob bj) { diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressView.fxml b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressView.fxml index 294e40a6..bfa3ebbe 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressView.fxml +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/SPIMPipelineProgressView.fxml @@ -1,22 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> +<?import javafx.geometry.Insets?> <?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableView?> <?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.HBox?> -<?import javafx.geometry.Insets?> -<fx:root type="BorderPane" xmlns="http://javafx.com/javafx/8.0.65" - xmlns:fx="http://javafx.com/fxml/1" - fx:controller="cz.it4i.fiji.haas_spim_benchmark.ui.SPIMPipelineProgressViewController"> +<fx:root type="BorderPane" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cz.it4i.fiji.haas_spim_benchmark.ui.SPIMPipelineProgressViewController"> <center> <HBox> <children> - <TableView fx:id="tasks" HBox.hgrow="ALWAYS"> + <TableView fx:id="tasks" HBox.hgrow="ALWAYS"> <columns> - <TableColumn prefWidth="101.0" text="Task name" /> + <TableColumn prefWidth="179.0" text="Task name" /> </columns> </TableView> -- GitLab