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

UI modifications

parent bfce76a0
No related branches found
No related tags found
1 merge request!14Iss1026
package cz.it4i.fiji.haas.ui; package cz.it4i.fiji.haas.ui;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
...@@ -29,7 +29,7 @@ public class ObservableValueRegistry<T> { ...@@ -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) { public ObservableValue<T> addIfAbsent(T value) {
UpdatableObservableValue<T> uov = map.computeIfAbsent(value, v-> new UpdatableObservableValue<T>(v, updateFunction, stateProvider)); UpdatableObservableValue<T> uov = map.computeIfAbsent(value, v-> new UpdatableObservableValue<T>(v, updateFunction, stateProvider));
......
...@@ -3,9 +3,10 @@ package cz.it4i.fiji.haas_spim_benchmark.ui; ...@@ -3,9 +3,10 @@ package cz.it4i.fiji.haas_spim_benchmark.ui;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Window; import java.awt.Window;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
...@@ -177,8 +178,8 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont ...@@ -177,8 +178,8 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont
: new DummyProgress(); : new DummyProgress();
try { try {
Collection<BenchmarkJob> jobs = manager.getJobs(); List<BenchmarkJob> jobs = new LinkedList<>(manager.getJobs());
//jobs.forEach(bj->bj.getStateAsync(executorServiceJobState)); jobs.sort((bj1, bj2) -> (int) (bj1.getId() - bj2.getId()));
Set<ObservableValue<BenchmarkJob>> actual = new HashSet<>(this.jobs.getItems()); Set<ObservableValue<BenchmarkJob>> actual = new HashSet<>(this.jobs.getItems());
for (BenchmarkJob bj : jobs) { for (BenchmarkJob bj : jobs) {
registry.addIfAbsent(bj); registry.addIfAbsent(bj);
...@@ -200,13 +201,13 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont ...@@ -200,13 +201,13 @@ public class BenchmarkSPIMController extends BorderPane implements CloseableCont
} }
private void initTable() { private void initTable() {
registry = new ObservableBenchmarkJobRegistry(bj -> remove(bj),executorServiceJobState); registry = new ObservableBenchmarkJobRegistry(bj -> remove(bj), executorServiceJobState);
setCellValueFactory(0, j -> j.getId() + ""); setCellValueFactory(0, j -> j.getId() + "");
setCellValueFactoryCompletable(1, setCellValueFactoryCompletable(1, j -> j.getStateAsync(executorServiceJobState).thenApply(state -> "" + state));
j -> j.getStateAsync(executorServiceJobState).thenApply(state -> "" + state));
setCellValueFactory(2, j -> j.getCreationTime().toString()); setCellValueFactory(2, j -> j.getCreationTime().toString());
setCellValueFactory(3, j -> j.getStartTime().toString()); setCellValueFactory(3, j -> j.getStartTime().toString());
setCellValueFactory(4, j -> j.getEndTime().toString()); setCellValueFactory(4, j -> j.getEndTime().toString());
// jobs.getSortOrder().add(jobs.getColumns().get(0));
} }
private void remove(BenchmarkJob bj) { private void remove(BenchmarkJob bj) {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.geometry.Insets?>
<fx:root type="BorderPane" xmlns="http://javafx.com/javafx/8.0.65" <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">
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="cz.it4i.fiji.haas_spim_benchmark.ui.SPIMPipelineProgressViewController">
<center> <center>
<HBox> <HBox>
<children> <children>
<TableView fx:id="tasks" HBox.hgrow="ALWAYS"> <TableView fx:id="tasks" HBox.hgrow="ALWAYS">
<columns> <columns>
<TableColumn prefWidth="101.0" text="Task name" /> <TableColumn prefWidth="179.0" text="Task name" />
</columns> </columns>
</TableView> </TableView>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment