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

feature: get ready for update

pom.xml - define UTF8 as encoding, add copy dependend jars
refactoring - extract problematic inner classes
parent eee63448
No related branches found
No related tags found
No related merge requests found
Showing
with 122 additions and 101 deletions
<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>
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
......@@ -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);
}
......
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
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
......@@ -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>
......
<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>
......
......@@ -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 {
......
......@@ -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("");
......
USER_NAME=
PASSWORD=
EMAIL=
PHONE=
\ No newline at end of file
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment