Minor fixes
This commit is contained in:
parent
70a55b9c0b
commit
fa26703a58
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -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'
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
@ -77,5 +77,9 @@ class HVView : View(title = "High voltage time plot", icon = ImageView(dfIcon))
|
||||
data.remove(id);
|
||||
}
|
||||
|
||||
fun clear(){
|
||||
data.clear()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -91,4 +91,8 @@ class SlowControlView : View(title = "Numass slow control view", icon = ImageVie
|
||||
this.data.remove(id)
|
||||
}
|
||||
|
||||
fun clear(){
|
||||
data.clear()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -198,4 +198,8 @@ class SpectrumView(
|
||||
fun remove(key: String) {
|
||||
data.remove(key)
|
||||
}
|
||||
|
||||
fun clear(){
|
||||
data.clear()
|
||||
}
|
||||
}
|
||||
|
@ -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(" ", "\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(" ", "\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 {
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user