[no commit message]
This commit is contained in:
parent
94dba3b02e
commit
695c0ee75b
4
numass-main/private/cache/retriever/catalog.xml
vendored
Normal file
4
numass-main/private/cache/retriever/catalog.xml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
|
||||
<system systemId="http://javafx.com/javafx/8.0.65" uri="www.oracle.com/technetwork/java/javase/overview/index.html"/>
|
||||
</catalog>
|
1087
numass-main/private/cache/retriever/www.oracle.com/technetwork/java/javase/overview/index.html
vendored
Normal file
1087
numass-main/private/cache/retriever/www.oracle.com/technetwork/java/javase/overview/index.html
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -43,6 +43,10 @@ import org.slf4j.LoggerFactory;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
import static java.util.Locale.setDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,7 +58,6 @@ public class NumassContext extends Context {
|
||||
loadPlugin("hep.dataforge:actions");
|
||||
loadPlugin("inr.numass:numass");
|
||||
setIO(new NumassIO());
|
||||
SetDirectionUtility.load(this);
|
||||
}
|
||||
|
||||
public static void printDescription(Context context, boolean allowANSI) throws DescriptorException {
|
||||
@ -79,11 +78,4 @@ public class NumassContext extends Context {
|
||||
writer.println("***End of actions list***");
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
SetDirectionUtility.save(this);
|
||||
super.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
sp.setCaching(false);
|
||||
NBkgSpectrum spectrum = new NBkgSpectrum(sp);
|
||||
|
||||
return new XYModel("tritium", spectrum, getAdapter(an));
|
||||
return new XYModel(spectrum, getAdapter(an));
|
||||
});
|
||||
|
||||
manager.addModel("scatter", (context, an) -> {
|
||||
@ -127,7 +127,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
NBkgSpectrum spectrum = new NBkgSpectrum(sp);
|
||||
sp.setCaching(false);
|
||||
|
||||
return new XYModel("scatter", spectrum, getAdapter(an));
|
||||
return new XYModel(spectrum, getAdapter(an));
|
||||
});
|
||||
|
||||
manager.addModel("scatter-empiric", (context, an) -> {
|
||||
@ -140,7 +140,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
|
||||
double weightReductionFactor = an.getDouble("weightReductionFactor", 2.0);
|
||||
|
||||
return new WeightedXYModel("scatter-empiric", spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
return new WeightedXYModel(spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
});
|
||||
|
||||
manager.addModel("scatter-empiric-variable", (context, an) -> {
|
||||
@ -162,7 +162,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
|
||||
double weightReductionFactor = an.getDouble("weightReductionFactor", 2.0);
|
||||
|
||||
WeightedXYModel res = new WeightedXYModel("scatter-variable", spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
WeightedXYModel res = new WeightedXYModel(spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
res.setMeta(an);
|
||||
return res;
|
||||
});
|
||||
@ -181,7 +181,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
spectrum = CustomNBkgSpectrum.tritiumBkgSpectrum(loss, tritiumBackground);
|
||||
}
|
||||
|
||||
return new XYModel("scatter-variable", spectrum, getAdapter(an));
|
||||
return new XYModel(spectrum, getAdapter(an));
|
||||
});
|
||||
|
||||
manager.addModel("scatter-empiric-experimental", (context, an) -> {
|
||||
@ -199,7 +199,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
double weightReductionFactor = an.getDouble("weightReductionFactor", 2.0);
|
||||
|
||||
WeightedXYModel res
|
||||
= new WeightedXYModel("scatter-empiric-experimental", spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
= new WeightedXYModel(spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
res.setMeta(an);
|
||||
return res;
|
||||
});
|
||||
@ -208,18 +208,21 @@ public class NumassPlugin extends BasicPlugin {
|
||||
double A = an.getDouble("resolution", 8.3e-5);//8.3e-5
|
||||
double from = an.getDouble("from", 13900d);
|
||||
double to = an.getDouble("to", 18700d);
|
||||
context.getReport().report("Setting up tritium model with real transmission function");
|
||||
BivariateFunction resolutionTail = ResolutionFunction.getRealTail();
|
||||
RangedNamedSetSpectrum beta = new BetaSpectrum(context.io().getFile("FS.txt"));
|
||||
ModularSpectrum sp = new ModularSpectrum(beta, new ResolutionFunction(A, resolutionTail), from, to);
|
||||
if (!an.getBoolean("caching", false)) {
|
||||
context.getReport().report("Caching turned off");
|
||||
sp.setCaching(false);
|
||||
}
|
||||
//Adding trapping energy dependence
|
||||
//Intercept = 4.95745, B1 = -0.36879, B2 = 0.00827
|
||||
sp.setTrappingFunction((Ei,Ef)->LossCalculator.getTrapFunction().value(Ei, Ef)*(4.95745-0.36879*Ei+0.00827*Ei*Ei));
|
||||
context.getReport().report("Using folowing trapping energy dependecy^ {}", "4.95745-0.36879*Ei+0.00827*Ei*Ei");
|
||||
NBkgSpectrum spectrum = new NBkgSpectrum(sp);
|
||||
|
||||
return new XYModel("tritium", spectrum, getAdapter(an));
|
||||
return new XYModel(spectrum, getAdapter(an));
|
||||
});
|
||||
|
||||
manager.addModel("modularbeta-unadeabatic", (context, an) -> {
|
||||
@ -240,7 +243,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
sp.setCaching(false);
|
||||
NBkgSpectrum spectrum = new NBkgSpectrum(sp);
|
||||
|
||||
return new XYModel("tritium", spectrum, getAdapter(an));
|
||||
return new XYModel(spectrum, getAdapter(an));
|
||||
});
|
||||
|
||||
manager.addModel("gun", (context, an) -> {
|
||||
@ -255,7 +258,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
spectrum = CustomNBkgSpectrum.tritiumBkgSpectrum(gsp, tritiumBackground);
|
||||
}
|
||||
|
||||
return new XYModel("gun", spectrum, getAdapter(an));
|
||||
return new XYModel(spectrum, getAdapter(an));
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ package inr.numass.actions;
|
||||
|
||||
import hep.dataforge.actions.GenericAction;
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.context.DFProcess;
|
||||
import hep.dataforge.context.ProcessManager.Callback;
|
||||
import hep.dataforge.data.Data;
|
||||
import hep.dataforge.data.DataFilter;
|
||||
import hep.dataforge.data.DataNode;
|
||||
@ -14,13 +16,13 @@ import hep.dataforge.data.DataSet;
|
||||
import hep.dataforge.data.StaticData;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.storage.api.Loader;
|
||||
import hep.dataforge.storage.commons.StorageUtils;
|
||||
import inr.numass.storage.NumassData;
|
||||
import inr.numass.storage.NumassDataLoader;
|
||||
import inr.numass.storage.NumassStorage;
|
||||
import inr.numass.storage.SetDirectionUtility;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -38,45 +40,51 @@ public class ReadNumassStorageAction extends GenericAction<Void, NumassData> {
|
||||
NumassStorage storage = NumassStorage.buildNumassRoot(actionMeta.getString("uri"), true, false);
|
||||
DataFilter filter = new DataFilter().configure(actionMeta);
|
||||
|
||||
DataSet.Builder<NumassData> builder = DataSet.builder(NumassData.class);
|
||||
|
||||
boolean forwardOnly = actionMeta.getBoolean("forwardOnly", false);
|
||||
boolean reverseOnly = actionMeta.getBoolean("reverseOnly", false);
|
||||
|
||||
StorageUtils.loaderStream(storage).forEach(pair -> {
|
||||
Loader loader = pair.getValue();
|
||||
if (loader instanceof NumassData) {
|
||||
NumassDataLoader nd = (NumassDataLoader) loader;
|
||||
boolean reversed = nd.isReversed();
|
||||
if ((reverseOnly && reversed) || (forwardOnly && !reversed) || (!forwardOnly && !reverseOnly)) {
|
||||
DFProcess<DataSet<NumassData>> process = context.processManager().<DataSet<NumassData>>post(getName(), (Callback callback) -> {
|
||||
//FIXME remove in later revisions
|
||||
SetDirectionUtility.load(context);
|
||||
|
||||
DataSet.Builder<NumassData> builder = DataSet.builder(NumassData.class);
|
||||
callback.setMaxProgress(StorageUtils.loaderStream(storage).count());
|
||||
StorageUtils.loaderStream(storage).forEach(pair -> {
|
||||
Loader loader = pair.getValue();
|
||||
if (loader instanceof NumassData) {
|
||||
NumassDataLoader nd = (NumassDataLoader) loader;
|
||||
Data<NumassData> datum = new StaticData<>(nd);
|
||||
if (filter.acceptData(pair.getKey(), datum)) {
|
||||
builder.putData(pair.getKey(), datum);
|
||||
boolean accept = true;
|
||||
if (forwardOnly || reverseOnly) {
|
||||
boolean reversed = nd.isReversed();
|
||||
accept = (reverseOnly && reversed) || (forwardOnly && !reversed);
|
||||
}
|
||||
if (accept) {
|
||||
builder.putData(pair.getKey(), datum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// DataSet.Builder<NumassData> builder = DataSet.builder(NumassData.class);
|
||||
//
|
||||
// StorageUtils.loaderStream(storage).forEach(pair -> {
|
||||
// Loader loader = pair.getValue();
|
||||
// if (loader instanceof NumassData) {
|
||||
// Data<NumassData> datum = new StaticData<>((NumassData) loader);
|
||||
// if (filter.acceptData(pair.getKey(), datum)) {
|
||||
// builder.putData(pair.getKey(), datum);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
callback.increaseProgress(1d);
|
||||
});
|
||||
|
||||
storage.legacyFiles().forEach(nd -> {
|
||||
Data<NumassData> datum = new StaticData<>(nd);
|
||||
if (filter.acceptData(nd.getName(), datum)) {
|
||||
builder.putData("legacy." + nd.getName(), datum);
|
||||
if (actionMeta.getBoolean("loadLegacy", false)) {
|
||||
logger().info("Loading legacy files");
|
||||
storage.legacyFiles().forEach(nd -> {
|
||||
Data<NumassData> datum = new StaticData<>(nd);
|
||||
if (filter.acceptData(nd.getName(), datum)) {
|
||||
builder.putData("legacy." + nd.getName(), datum);
|
||||
}
|
||||
});
|
||||
}
|
||||
//FIXME remove in later revisions
|
||||
SetDirectionUtility.save(context);
|
||||
|
||||
return builder.build();
|
||||
});
|
||||
|
||||
return builder.build();
|
||||
} catch (StorageException ex) {
|
||||
return process.getTask().get();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Failed to load storage", ex);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ShowLossSpectrumAction extends OneToOneAction<FitState, FitState> {
|
||||
new MetaBuilder("plot")
|
||||
.setValue("plotTitle", "Differential scattering crossection for " + name)
|
||||
);
|
||||
switch (input.getModel().getName()) {
|
||||
switch (input.getModel().meta().getString("name","")) {
|
||||
case "scatter-variable":
|
||||
scatterFunction = LossCalculator.getSingleScatterFunction(pars);
|
||||
calculateRatio = true;
|
||||
|
@ -215,12 +215,15 @@ public class ModularSpectrum extends AbstractParametricFunction {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppress warnings about cache recalculation
|
||||
* @param suppress
|
||||
*/
|
||||
public void setSuppressWarnings(boolean suppress) {
|
||||
this.trappingCache.setSuppressWarnings(suppress);
|
||||
for (NamedSpectrumCaching sp : this.cacheList) {
|
||||
this.cacheList.stream().forEach((sp) -> {
|
||||
sp.setSuppressWarnings(suppress);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,6 @@ import hep.dataforge.maths.MathUtils;
|
||||
import hep.dataforge.maths.NamedVector;
|
||||
import hep.dataforge.names.AbstractNamedSet;
|
||||
import hep.dataforge.values.NamedValueSet;
|
||||
import hep.dataforge.values.ValueProvider;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -108,13 +107,7 @@ public class NamedSpectrumCaching extends AbstractParametricFunction {
|
||||
return source.providesDeriv(name);
|
||||
}
|
||||
|
||||
protected boolean sameSet(ValueProvider set1, ValueProvider set2) {
|
||||
// if((set1 instanceof NamedDoubleSet)&&(set2 instanceof NamedDoubleSet)){
|
||||
// double[] v1 = ((NamedDoubleSet)set1).getAllValues();
|
||||
// double[] v2 = ((NamedDoubleSet)set2).getAllValues();
|
||||
// return Arrays.equals(v1, v2);
|
||||
// }
|
||||
|
||||
protected boolean sameSet(NamedValueSet set1, NamedValueSet set2) {
|
||||
for (String name : this.names()) {
|
||||
if (!Objects.equals(set1.getDouble(name), set2.getDouble(name))) {
|
||||
return false;
|
||||
|
@ -17,10 +17,10 @@ import hep.dataforge.description.ActionDescriptor;
|
||||
import hep.dataforge.description.DescriptorUtils;
|
||||
import hep.dataforge.exceptions.NameNotFoundException;
|
||||
import hep.dataforge.fx.ConsoleFragment;
|
||||
import hep.dataforge.fx.FXProcessManager;
|
||||
import hep.dataforge.fx.LogOutputPane;
|
||||
import hep.dataforge.fx.FXDataOutputPane;
|
||||
import hep.dataforge.fx.FXReportListener;
|
||||
import hep.dataforge.fx.configuration.MetaEditor;
|
||||
import hep.dataforge.fx.ProcessManagerFragment;
|
||||
import hep.dataforge.fx.process.ProcessManagerFragment;
|
||||
import hep.dataforge.io.IOManager;
|
||||
import hep.dataforge.io.MetaFileReader;
|
||||
import hep.dataforge.meta.ConfigChangeListener;
|
||||
@ -78,27 +78,24 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
|
||||
Map<String, StagePane> stages = new ConcurrentHashMap<>();
|
||||
|
||||
ProcessManagerFragment processWindow = new ProcessManagerFragment(new FXProcessManager());
|
||||
ConsoleFragment consoleWindow = new ConsoleFragment();
|
||||
ProcessManagerFragment processWindow;
|
||||
|
||||
FXDataOutputPane logPane;
|
||||
|
||||
@FXML
|
||||
private StatusBar statusBar;
|
||||
@FXML
|
||||
private TabPane stagesPane;
|
||||
@FXML
|
||||
private TitledPane contextPane;
|
||||
@FXML
|
||||
private TitledPane dataPane;
|
||||
@FXML
|
||||
private Accordion metaContainer;
|
||||
@FXML
|
||||
private Tab logTab;
|
||||
|
||||
LogOutputPane logPane;
|
||||
@FXML
|
||||
private Button runButton;
|
||||
@FXML
|
||||
private ToggleButton consoleButton;
|
||||
@FXML
|
||||
private ToggleButton processButton;
|
||||
|
||||
@Override
|
||||
public void clearStage(String stageName) {
|
||||
@ -116,11 +113,17 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
logPane = new LogOutputPane();
|
||||
logTab.setContent(logPane);
|
||||
logPane = new FXDataOutputPane();
|
||||
logTab.setContent(logPane.getRoot());
|
||||
|
||||
ConsoleFragment consoleWindow = new ConsoleFragment();
|
||||
consoleWindow.bindTo(consoleButton);
|
||||
consoleWindow.addRootLogHandler();
|
||||
consoleWindow.hookStd();
|
||||
|
||||
processWindow = new ProcessManagerFragment();
|
||||
processWindow.bindTo(processButton);
|
||||
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
@ -131,7 +134,13 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup context for current run
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
private void buildContext(Meta config) {
|
||||
// close existing context
|
||||
if (this.context != null) {
|
||||
try {
|
||||
this.context.close();
|
||||
@ -139,16 +148,19 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
context.getLogger().error("Failed to close context", ex);
|
||||
}
|
||||
}
|
||||
// building context using provided factory
|
||||
this.context = this.contextFactory.build(parentContext, config);
|
||||
context.setIO(new WorkbenchIOManager(new NumassIO(), this));
|
||||
processWindow = ProcessManagerFragment.attachToContext(context);
|
||||
processWindow.setOwner(this.logPane.getScene().getWindow());
|
||||
buildContextPane();
|
||||
this.logPane.listenTo(context);
|
||||
// this.logPane.listenTo(context);
|
||||
// this.logPane.listenTo(GlobalContext.instance().getLogger());
|
||||
|
||||
((PlotsPlugin) context.provide("plots")).setPlotHolderDelegate(this);
|
||||
// attachig visual process manager
|
||||
processWindow.setManager(context.processManager());
|
||||
|
||||
// setting io manager
|
||||
context.setIO(new WorkbenchIOManager(new NumassIO(), this));
|
||||
buildContextPane();
|
||||
context.getReport().addReportListener(new FXReportListener(logPane));
|
||||
|
||||
// display plots iside workbench
|
||||
PlotsPlugin.buildFrom(context).setPlotHolderDelegate(this);
|
||||
}
|
||||
|
||||
private Tab findTabWithName(TabPane pane, String name) {
|
||||
@ -205,7 +217,8 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
MetaEditor contextEditor = MetaEditor.build(contextValues, null);
|
||||
|
||||
contextEditor.geTable().setShowRoot(false);
|
||||
contextPane.setContent(contextEditor);
|
||||
TitledPane contextPane = new TitledPane("Context", contextEditor);
|
||||
metaContainer.getPanes().add(contextPane);
|
||||
}
|
||||
|
||||
public void loadConfig(Meta config) {
|
||||
@ -224,15 +237,13 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
.putValue("path", fileName));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
dataConfig = new Configuration("data");
|
||||
dataEditor = MetaEditor.build(dataConfig,
|
||||
DescriptorUtils.buildDescriptor(
|
||||
DescriptorUtils.findAnnotatedElement("class::hep.dataforge.data.FileDataFactory")
|
||||
));
|
||||
dataEditor.geTable().setShowRoot(false);
|
||||
metaContainer.getPanes().add(new TitledPane("Data", dataEditor));
|
||||
}
|
||||
dataEditor = MetaEditor.build(dataConfig,
|
||||
DescriptorUtils.buildDescriptor(
|
||||
DescriptorUtils.findAnnotatedElement("class::hep.dataforge.data.FileDataFactory")
|
||||
));
|
||||
dataEditor.geTable().setShowRoot(false);
|
||||
dataPane.setContent(dataEditor);
|
||||
|
||||
//loading actions configuration
|
||||
actionsConfig = new Configuration("actionlist");
|
||||
@ -270,8 +281,10 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
*/
|
||||
private synchronized void cleanUp() {
|
||||
//clear previus action panes
|
||||
processWindow.getManager().cleanup();
|
||||
metaContainer.getPanes().removeIf((ap) -> ap.getText().startsWith("action"));
|
||||
if (processWindow.getManager() != null) {
|
||||
processWindow.getManager().cleanup();
|
||||
}
|
||||
metaContainer.getPanes().clear();
|
||||
clearAllStages();
|
||||
actionsConfig = null;
|
||||
dataConfig = null;
|
||||
@ -315,17 +328,17 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
}
|
||||
|
||||
public Meta getDataConfiguration() {
|
||||
return new MetaBuilder(dataConfig).setContext(getContext()).build();
|
||||
return dataConfig == null ? Meta.empty() : new MetaBuilder(dataConfig).substituteValues(getContext()).build();
|
||||
}
|
||||
|
||||
public Meta getActionConfiguration() {
|
||||
return new MetaBuilder(actionsConfig).setContext(getContext()).build();
|
||||
return actionsConfig == null ? Meta.empty() : new MetaBuilder(actionsConfig).substituteValues(getContext()).build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void runActions() {
|
||||
clearAllStages();
|
||||
processWindow.show();
|
||||
// processWindow.show();
|
||||
new Thread(() -> {
|
||||
DataNode data = new FileDataFactory().build(getContext(), getDataConfiguration());
|
||||
Platform.runLater(() -> statusBar.setProgress(-1));
|
||||
@ -335,7 +348,7 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
} catch (Exception ex) {
|
||||
GlobalContext.instance().getLogger().error("Exception while executing action chain", ex);
|
||||
Platform.runLater(() -> {
|
||||
ex.printStackTrace();
|
||||
// ex.printStackTrace();
|
||||
statusBar.setText("Execution failed");
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Exception!");
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
package inr.numass.workbench;
|
||||
|
||||
import hep.dataforge.fx.FXUtils;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.names.Named;
|
||||
import hep.dataforge.plots.PlotFrame;
|
||||
@ -37,28 +38,36 @@ public class StagePane extends TabPane implements Named {
|
||||
}
|
||||
|
||||
public synchronized void closeTab(String name) {
|
||||
tabs.get(name).close();
|
||||
Platform.runLater(() -> getTabs().remove(tabs.get(name)));
|
||||
tabs.remove(name);
|
||||
FXUtils.runNow(() -> {
|
||||
tabs.get(name).close();
|
||||
getTabs().remove(tabs.get(name));
|
||||
tabs.remove(name);
|
||||
});
|
||||
}
|
||||
|
||||
public synchronized TextOutputTab buildTextOutput(String name) {
|
||||
if (tabs.containsKey(name)) {
|
||||
closeTab(name);
|
||||
}
|
||||
TextOutputTab out = new TextOutputTab(name);
|
||||
tabs.put(name, out);
|
||||
Platform.runLater(() -> getTabs().add(out));
|
||||
FXUtils.runNow(() -> {
|
||||
if (tabs.containsKey(name)) {
|
||||
tabs.get(name).close();
|
||||
getTabs().remove(tabs.get(name));
|
||||
tabs.replace(name, out);
|
||||
}
|
||||
getTabs().add(out);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
public synchronized PlotFrame buildPlotOutput(String name, Meta meta) {
|
||||
if (tabs.containsKey(name)) {
|
||||
closeTab(name);
|
||||
}
|
||||
PlotOutputTab out = new PlotOutputTab("plot::" + name, meta);
|
||||
tabs.put(name, out);
|
||||
Platform.runLater(() -> getTabs().add(out));
|
||||
FXUtils.runNow(() -> {
|
||||
if (tabs.containsKey(name)) {
|
||||
tabs.get(name).close();
|
||||
getTabs().remove(tabs.get(name));
|
||||
tabs.replace(name, out);
|
||||
}
|
||||
getTabs().add(out);
|
||||
});
|
||||
return out.getFrame();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class TextOutputTab extends OutputTab {
|
||||
super(name);
|
||||
// out = new DataOutputPane();
|
||||
out = new FXDataOutputPane();
|
||||
setContent(out.getHolder());
|
||||
setContent(out.getRoot());
|
||||
setOnClosed((Event event) -> close());
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public class TextOutputTab extends OutputTab {
|
||||
}
|
||||
|
||||
public OutputStream getStream() {
|
||||
return out.getOutputStream();
|
||||
return out.getStream();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,16 +3,16 @@
|
||||
<?import javafx.scene.control.Accordion?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.control.TitledPane?>
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.control.ToolBar?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import org.controlsfx.control.StatusBar?>
|
||||
|
||||
@ -30,35 +30,31 @@
|
||||
<Tab fx:id="logTab" closable="false" text="Log" />
|
||||
</tabs>
|
||||
</TabPane>
|
||||
<VBox alignment="TOP_CENTER" style="-fx-border-color: blue;">
|
||||
<children>
|
||||
<ToolBar prefHeight="40.0" prefWidth="200.0">
|
||||
<items>
|
||||
<Button mnemonicParsing="false" onAction="#onLoadConfigClick" text="Load" />
|
||||
<Button fx:id="runButton" disable="true" mnemonicParsing="false" onAction="#onRunButtonClick" text="Run">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<Pane />
|
||||
<ToggleButton fx:id="consoleButton" mnemonicParsing="false" text="Console" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true">
|
||||
<content>
|
||||
<Accordion fx:id="metaContainer" prefHeight="65536.0" prefWidth="248.0">
|
||||
<panes>
|
||||
<TitledPane fx:id="contextPane" animated="false" text="Context" />
|
||||
<TitledPane fx:id="dataPane" animated="false" text="Data" />
|
||||
</panes>
|
||||
</Accordion>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
</VBox>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true">
|
||||
<content>
|
||||
<Accordion fx:id="metaContainer" prefHeight="65536.0" prefWidth="248.0" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</center>
|
||||
<top>
|
||||
<ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<ToggleButton fx:id="consoleButton" mnemonicParsing="false" text="Console" />
|
||||
<ToggleButton fx:id="processButton" mnemonicParsing="false" text="Processes" />
|
||||
<Separator orientation="VERTICAL" />
|
||||
<Pane HBox.hgrow = "ALWAYS"/>
|
||||
<Separator orientation="VERTICAL" />
|
||||
<Button mnemonicParsing="false" onAction="#onLoadConfigClick" text="Load" />
|
||||
<Button fx:id="runButton" disable="true" mnemonicParsing="false" onAction="#onRunButtonClick" text="Run">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0" />
|
||||
</font>
|
||||
</Button>
|
||||
</items>
|
||||
</ToolBar>
|
||||
</top>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
@ -26,7 +26,7 @@ public class SetDirectionUtility {
|
||||
|
||||
private static final String FILE_NAME = "numass_set_direction.map";
|
||||
|
||||
private static Map<String, Boolean> directionMap = new HashMap<>();
|
||||
private static final Map<String, Boolean> directionMap = new HashMap<>();
|
||||
|
||||
private static boolean isLoaded = false;
|
||||
|
||||
@ -45,11 +45,16 @@ public class SetDirectionUtility {
|
||||
context.getLogger().info("Loading set direction utility");
|
||||
File file = cacheFile(context);
|
||||
if (file.exists()) {
|
||||
try (ObjectInputStream st = new ObjectInputStream(new FileInputStream(file))) {
|
||||
directionMap = (Map<String, Boolean>) st.readObject();
|
||||
context.getLogger().info("Set directions successfully loaded from file");
|
||||
} catch (ClassNotFoundException | IOException ex) {
|
||||
context.getLogger().error("Failed to load numass direction mapping", ex);
|
||||
directionMap.clear();
|
||||
try (FileInputStream fst = new FileInputStream(file)) {
|
||||
try (ObjectInputStream st = new ObjectInputStream(fst)) {
|
||||
directionMap.putAll((Map<String, Boolean>) st.readObject());
|
||||
context.getLogger().info("Set directions successfully loaded from file");
|
||||
} catch (ClassNotFoundException | IOException ex) {
|
||||
context.getLogger().error("Failed to load numass direction mapping", ex);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
context.getLogger().error("Failed to load numass direction mapping", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.context.ProcessManager;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.fx.ConsoleFragment;
|
||||
import hep.dataforge.fx.ProcessManagerFragment;
|
||||
import hep.dataforge.fx.process.ProcessManagerFragment;
|
||||
import inr.numass.NumassProperties;
|
||||
import inr.numass.storage.NumassData;
|
||||
import inr.numass.storage.NumassStorage;
|
||||
|
Loading…
Reference in New Issue
Block a user