diff --git a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java index 7b981a33910a5fdea3348929595ae54d5d544f3b..d3b26eee0516d0327439d5cce03534c70097b4b3 100644 --- a/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java +++ b/haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/FXFrame.java @@ -40,8 +40,7 @@ public abstract class FXFrame<T extends Parent&CloseableControl> extends JDialog private void init() { addWindowListener(new WindowAdapter() { @Override - public void windowClosed(WindowEvent e) { - super.windowClosed(e); + public void windowClosing(WindowEvent e) { getFxPanel().getControl().close(); } }); diff --git a/haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/HaaSFileTransferImp.java b/haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/HaaSFileTransferImp.java index bf07f5bda386340a0279b94f9e7e4b0fa8d52abb..14146fbb3d24f1e9b7bfa4415db3a32cdf70d0fd 100644 --- a/haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/HaaSFileTransferImp.java +++ b/haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/HaaSFileTransferImp.java @@ -111,14 +111,15 @@ class HaaSFileTransferImp implements HaaSFileTransfer { public List<Long> obtainSize(List<String> files) { try { return HaaSClient.getSizes(files.stream() - .map(filename -> "'" + ft.getSharedBasepath() + "/" + filename + "'").collect(Collectors.toList()), scpClient, notifier); + .map(filename -> "'" + ft.getSharedBasepath() + "/" + filename + "'").collect(Collectors.toList()), + scpClient, notifier); } catch (JSchException | IOException e) { throw new HaaSClientException(e); } } - //TASK merge with download - stream provider for file, consumer for stream + // TASK merge with download - stream provider for file, consumer for stream @Override public List<String> getContent(List<String> files) { List<String> result = new LinkedList<>(); @@ -132,8 +133,8 @@ class HaaSFileTransferImp implements HaaSFileTransfer { TransferFileProgressForHaaSClient progress = new TransferFileProgressForHaaSClient(totalFileSize, notifier); int idx = 0; for (String fileName : files) { - fileName = fileName.replaceFirst("/", ""); - try(ByteArrayOutputStream os = new ByteArrayOutputStream()) { + fileName = replaceIfFirstFirst(fileName, "/", ""); + try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { String fileToDownload = "'" + ft.getSharedBasepath() + "/" + fileName + "'"; String item; progress.addItem(item = fileName); @@ -151,4 +152,11 @@ class HaaSFileTransferImp implements HaaSFileTransfer { return result; } + private String replaceIfFirstFirst(String fileName, String string, String string2) { + if (fileName.length() < 0 && fileName.charAt(0) == '/') { + fileName = fileName.substring(1); + } + return fileName; + } + } 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 57813409aefdf5daa4a805de5ed0fb4f622cdb61..a72344edfde9cd0e2b323b0326c682b336feda1b 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 @@ -1,7 +1,5 @@ package cz.it4i.fiji.haas_spim_benchmark.ui; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -108,26 +106,9 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl } private void proof(ObservableValue<Task> task) { - executorServiceWS.execute(()-> { - TaskComputationAdapter adapter = new TaskComputationAdapter(task.getValue().getComputations().get(0)); - - - class Window extends cz.it4i.fiji.haas.ui.FXFrame<RemoteFilesInfoControl>{ - private static final long serialVersionUID = 1L; - - public Window() { - super(()-> new RemoteFilesInfoControl(adapter.getOutputs())); - } - } - - Window w = new Window(); - w.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - adapter.close(); - } - }); - w.setVisible(true);}); + //executorServiceWS.execute(()-> { + new TaskComputationWindow(null, task.getValue().getComputations().get(0)).setVisible(true); + //}); } static void add(Collection<ObservableValue<RemoteFileInfo>> files, String name, long size) { diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationAdapter.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationAdapter.java index 40750677982308c630b1d48ec805b2e96bd61f42..db7c53dddb3f1592530a5040b9156d3406fb61e7 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationAdapter.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationAdapter.java @@ -17,9 +17,6 @@ import cz.it4i.fiji.haas_spim_benchmark.core.TaskComputation.Log; import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValueBase; -//TASK: Pokračovat zapojením do UI - upravit pro TaskComputation -//TASK: dodělat progress dialog + modalita -// public class TaskComputationAdapter implements Closeable { @SuppressWarnings("unused") @@ -60,55 +57,17 @@ public class TaskComputationAdapter implements Closeable { outputs.add(new ObservableOutputFile(outputFile, size)); } - private class ObservableOutputFile extends ObservableValueBase<RemoteFileInfo> { - - private final String name; - - private Long size; - - private final RemoteFileInfo value = new RemoteFileInfo() { - - @Override - public Long getSize() { - return size; - } - - @Override - public String getName() { - return name; - } - }; - - public ObservableOutputFile(String name, Long size) { - this.name = name; - this.size = size; - } - - @Override - public RemoteFileInfo getValue() { - return value; - } - - public void setSize(Long newValue) { - Long oldValue = size; - size = newValue; - if (oldValue != newValue && oldValue != null && !oldValue.equals(newValue)) { - fireValueChangedEvent(); - } - } - } - public static class ObservableLog { - + private final String name; private final P_ObservableString value; - + public ObservableLog(Log content) { this.value = new P_ObservableString(content.getContent()); - this.name = log.getName(); + this.name = content.getName(); } - + public String getName() { return name; } @@ -116,23 +75,23 @@ public class TaskComputationAdapter implements Closeable { public ObservableValue<String> getContent() { return value; } - + public void setContentValue(Log log) { - if (!log.getName().equals(log.getName())) { + if (!getName().equals(log.getName())) { throw new IllegalArgumentException( "this.name=" + getName() + ", log.name=" + log.getName()); } value.setValue(log.getContent()); } - + private class P_ObservableString extends ObservableValueBase<String> { - + private String value; - + public P_ObservableString(String value) { this.value = value; } - + @Override public String getValue() { return value; @@ -149,6 +108,44 @@ public class TaskComputationAdapter implements Closeable { } + private class ObservableOutputFile extends ObservableValueBase<RemoteFileInfo> { + + private final String name; + + private Long size; + + private final RemoteFileInfo value = new RemoteFileInfo() { + + @Override + public Long getSize() { + return size; + } + + @Override + public String getName() { + return name; + } + }; + + public ObservableOutputFile(String name, Long size) { + this.name = name; + this.size = size; + } + + @Override + public RemoteFileInfo getValue() { + return value; + } + + public void setSize(Long newValue) { + Long oldValue = size; + size = newValue; + if (oldValue != newValue && oldValue != null && !oldValue.equals(newValue)) { + fireValueChangedEvent(); + } + } + } + private class P_TimerTask extends TimerTask { @Override diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationControl.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationControl.java index a80ffed94fb29e12bae982d7dd2eaf13f6285d3c..335fef6a6abc14b7e9340f616b7f876a246d5dd8 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationControl.java +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationControl.java @@ -15,7 +15,11 @@ import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; - +//TASK: context menu udělat pro TaskComputation (buňku) nikoliv řádek +//TASK: TaskComputationWindow - vyřešit vlákna na kterých se to spouští +//TASK: dodělat progress dialog + modalita +//TASK: vyřešit problém při konkurentním scp +//TASK: TaskComputationWindow - iniciální velikost okna public class TaskComputationControl extends TabPane implements CloseableControl, InitiableControl { @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_spim_benchmark.ui.TaskComputationControl.class); diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationView.fxml b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationView.fxml index f7daf956721ebf409e3fb2741a53c80a934a3d43..7d3d465d0e0a3c0e132b4ab70a8f5fe3ee227fab 100644 --- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationView.fxml +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationView.fxml @@ -10,31 +10,4 @@ <fx:root type="TabPane" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.65" fx:controller="cz.it4i.fiji.haas_spim_benchmark.ui.TaskComputationControl"> - <tabs> - <Tab closable="false" text="Progress"> - <content> - <HBox> - <SPIMPipelineProgressViewController fx:id="progressView" - HBox.hgrow="ALWAYS" /> - - </HBox> - </content> - </Tab> - <Tab closable="false" text="Snakemake output"> - <content> - <HBox> - <LogViewControl fx:id="errorOutput" HBox.hgrow="ALWAYS" /> - - </HBox> - </content> - </Tab> - <Tab closable="false" text="Other output"> - <content> - <HBox> - <LogViewControl fx:id="standardOutput" HBox.hgrow="ALWAYS" /> - </HBox> - </content> - - </Tab> - </tabs> </fx:root> diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationWindow.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationWindow.java new file mode 100644 index 0000000000000000000000000000000000000000..98f8f2aed4ea8afcefc63d18b253940befd16961 --- /dev/null +++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/TaskComputationWindow.java @@ -0,0 +1,18 @@ +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.TaskComputation; + +public class TaskComputationWindow extends FXFrame<TaskComputationControl> { + + private static final long serialVersionUID = 1L; + + public TaskComputationWindow(Window applicationFrame,TaskComputation computation) { + super(applicationFrame,()->new TaskComputationControl(computation)); + + } + + +}