First iteration of text system.

This commit is contained in:
Alexander Nozik 2017-01-05 16:39:46 +03:00
parent cc9c353f33
commit 0959a609bb
5 changed files with 10 additions and 9 deletions

View File

@ -77,7 +77,7 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
}
if (meta.hasNode("correction")) {
corrections.addAll(meta.getNodes("correction").stream()
corrections.addAll(meta.getMetaList("correction").stream()
.map((Function<Meta, Correction>) this::makeCorrection)
.collect(Collectors.toList()));
}
@ -140,7 +140,7 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
//Генерируем автоматический формат по первой строчке
format = TableFormat.forPoint(dataList.get(0));
} else {
format = TableFormat.fixedWidth(8, parnames);
format = TableFormat.forNames(parnames);
}
String head;

View File

@ -21,10 +21,11 @@ import hep.dataforge.tables.TableFormat;
import hep.dataforge.values.Value;
import inr.numass.storage.NMFile;
import inr.numass.storage.NMPoint;
import org.apache.commons.math3.util.Pair;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.math3.util.Pair;
/**
*
@ -40,7 +41,7 @@ public class SlicedData extends SimplePointSource {
ArrayList<String> names = new ArrayList<>(intervals.keySet());
names.add(0, TNAME);
names.add(0, UNAME);
return TableFormat.fixedWidth(8, names);
return TableFormat.forNames(names);
}

View File

@ -70,7 +70,7 @@ public class SummaryAction extends ManyToOneAction<FitState, Table> {
}
names[names.length - 1] = "chi2";
ListTable.Builder res = new ListTable.Builder(TableFormat.fixedWidth(8, names));
ListTable.Builder res = new ListTable.Builder(TableFormat.forNames(names));
double[] weights = new double[parNames.length];
Arrays.fill(weights, 0);

View File

@ -10,7 +10,7 @@ import hep.dataforge.storage.api.Loader;
import hep.dataforge.storage.api.StateLoader;
import hep.dataforge.storage.api.Storage;
import hep.dataforge.storage.commons.JSONMetaWriter;
import hep.dataforge.storage.servlet.Utils;
import hep.dataforge.storage.servlet.ServletUtils;
import org.slf4j.LoggerFactory;
import ratpack.handling.Context;
import ratpack.handling.Handler;
@ -40,7 +40,7 @@ public class NumassRootHandler implements Handler {
public void handle(Context ctx) throws Exception {
try {
ctx.getResponse().contentType("text/html");
Template template = Utils.freemarkerConfig().getTemplate("NumassRoot.ftl");
Template template = ServletUtils.freemarkerConfig().getTemplate("NumassRoot.ftl");
Map data = new HashMap(6);
if (!server.meta().isEmpty()) {

View File

@ -10,8 +10,8 @@ import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.storage.api.ObjectLoader;
import hep.dataforge.storage.api.PointLoader;
import hep.dataforge.storage.api.Storage;
import hep.dataforge.storage.servlet.ServletUtils;
import hep.dataforge.storage.servlet.StorageRatpackHandler;
import hep.dataforge.storage.servlet.Utils;
import org.slf4j.LoggerFactory;
import ratpack.handling.Context;
@ -47,7 +47,7 @@ public class NumassStorageHandler extends StorageRatpackHandler {
try {
ObjectLoader<NumassNote> noteLoader = (ObjectLoader<NumassNote>) loader;
ctx.getResponse().contentType("text/html");
Template template = Utils.freemarkerConfig().getTemplate("NoteLoader.ftl");
Template template = ServletUtils.freemarkerConfig().getTemplate("NoteLoader.ftl");
List<String> notes = getNotes(noteLoader).limit(100).map(note -> render(note)).collect(Collectors.toList());