[no commit message]

This commit is contained in:
Alexander Nozik 2016-08-01 21:37:59 +03:00
parent 8520015b9c
commit 645bf5eea4
4 changed files with 10 additions and 9 deletions

View File

@ -6,7 +6,6 @@
package inr.numass.actions;
import hep.dataforge.actions.GenericAction;
import hep.dataforge.computation.Work;
import hep.dataforge.computation.WorkManager.Callback;
import hep.dataforge.data.Data;
import hep.dataforge.data.DataFilter;
@ -21,6 +20,7 @@ import inr.numass.storage.NumassData;
import inr.numass.storage.NumassDataLoader;
import inr.numass.storage.NumassStorage;
import inr.numass.storage.SetDirectionUtility;
import java.util.concurrent.CompletableFuture;
/**
*
@ -42,7 +42,8 @@ public class ReadNumassStorageAction extends GenericAction<Void, NumassData> {
boolean reverseOnly = actionMeta.getBoolean("reverseOnly", false);
//FIXME make Work actually submitted only when calculation starts
Work<DataSet<NumassData>> process = getContext().workManager()
CompletableFuture<DataSet<NumassData>> future = getContext().workManager()
.<DataSet<NumassData>>post(getName(), (Callback callback) -> {
//FIXME remove in later revisions
SetDirectionUtility.load(getContext());
@ -83,7 +84,7 @@ public class ReadNumassStorageAction extends GenericAction<Void, NumassData> {
return builder.build();
});
return process.getTask().get();
return future.get();
} catch (Exception ex) {
throw new RuntimeException("Failed to load storage", ex);
}

View File

@ -139,7 +139,7 @@ public class MainViewerController implements Initializable {
}
private void loadDirectory(String path) {
getContext().workManager().post("viewer.loadDirectory", (WorkManager.Callback callback) -> {
getContext().workManager().submit("viewer.loadDirectory", (WorkManager.Callback callback) -> {
callback.updateTitle("Load storage (" + path + ")");
callback.setProgress(-1);
callback.updateMessage("Building numass storage tree...");
@ -162,7 +162,7 @@ public class MainViewerController implements Initializable {
public void setRootStorage(NumassStorage root) {
getContext().workManager().cleanup();
getContext().workManager().post("viewer.storage.load", (WorkManager.Callback callback) -> {
getContext().workManager().submit("viewer.storage.load", (WorkManager.Callback callback) -> {
callback.updateTitle("Fill data to UI (" + root.getName() + ")");
callback.setProgress(-1);
Platform.runLater(() -> statusBar.setProgress(-1));

View File

@ -85,7 +85,7 @@ public class MspViewController {
public void fillMspData(Storage rootStorage) {
if (rootStorage != null) {
context.workManager().post("viewer.msp.fill", (WorkManager.Callback callback) -> {
context.workManager().submit("viewer.msp.fill", (WorkManager.Callback callback) -> {
try {
// callback.updateTitle("Fill msp data (" + rootStorage.getName() + ")");

View File

@ -227,7 +227,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
public void loadData(NumassData data) {
this.data = data;
if (data != null) {
context.workManager().<List<NMPoint>>post("viewer.numass.load", (WorkManager.Callback callback) -> {
context.workManager().<List<NMPoint>>submit("viewer.numass.load", (WorkManager.Callback callback) -> {
callback.updateTitle("Load numass data (" + data.getName() + ")");
points = data.getNMPoints();
@ -252,7 +252,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
}
private void setupHVPane(Supplier<Table> hvData) {
context.workManager().post("viewer.numass.hv", (WorkManager.Callback callback) -> {
context.workManager().submit("viewer.numass.hv", (WorkManager.Callback callback) -> {
Table t = hvData.get();
Platform.runLater(() -> {
if (t != null) {
@ -356,7 +356,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
detectorPlot.removePlot();
}
context.workManager().post("viewer.numass.load.detector", (WorkManager.Callback callback) -> {
context.workManager().submit("viewer.numass.load.detector", (WorkManager.Callback callback) -> {
Meta plottableConfig = new MetaBuilder("plot")
.setValue("connectionType", "step")
.setValue("thickness", 2)