PKT8 to kotlin complete

This commit is contained in:
Alexander Nozik 2017-05-31 17:23:05 +03:00
parent 0bc03b6053
commit 45658ed961
2 changed files with 19 additions and 15 deletions

View File

@ -3,6 +3,7 @@ package inr.numass.control.cryotemp
import hep.dataforge.control.devices.Sensor import hep.dataforge.control.devices.Sensor
import hep.dataforge.control.measurements.Measurement import hep.dataforge.control.measurements.Measurement
import hep.dataforge.control.measurements.MeasurementListener import hep.dataforge.control.measurements.MeasurementListener
import hep.dataforge.fx.fragments.FXFragment
import hep.dataforge.fx.fragments.FragmentWindow import hep.dataforge.fx.fragments.FragmentWindow
import hep.dataforge.fx.fragments.LogFragment import hep.dataforge.fx.fragments.LogFragment
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
@ -13,7 +14,6 @@ import hep.dataforge.plots.fx.FXPlotFrame
import hep.dataforge.plots.fx.PlotContainer import hep.dataforge.plots.fx.PlotContainer
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import inr.numass.control.DeviceViewConnection import inr.numass.control.DeviceViewConnection
import inr.numass.control.bindView
import javafx.application.Platform import javafx.application.Platform
import javafx.beans.binding.ListBinding import javafx.beans.binding.ListBinding
import javafx.beans.property.SimpleObjectProperty import javafx.beans.property.SimpleObjectProperty
@ -71,6 +71,16 @@ class PKT8ViewConnection : DeviceViewConnection<PKT8Device>(), MeasurementListen
} }
inner class CryoView() : View() { inner class CryoView() : View() {
private var plotButton: ToggleButton by singleAssign()
private var logButton: ToggleButton by singleAssign()
private val logWindow = FragmentWindow(LogFragment().apply {
addLogHandler(device.logger)
})
private val plotView = CryoPlotView();
private val plotWindow = FragmentWindow(FXFragment.buildFromNode(plotView.title) { plotView.root })
override val root = borderpane { override val root = borderpane {
top { top {
toolbar { toolbar {
@ -87,15 +97,15 @@ class PKT8ViewConnection : DeviceViewConnection<PKT8Device>(), MeasurementListen
hgrow = Priority.ALWAYS hgrow = Priority.ALWAYS
} }
separator(Orientation.VERTICAL) separator(Orientation.VERTICAL)
togglebutton("Plot") {
plotButton = togglebutton("Plot") {
isSelected = false isSelected = false
bindView(plotView) plotWindow.bindTo(this)
} }
togglebutton("Log") {
logButton = togglebutton("Log") {
isSelected = false isSelected = false
FragmentWindow(LogFragment().apply { logWindow.bindTo(this)
addLogHandler(device.logger)
}).bindTo(this)
} }
} }
} }

View File

@ -99,9 +99,3 @@ fun EventTarget.deviceStateIndicator(connection: DeviceViewConnection<*>, state:
separator(Orientation.VERTICAL) separator(Orientation.VERTICAL)
} }
} }
fun ToggleButton.bindView(view: View) {
//TODO use view instead of FXFragment
FragmentWindow(FXFragment.buildFromNode(view.title) { view.root }).bindTo(this)
}