[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; package inr.numass.actions;
import hep.dataforge.actions.GenericAction; import hep.dataforge.actions.GenericAction;
import hep.dataforge.computation.Work;
import hep.dataforge.computation.WorkManager.Callback; import hep.dataforge.computation.WorkManager.Callback;
import hep.dataforge.data.Data; import hep.dataforge.data.Data;
import hep.dataforge.data.DataFilter; import hep.dataforge.data.DataFilter;
@ -21,6 +20,7 @@ import inr.numass.storage.NumassData;
import inr.numass.storage.NumassDataLoader; import inr.numass.storage.NumassDataLoader;
import inr.numass.storage.NumassStorage; import inr.numass.storage.NumassStorage;
import inr.numass.storage.SetDirectionUtility; 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); boolean reverseOnly = actionMeta.getBoolean("reverseOnly", false);
//FIXME make Work actually submitted only when calculation starts //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) -> { .<DataSet<NumassData>>post(getName(), (Callback callback) -> {
//FIXME remove in later revisions //FIXME remove in later revisions
SetDirectionUtility.load(getContext()); SetDirectionUtility.load(getContext());
@ -83,7 +84,7 @@ public class ReadNumassStorageAction extends GenericAction<Void, NumassData> {
return builder.build(); return builder.build();
}); });
return process.getTask().get(); return future.get();
} catch (Exception ex) { } catch (Exception ex) {
throw new RuntimeException("Failed to load storage", 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) { 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.updateTitle("Load storage (" + path + ")");
callback.setProgress(-1); callback.setProgress(-1);
callback.updateMessage("Building numass storage tree..."); callback.updateMessage("Building numass storage tree...");
@ -162,7 +162,7 @@ public class MainViewerController implements Initializable {
public void setRootStorage(NumassStorage root) { public void setRootStorage(NumassStorage root) {
getContext().workManager().cleanup(); 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.updateTitle("Fill data to UI (" + root.getName() + ")");
callback.setProgress(-1); callback.setProgress(-1);
Platform.runLater(() -> statusBar.setProgress(-1)); Platform.runLater(() -> statusBar.setProgress(-1));

View File

@ -85,7 +85,7 @@ public class MspViewController {
public void fillMspData(Storage rootStorage) { public void fillMspData(Storage rootStorage) {
if (rootStorage != null) { if (rootStorage != null) {
context.workManager().post("viewer.msp.fill", (WorkManager.Callback callback) -> { context.workManager().submit("viewer.msp.fill", (WorkManager.Callback callback) -> {
try { try {
// callback.updateTitle("Fill msp data (" + rootStorage.getName() + ")"); // 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) { public void loadData(NumassData data) {
this.data = data; this.data = data;
if (data != null) { 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() + ")"); callback.updateTitle("Load numass data (" + data.getName() + ")");
points = data.getNMPoints(); points = data.getNMPoints();
@ -252,7 +252,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
} }
private void setupHVPane(Supplier<Table> hvData) { 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(); Table t = hvData.get();
Platform.runLater(() -> { Platform.runLater(() -> {
if (t != null) { if (t != null) {
@ -356,7 +356,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
detectorPlot.removePlot(); 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") Meta plottableConfig = new MetaBuilder("plot")
.setValue("connectionType", "step") .setValue("connectionType", "step")
.setValue("thickness", 2) .setValue("thickness", 2)