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

View File

@ -55,6 +55,11 @@ public class ClassicNumassPoint implements NumassPoint {
return getMeta().getDouble("external_meta.HV1_value", 0); return getMeta().getDouble("external_meta.HV1_value", 0);
} }
@Override
public int getIndex() {
return getMeta().getInt("external_meta.point_index", -1);
}
@Override @Override
public Meta getMeta() { public Meta getMeta() {
return envelope.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") { val monitorTableTask = task("monitor") {
model { meta -> model { meta ->
dependsOn(selectTask, meta) dependsOn(selectTask, meta)
@ -84,7 +84,7 @@ val monitorTableTask = task("monitor") {
//add set markers //add set markers
addSetMarkers(frame, data.values) 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)) NumassUtils.writeEnvelope(it, PlotFrame.Wrapper().wrap(frame))
} }
} }

View File

@ -1,7 +1,4 @@
plugins{ apply plugin: 'application'
id "application"
}
apply plugin: 'kotlin' apply plugin: 'kotlin'
repositories { repositories {
@ -19,15 +16,10 @@ version = "0.5.0"
description = "The viewer for numass data" description = "The viewer for numass data"
compileKotlin.kotlinOptions.jvmTarget = "1.8"
dependencies { dependencies {
compile project(':numass-core') compile project(':numass-core')
compile "hep.dataforge:plots-jfc" //project(':dataforge-plots:plots-jfc') compile "hep.dataforge:plots-jfc" //project(':dataforge-plots:plots-jfc')
compile "hep.dataforge:dataforge-gui" 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 { binningProperty.onChange {
reset() clear()
} }
normalizeProperty.onChange { normalizeProperty.onChange {
reset() clear()
} }
container.progressProperty.bind(progress) container.progressProperty.bind(progress)
@ -151,7 +151,7 @@ class AmplitudeView(
} }
} }
private fun reset() { fun clear() {
frame.plots.clear() frame.plots.clear()
plots.clear() plots.clear()
invalidate() invalidate()

View File

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

View File

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

View File

@ -152,29 +152,40 @@ class StorageView(private val context: Context = Global.instance()) : View(title
cellFormat { value -> cellFormat { value ->
when (value.content) { when (value.content) {
is Storage -> { is Storage -> {
text = value.id text = value.content.name
graphic = null graphic = null
} }
is NumassSet -> { is NumassSet -> {
text = null text = null
graphic = checkbox(value.id, value.checkedProperty) graphic = checkbox(value.content.name).apply {
selectedProperty().bindBidirectional(value.checkedProperty)
}
} }
is NumassPoint -> { is NumassPoint -> {
text = null text = null
graphic = checkbox(value.id, value.checkedProperty) graphic = checkbox("${value.content.voltage}[${value.content.index}]").apply {
selectedProperty().bindBidirectional(value.checkedProperty)
}
} }
is TableLoader -> { is TableLoader -> {
text = null text = null
graphic = checkbox(value.id, value.checkedProperty) graphic = checkbox(value.content.name).apply {
selectedProperty().bindBidirectional(value.checkedProperty)
}
} }
else -> { else -> {
text = value.id text = value.id
graphic = null graphic = null
} }
} }
contextMenu = ContextMenu()
contextMenu.item("Clear"){
action {
this@cellFormat.treeItem.uncheckAll()
}
}
if (value.content is Metoid) { if (value.content is Metoid) {
contextMenu = ContextMenu().apply { contextMenu.item("Meta") {
item("Meta") {
action { action {
openInternalBuilderWindow(title = "Info: ${value.id}", escapeClosesWindow = true) { openInternalBuilderWindow(title = "Info: ${value.id}", escapeClosesWindow = true) {
scrollpane { scrollpane {
@ -187,9 +198,7 @@ class StorageView(private val context: Context = Global.instance()) : View(title
} }
} }
} }
}
} 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 = private fun buildContainer(content: Any, parent: Container): Container =
when (content) { when (content) {
is Storage -> { is Storage -> {
@ -236,10 +251,10 @@ class StorageView(private val context: Context = Global.instance()) : View(title
} else { } else {
content.name content.name
} }
Container(id.toString(), content) Container(id, content)
} }
is NumassPoint -> { is NumassPoint -> {
Container("${parent.id}/${content.voltage}".replace(".", "_"), content) Container("${parent.id}/${content.voltage}[${content.index}]", content)
} }
is Loader -> { is Loader -> {
Container(content.path.toString(), content); Container(content.path.toString(), content);
@ -261,7 +276,7 @@ class StorageView(private val context: Context = Global.instance()) : View(title
title = "Load storage ($path)" title = "Load storage ($path)"
progress = -1.0 progress = -1.0
message = "Building numass storage tree..." 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 progress = 1.0
} }
} ui { } ui {

View File

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