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 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
|
||||||
|
@ -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();
|
||||||
|
@ -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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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'
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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()
|
||||||
|
@ -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()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -198,4 +198,8 @@ class SpectrumView(
|
|||||||
fun remove(key: String) {
|
fun remove(key: String) {
|
||||||
data.remove(key)
|
data.remove(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun clear(){
|
||||||
|
data.clear()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,44 +152,53 @@ 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 {
|
textarea {
|
||||||
textarea {
|
isEditable = false
|
||||||
isEditable = false
|
isWrapText = true
|
||||||
isWrapText = true
|
text = value.content.meta.toString().replace(" ", "\n\t")
|
||||||
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 =
|
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 {
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user