diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt index 1997c714..0ef16015 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8ViewConnection.kt @@ -3,8 +3,7 @@ package inr.numass.control.cryotemp import hep.dataforge.control.devices.Sensor import hep.dataforge.control.measurements.Measurement import hep.dataforge.control.measurements.MeasurementListener -import hep.dataforge.fx.fragments.FXFragment -import hep.dataforge.fx.fragments.FragmentWindow +import hep.dataforge.fx.bindWindow import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.fx.plots.PlotContainer import hep.dataforge.meta.Meta @@ -92,15 +91,14 @@ class PKT8ViewConnection : DeviceViewConnection(), MeasurementListen plotButton = togglebutton("Plot") { isSelected = false - FragmentWindow.build(this) { FXFragment.buildFromNode(plotView.title) { plotView.root } } + plotView.bindWindow(selectedProperty()) } logButton = togglebutton("Log") { isSelected = false - FragmentWindow.build(this) { - LogFragment().apply { - addLogHandler(device.logger) - } + LogFragment().apply { + addLogHandler(device.logger) + bindWindow(selectedProperty()) } } } diff --git a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspViewConnection.kt b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspViewConnection.kt index 8ee5b17e..a76dd8b5 100644 --- a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspViewConnection.kt +++ b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspViewConnection.kt @@ -19,7 +19,7 @@ import hep.dataforge.control.NamedValueListener import hep.dataforge.control.devices.DeviceListener import hep.dataforge.control.devices.PortSensor import hep.dataforge.control.devices.Sensor -import hep.dataforge.fx.fragments.FragmentWindow +import hep.dataforge.fx.bindWindow import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.fx.plots.PlotContainer import hep.dataforge.meta.Meta @@ -173,9 +173,11 @@ class MspViewConnection() : DeviceViewConnection(), DeviceListener, N togglebutton("Log") { isSelected = false - FragmentWindow.build(this){LogFragment().apply { + + LogFragment().apply { addLogHandler(device.logger) - }} + bindWindow(selectedProperty()) + } } } } diff --git a/numass-control/src/main/kotlin/inr/numass/control/DeviceViewConnection.kt b/numass-control/src/main/kotlin/inr/numass/control/DeviceViewConnection.kt index 2781e702..82ed48dd 100644 --- a/numass-control/src/main/kotlin/inr/numass/control/DeviceViewConnection.kt +++ b/numass-control/src/main/kotlin/inr/numass/control/DeviceViewConnection.kt @@ -5,15 +5,13 @@ import hep.dataforge.control.devices.Device import hep.dataforge.control.devices.DeviceListener import hep.dataforge.control.devices.PortSensor import hep.dataforge.control.devices.Sensor -import hep.dataforge.fx.fragments.FXFragment -import hep.dataforge.fx.fragments.FragmentWindow +import hep.dataforge.fx.bindWindow import hep.dataforge.values.Value import javafx.beans.binding.BooleanBinding import javafx.beans.binding.ObjectBinding import javafx.beans.property.BooleanProperty import javafx.beans.property.SimpleObjectProperty import javafx.geometry.Pos -import javafx.scene.Node import javafx.scene.Parent import javafx.scene.layout.HBox import javafx.scene.layout.Priority @@ -68,10 +66,6 @@ abstract class DeviceViewConnection : Component(), Connection, Devic deviceProperty.set(null) } - override fun getFXNode(): Node { - return view.root; - } - abstract fun buildView(device: D): View; /** @@ -85,10 +79,10 @@ abstract class DeviceViewConnection : Component(), Connection, Devic return bindings.computeIfAbsent(state) { stateName -> object : ObjectBinding() { override fun computeValue(): Value { - if (isOpen) { - return device.getState(stateName) + return if (isOpen) { + device.getState(stateName) } else { - return Value.NULL + Value.NULL } } } @@ -140,7 +134,7 @@ abstract class DeviceViewConnection : Component(), Connection, Devic } togglebutton("View") { isSelected = false - FragmentWindow.build(this){FXFragment.buildFromNode(device.name) { getFxNode() }} + view.bindWindow(this.selectedProperty()) } } } diff --git a/numass-control/src/main/kotlin/inr/numass/control/NumassControlApplication.kt b/numass-control/src/main/kotlin/inr/numass/control/NumassControlApplication.kt index d10700a2..be1f0214 100644 --- a/numass-control/src/main/kotlin/inr/numass/control/NumassControlApplication.kt +++ b/numass-control/src/main/kotlin/inr/numass/control/NumassControlApplication.kt @@ -27,7 +27,7 @@ abstract class NumassControlApplication : App() { device = setupDevice() val controller = buildView(device) device.connect(controller, Roles.VIEW_ROLE, Roles.DEVICE_LISTENER_ROLE) - val scene = Scene(controller.getPane()) + val scene = Scene(controller.view.root) stage.scene = scene stage.show() diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorViewConnection.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorViewConnection.kt index 6bf083dc..32b21027 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorViewConnection.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorViewConnection.kt @@ -10,7 +10,7 @@ import hep.dataforge.control.connections.Roles import hep.dataforge.control.devices.Sensor import hep.dataforge.control.measurements.Measurement import hep.dataforge.control.measurements.MeasurementListener -import hep.dataforge.fx.fragments.FragmentWindow +import hep.dataforge.fx.bindWindow import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.plots.data.TimePlot import hep.dataforge.plots.data.TimePlottableGroup @@ -89,9 +89,10 @@ class VacCollectorViewConnection : DeviceViewConnection() { separator(Orientation.VERTICAL) togglebutton("Log") { isSelected = false - FragmentWindow.build(this){LogFragment().apply { + LogFragment().apply { addLogHandler(device.logger) - }} + bindWindow(selectedProperty()) + } } } } @@ -108,7 +109,7 @@ class VacCollectorViewConnection : DeviceViewConnection() { hbarPolicy = ScrollPane.ScrollBarPolicy.NEVER vbox { viewList.forEach { - add(it.getFxNode()) + add(it.view) separator(Orientation.HORIZONTAL) } } diff --git a/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt index b128ee58..bac2394c 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/AnalyzeDataAction.kt @@ -9,6 +9,7 @@ import hep.dataforge.meta.Laminate import hep.dataforge.tables.Table import hep.dataforge.values.ValueType.NUMBER import hep.dataforge.values.ValueType.STRING +import inr.numass.NumassUtils import inr.numass.data.api.NumassAnalyzer import inr.numass.data.api.NumassSet diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt index b756eccd..ba343ce7 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/StorageView.kt @@ -2,8 +2,8 @@ package inr.numass.viewer import hep.dataforge.context.Context import hep.dataforge.context.Global +import hep.dataforge.fx.bindWindow import hep.dataforge.fx.dfIcon -import hep.dataforge.fx.fragments.FragmentWindow import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.fx.runGoal import hep.dataforge.fx.ui @@ -122,10 +122,9 @@ class StorageView(private val context: Context = Global.instance()) : View(title } togglebutton("Console") { isSelected = false - FragmentWindow.build(this) { - LogFragment().apply { - addRootLogHandler() - } + LogFragment().apply { + addLogHandler(storage.logger) + bindWindow(selectedProperty()) } } }