Minor fixes

This commit is contained in:
Alexander Nozik 2017-12-11 14:14:59 +03:00
parent 70a55b9c0b
commit fa26703a58
10 changed files with 75 additions and 38 deletions

View File

@ -15,20 +15,31 @@ public interface NumassPoint extends Metoid, NumassBlock {
String START_TIME_KEY = "start";
String LENGTH_KEY = "length";
String HV_KEY = "voltage";
String INDEX_KEY = "index";
Stream<NumassBlock> getBlocks();
/**
* Get the voltage setting for the point
*
* @return
*/
default double getVoltage() {
return getMeta().getDouble(HV_KEY, 0);
}
/**
* Get the index for this point in the set
* @return
*/
default int getIndex() {
return getMeta().getInt(INDEX_KEY, -1);
}
/**
* Get the first block if it exists. Throw runtime exception otherwise.
*
* @return
*/
default NumassBlock getFirstBlock() {
@ -37,6 +48,7 @@ public interface NumassPoint extends Metoid, NumassBlock {
/**
* Get the starting time from meta or from first block
*
* @return
*/
@Override

View File

@ -55,6 +55,11 @@ public class ClassicNumassPoint implements NumassPoint {
return getMeta().getDouble("external_meta.HV1_value", 0);
}
@Override
public int getIndex() {
return getMeta().getInt("external_meta.point_index", -1);
}
@Override
public Meta getMeta() {
return envelope.getMeta();

View File

@ -50,7 +50,7 @@ val selectTask = task("select") {
}
}
@ValueDef(name = "showPlot", type = arrayOf(ValueType.BOOLEAN), info = "Show plot after complete")
@ValueDef(name = "showPlot", type = [ValueType.BOOLEAN], info = "Show plot after complete")
val monitorTableTask = task("monitor") {
model { meta ->
dependsOn(selectTask, meta)
@ -84,7 +84,7 @@ val monitorTableTask = task("monitor") {
//add set markers
addSetMarkers(frame, data.values)
}
context.getIo().out("numass.monitor", name, "dfp").use {
context.io.out("numass.monitor", name, "dfp").use {
NumassUtils.writeEnvelope(it, PlotFrame.Wrapper().wrap(frame))
}
}

View File

@ -1,7 +1,4 @@
plugins{
id "application"
}
apply plugin: 'application'
apply plugin: 'kotlin'
repositories {
@ -19,15 +16,10 @@ version = "0.5.0"
description = "The viewer for numass data"
compileKotlin.kotlinOptions.jvmTarget = "1.8"
dependencies {
compile project(':numass-core')
compile "hep.dataforge:plots-jfc" //project(':dataforge-plots:plots-jfc')
compile "hep.dataforge:dataforge-gui"
compile 'com.jcraft:jsch:0.1.54'
}
apply plugin: 'kotlin'

View File

@ -90,10 +90,10 @@ class AmplitudeView(
}
binningProperty.onChange {
reset()
clear()
}
normalizeProperty.onChange {
reset()
clear()
}
container.progressProperty.bind(progress)
@ -151,7 +151,7 @@ class AmplitudeView(
}
}
private fun reset() {
fun clear() {
frame.plots.clear()
plots.clear()
invalidate()

View File

@ -77,5 +77,9 @@ class HVView : View(title = "High voltage time plot", icon = ImageView(dfIcon))
data.remove(id);
}
fun clear(){
data.clear()
}
}

View File

@ -91,4 +91,8 @@ class SlowControlView : View(title = "Numass slow control view", icon = ImageVie
this.data.remove(id)
}
fun clear(){
data.clear()
}
}

View File

@ -198,4 +198,8 @@ class SpectrumView(
fun remove(key: String) {
data.remove(key)
}
fun clear(){
data.clear()
}
}

View File

@ -152,44 +152,53 @@ class StorageView(private val context: Context = Global.instance()) : View(title
cellFormat { value ->
when (value.content) {
is Storage -> {
text = value.id
text = value.content.name
graphic = null
}
is NumassSet -> {
text = null
graphic = checkbox(value.id, value.checkedProperty)
graphic = checkbox(value.content.name).apply {
selectedProperty().bindBidirectional(value.checkedProperty)
}
}
is NumassPoint -> {
text = null
graphic = checkbox(value.id, value.checkedProperty)
graphic = checkbox("${value.content.voltage}[${value.content.index}]").apply {
selectedProperty().bindBidirectional(value.checkedProperty)
}
}
is TableLoader -> {
text = null
graphic = checkbox(value.id, value.checkedProperty)
graphic = checkbox(value.content.name).apply {
selectedProperty().bindBidirectional(value.checkedProperty)
}
}
else -> {
text = value.id
graphic = null
}
}
contextMenu = ContextMenu()
contextMenu.item("Clear"){
action {
this@cellFormat.treeItem.uncheckAll()
}
}
if (value.content is Metoid) {
contextMenu = ContextMenu().apply {
item("Meta") {
action {
openInternalBuilderWindow(title = "Info: ${value.id}", escapeClosesWindow = true) {
scrollpane {
textarea {
isEditable = false
isWrapText = true
text = value.content.meta.toString().replace("&#10;", "\n\t")
}
contextMenu.item("Meta") {
action {
openInternalBuilderWindow(title = "Info: ${value.id}", escapeClosesWindow = true) {
scrollpane {
textarea {
isEditable = false
isWrapText = true
text = value.content.meta.toString().replace("&#10;", "\n\t")
}
}
}
}
}
} else {
contextMenu = null
}
}
}
@ -225,6 +234,12 @@ class StorageView(private val context: Context = Global.instance()) : View(title
}
private fun TreeItem<Container>.uncheckAll(){
this.value.checked = false
this.children.forEach{it.uncheckAll()}
}
private fun buildContainer(content: Any, parent: Container): Container =
when (content) {
is Storage -> {
@ -236,10 +251,10 @@ class StorageView(private val context: Context = Global.instance()) : View(title
} else {
content.name
}
Container(id.toString(), content)
Container(id, content)
}
is NumassPoint -> {
Container("${parent.id}/${content.voltage}".replace(".", "_"), content)
Container("${parent.id}/${content.voltage}[${content.index}]", content)
}
is Loader -> {
Container(content.path.toString(), content);
@ -261,7 +276,7 @@ class StorageView(private val context: Context = Global.instance()) : View(title
title = "Load storage ($path)"
progress = -1.0
message = "Building numass storage tree..."
(StorageManager.buildStorage(context,NumassStorageFactory.buildStorageMeta(path, true, true))as NumassStorage).also {
(StorageManager.buildStorage(context, NumassStorageFactory.buildStorageMeta(path, true, true)) as NumassStorage).also {
progress = 1.0
}
} ui {

View File

@ -3,6 +3,8 @@ package inr.numass.viewer
import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import hep.dataforge.context.Global
import hep.dataforge.fx.dfIcon
import javafx.stage.Stage
import org.slf4j.LoggerFactory
import tornadofx.*
@ -14,11 +16,10 @@ class Viewer : App(StorageView::class) {
(LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) as Logger).level = Level.INFO
}
// override fun start(stage: Stage) {
// stage.icons += dfIcon
//// (LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) as Logger).level = Level.INFO
// super.start(stage)
// }
override fun start(stage: Stage) {
stage.icons += dfIcon
super.start(stage)
}
override fun stop() {
super.stop()