diff --git a/haas-imagej-client/pom.xml b/haas-imagej-client/pom.xml index 93bb30ca3b75300d021a081a811e593900b10d3f..c9d490c6a711dad7e375ad9350d535938d262eb7 100644 --- a/haas-imagej-client/pom.xml +++ b/haas-imagej-client/pom.xml @@ -1,4 +1,5 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -60,16 +61,16 @@ <properties> <license.licenseName>${license.base.licenseName}</license.licenseName> <license.copyrightOwners>${license.base.copyrightOwners}</license.copyrightOwners> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> - - + <dependencies> <dependency> <groupId>net.imagej</groupId> <artifactId>imagej</artifactId> <scope>provided</scope> </dependency> - + <dependency> <groupId>cz.it4i.fiji</groupId> <artifactId>haas-java-client</artifactId> @@ -90,10 +91,21 @@ <!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml --> <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - <version>1.19</version> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + <version>1.19</version> </dependency> - </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FutureValueUpdater.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FutureValueUpdater.java new file mode 100644 index 0000000000000000000000000000000000000000..8400e18a0d4a33a705ccce5a89c929487d0158aa --- /dev/null +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FutureValueUpdater.java @@ -0,0 +1,32 @@ +package cz.it4i.fiji.haas.ui; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; + +import cz.it4i.fiji.haas.ui.TableCellAdapter.TableCellUpdater; +import javafx.scene.control.TableCell; + +public class FutureValueUpdater<S, T, U extends CompletableFuture<T>> implements TableCellUpdater<S, U> { + + private final TableCellUpdater<S, T> inner; + private final Executor executor; + + public FutureValueUpdater(TableCellUpdater<S, T> inner, Executor exec) { + this.inner = inner; + this.executor = exec; + } + + @Override + public void accept(TableCell<?, ?> cell, U value, boolean empty) { + if (value != null) { + if (!value.isDone()) { + inner.accept(cell, null, empty); + } + value.thenAcceptAsync(val -> { + inner.accept(cell, val, empty); + }, executor); + } else { + inner.accept(cell, null, empty); + } + } +} \ No newline at end of file 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 f3c67a341f10bb75bb1d652f74de0263f03487d6..bbe3f18cb8d2e7f34a8304d66428849beb915e31 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 @@ -2,7 +2,6 @@ package cz.it4i.fiji.haas.ui; import java.io.IOException; import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Function; @@ -11,11 +10,9 @@ import java.util.function.Predicate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import cz.it4i.fiji.haas.ui.JavaFXRoutines.TableCellAdapter.TableCellUpdater; import javafx.application.Platform; import javafx.beans.value.ObservableValue; import javafx.fxml.FXMLLoader; -import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; @@ -23,63 +20,6 @@ public interface JavaFXRoutines { Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas.ui.CloseableControl.class); - static public class TableCellAdapter<S, T> extends TableCell<S, T> { - public interface TableCellUpdater<A, B> { - void accept(TableCell<?, ?> cell, B value, boolean empty); - } - - private final TableCellUpdater<S, T> updater; - - public TableCellAdapter(TableCellUpdater<S, T> updater) { - this.updater = updater; - } - - @Override - protected void updateItem(T item, boolean empty) { - if(empty) { - this.setText(""); - } else { - updater.accept(this, item, empty); - } - } - } - - static public class FutureValueUpdater<S, T, U extends CompletableFuture<T>> implements TableCellUpdater<S, U> { - - private final TableCellUpdater<S, T> inner; - private final Executor executor; - - public FutureValueUpdater(TableCellUpdater<S, T> inner, Executor exec) { - this.inner = inner; - this.executor = exec; - } - - @Override - public void accept(TableCell<?, ?> cell, U value, boolean empty) { - if (value != null) { - if (!value.isDone()) { - inner.accept(cell, null, empty); - } - value.thenAcceptAsync(val -> { - inner.accept(cell, val, empty); - }, executor); - } else { - inner.accept(cell, null, empty); - } - } - } - - static public class StringValueUpdater<S> implements TableCellUpdater<S, String> { - @Override - public void accept(TableCell<?, ?> cell, String value, boolean empty) { - if (value != null) { - cell.setText(value); - } else if (!empty) { - cell.setText("N/A"); - } - } - } - static void initRootAndController(String string, Object parent) { initRootAndController(string, parent, false); } diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/StringValueUpdater.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/StringValueUpdater.java new file mode 100644 index 0000000000000000000000000000000000000000..337e5c298bc9117289f1eae91654814d6b39e856 --- /dev/null +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/StringValueUpdater.java @@ -0,0 +1,15 @@ +package cz.it4i.fiji.haas.ui; + +import cz.it4i.fiji.haas.ui.TableCellAdapter.TableCellUpdater; +import javafx.scene.control.TableCell; + +public class StringValueUpdater<S> implements TableCellUpdater<S, String> { + @Override + public void accept(TableCell<?, ?> cell, String value, boolean empty) { + if (value != null) { + cell.setText(value); + } else if (!empty) { + cell.setText("N/A"); + } + } +} \ No newline at end of file diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/TableCellAdapter.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/TableCellAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..c623bcec425a5215687f1d0a838129e4297cd46a --- /dev/null +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/TableCellAdapter.java @@ -0,0 +1,24 @@ +package cz.it4i.fiji.haas.ui; + +import javafx.scene.control.TableCell; + +public class TableCellAdapter<S, T> extends TableCell<S, T> { + public interface TableCellUpdater<A, B> { + void accept(TableCell<?, ?> cell, B value, boolean empty); + } + + private final TableCellAdapter.TableCellUpdater<S, T> updater; + + public TableCellAdapter(TableCellAdapter.TableCellUpdater<S, T> updater) { + this.updater = updater; + } + + @Override + protected void updateItem(T item, boolean empty) { + if(empty) { + this.setText(""); + } else { + updater.accept(this, item, empty); + } + } +} \ No newline at end of file diff --git a/haas-java-client/pom.xml b/haas-java-client/pom.xml index f70f208e5052dded8f199dc8fd9dd4bd1e8691e2..4f94653735038043b94181ce3a1e673bf949d3cf 100644 --- a/haas-java-client/pom.xml +++ b/haas-java-client/pom.xml @@ -6,6 +6,9 @@ <version>0.0.2-SNAPSHOT</version> <name>HaaS library for Java</name> <packaging>jar</packaging> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> <build> <plugins> <plugin> @@ -19,6 +22,7 @@ </plugin> <plugin> <artifactId>maven-source-plugin</artifactId> + <version>3.0.1</version> <executions> <execution> <id>attach-sources</id> @@ -42,8 +46,7 @@ <artifactId>java-scpclient</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> - <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2 --> - + <!-- https://mvnrepository.com/artifact/javax.activation/activation --> <dependency> <groupId>javax.activation</groupId> @@ -74,8 +77,6 @@ <artifactId>jaxrpc</artifactId> <version>1.1</version> </dependency> - <!-- https://mvnrepository.com/artifact/javax.xml/saaj-api --> - <!-- https://mvnrepository.com/artifact/javax.xml/saaj-api --> <!-- https://mvnrepository.com/artifact/javax.xml.soap/saaj-api --> <dependency> <groupId>javax.xml.soap</groupId> diff --git a/haas-java-client/src/main/resources/configuration.properties.template b/haas-java-client/src/test/resources/configuration.properties.template similarity index 100% rename from haas-java-client/src/main/resources/configuration.properties.template rename to haas-java-client/src/test/resources/configuration.properties.template diff --git a/haas-spim-benchmark/pom.xml b/haas-spim-benchmark/pom.xml index 10057406c4c5b478647fc61aae0ee12efb56925d..fbd071531b78603705f442d64149771d448d44af 100644 --- a/haas-spim-benchmark/pom.xml +++ b/haas-spim-benchmark/pom.xml @@ -1,4 +1,5 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -59,13 +60,14 @@ <system>None</system> </ciManagement> - + <properties> <license.licenseName>${license.base.licenseName}</license.licenseName> <license.copyrightOwners>${license.base.copyrightOwners}</license.copyrightOwners> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> - + <dependencies> <dependency> <groupId>net.imagej</groupId> @@ -78,14 +80,14 @@ <artifactId>haas-imagej-client</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> - + <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.6</version> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> </dependency> - + <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> <dependency> <groupId>org.slf4j</groupId> @@ -103,21 +105,13 @@ <build> <plugins> <plugin> - <artifactId>maven-assembly-plugin</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> + <outputDirectory> + ${project.build.directory}/jars + </outputDirectory> </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> </plugin> </plugins> 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 dbe847aacfcf1f0d2ab39b11ceb38bae18154b46..07db5b7d40e84c853e315334b747d55b24d96508 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 @@ -28,11 +28,14 @@ import org.slf4j.LoggerFactory; import cz.it4i.fiji.haas.UploadingFileFromResource; import cz.it4i.fiji.haas.ui.CloseableControl; import cz.it4i.fiji.haas.ui.DummyProgress; +import cz.it4i.fiji.haas.ui.FutureValueUpdater; import cz.it4i.fiji.haas.ui.InitiableControl; import cz.it4i.fiji.haas.ui.JavaFXRoutines; import cz.it4i.fiji.haas.ui.ModalDialogs; import cz.it4i.fiji.haas.ui.ProgressDialog; import cz.it4i.fiji.haas.ui.ShellRoutines; +import cz.it4i.fiji.haas.ui.StringValueUpdater; +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_java_client.UploadingFile; @@ -323,9 +326,9 @@ public class BenchmarkSPIMControl extends BorderPane implements CloseableControl private void setCellValueFactoryCompletable(int index, Function<BenchmarkJob, CompletableFuture<String>> mapper) { JavaFXRoutines.setCellValueFactory(jobs, index, mapper); ((TableColumn<ObservableBenchmarkJob, CompletableFuture<String>>) jobs.getColumns().get(index)).setCellFactory( - column -> new JavaFXRoutines.TableCellAdapter<ObservableBenchmarkJob, CompletableFuture<String>>( - new JavaFXRoutines.FutureValueUpdater<ObservableBenchmarkJob, String, CompletableFuture<String>>( - new JavaFXRoutines.StringValueUpdater<ObservableBenchmarkJob>(), executorServiceFX))); + column -> new TableCellAdapter<ObservableBenchmarkJob, CompletableFuture<String>>( + new FutureValueUpdater<ObservableBenchmarkJob, String, CompletableFuture<String>>( + new StringValueUpdater<ObservableBenchmarkJob>(), executorServiceFX))); } private interface P_JobAction { 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 3580264fec1e5654b0b1c2389904f0f614d7f6b7..1a74b7a85a29e83d29b4916d03ba7b2e205dad15 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 @@ -23,6 +23,7 @@ import cz.it4i.fiji.haas.ui.CloseableControl; import cz.it4i.fiji.haas.ui.InitiableControl; import cz.it4i.fiji.haas.ui.JavaFXRoutines; 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; @@ -208,7 +209,7 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl } }); ((TableColumn<ObservableValue<Task>, TaskComputation>) this.tasks.getColumns().get(index)) - .setCellFactory(column -> new JavaFXRoutines.TableCellAdapter<>((cell, val, empty) -> { + .setCellFactory(column -> new TableCellAdapter<>((cell, val, empty) -> { if (val == null || empty) { cell.setText(EMPTY_VALUE); cell.setStyle(""); diff --git a/haas-spim-benchmark/src/main/resources/configuration.properties.template b/haas-spim-benchmark/src/main/resources/configuration.properties.template deleted file mode 100644 index 892ed0d0a691608a7070d5beb4c3c8e539c074ef..0000000000000000000000000000000000000000 --- a/haas-spim-benchmark/src/main/resources/configuration.properties.template +++ /dev/null @@ -1,4 +0,0 @@ -USER_NAME= -PASSWORD= -EMAIL= -PHONE= \ No newline at end of file diff --git a/java-scpclient/pom.xml b/java-scpclient/pom.xml index c4722b7ff67363cae337880fa9b54675f13cbddc..6028d1717e498460f60c2e409a876fb269a8ade8 100644 --- a/java-scpclient/pom.xml +++ b/java-scpclient/pom.xml @@ -7,6 +7,9 @@ <version>0.0.1-SNAPSHOT</version> <name>Scp client library for Java</name> <packaging>jar</packaging> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> <build> <plugins> <plugin>