Added slow control viewer to NumassViewer
This commit is contained in:
parent
fb9f55c633
commit
02a7f66a35
@ -1,5 +1,5 @@
|
|||||||
plugins{
|
plugins{
|
||||||
id "org.jetbrains.kotlin.jvm" version '1.1.2-2'
|
id "org.jetbrains.kotlin.jvm" version '1.1.2-5'
|
||||||
id "application"
|
id "application"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,12 +23,11 @@ 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:kodex"
|
||||||
compile 'com.jcraft:jsch:0.1.54'
|
compile 'com.jcraft:jsch:0.1.54'
|
||||||
|
|
||||||
compile 'org.controlsfx:controlsfx:8.40.12'
|
compile 'org.controlsfx:controlsfx:8.40.12'
|
||||||
|
compile "no.tornado:tornadofx:1.7.5"
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8"
|
|
||||||
compile "no.tornado:tornadofx:1.7.4"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
@ -11,6 +11,7 @@ import hep.dataforge.fx.work.WorkManagerFragment
|
|||||||
import hep.dataforge.meta.Metoid
|
import hep.dataforge.meta.Metoid
|
||||||
import hep.dataforge.names.AlphanumComparator
|
import hep.dataforge.names.AlphanumComparator
|
||||||
import hep.dataforge.names.Named
|
import hep.dataforge.names.Named
|
||||||
|
import hep.dataforge.storage.api.PointLoader
|
||||||
import hep.dataforge.storage.api.Storage
|
import hep.dataforge.storage.api.Storage
|
||||||
import hep.dataforge.storage.filestorage.FileStorageFactory
|
import hep.dataforge.storage.filestorage.FileStorageFactory
|
||||||
import inr.numass.NumassProperties
|
import inr.numass.NumassProperties
|
||||||
@ -35,10 +36,11 @@ import java.util.logging.Level
|
|||||||
/**
|
/**
|
||||||
* Created by darksnake on 14-Apr-17.
|
* Created by darksnake on 14-Apr-17.
|
||||||
*/
|
*/
|
||||||
class MainView : View() {
|
class MainView : View("Numass data viewer") {
|
||||||
override val root: AnchorPane by fxml("/fxml/MainView.fxml");
|
override val root: AnchorPane by fxml("/fxml/MainView.fxml");
|
||||||
|
|
||||||
private val numassLoaderView: NumassLoaderView by inject()
|
private val numassLoaderView: NumassLoaderView by inject()
|
||||||
|
private val slowControlView: SlowControlView by inject()
|
||||||
|
|
||||||
private val consoleButton: ToggleButton by fxid()
|
private val consoleButton: ToggleButton by fxid()
|
||||||
private val processManagerButton: ToggleButton by fxid()
|
private val processManagerButton: ToggleButton by fxid()
|
||||||
@ -50,6 +52,16 @@ class MainView : View() {
|
|||||||
private val treePane: BorderPane by fxid()
|
private val treePane: BorderPane by fxid()
|
||||||
private val statusBar: StatusBar by fxid()
|
private val statusBar: StatusBar by fxid()
|
||||||
|
|
||||||
|
private val logFragment = FragmentWindow.build(consoleButton) {
|
||||||
|
LogFragment().apply {
|
||||||
|
addRootLogHandler()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val processFragment = FragmentWindow.build(processManagerButton) {
|
||||||
|
WorkManagerFragment(getWorkManager())
|
||||||
|
}
|
||||||
|
|
||||||
private val storageProperty = SimpleObjectProperty<Storage>();
|
private val storageProperty = SimpleObjectProperty<Storage>();
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -87,10 +99,16 @@ class MainView : View() {
|
|||||||
addEventHandler(MouseEvent.MOUSE_CLICKED) { e: MouseEvent ->
|
addEventHandler(MouseEvent.MOUSE_CLICKED) { e: MouseEvent ->
|
||||||
if (e.clickCount == 2) {
|
if (e.clickCount == 2) {
|
||||||
val value = focusModel.focusedCell.treeItem.value
|
val value = focusModel.focusedCell.treeItem.value
|
||||||
if (value.content is NumassData) {
|
when (value.content) {
|
||||||
|
is NumassData -> {
|
||||||
numassLoaderView.loadData(value.content)
|
numassLoaderView.loadData(value.content)
|
||||||
loaderPane.center = numassLoaderView.root
|
loaderPane.center = numassLoaderView.root
|
||||||
}
|
}
|
||||||
|
is PointLoader -> {
|
||||||
|
slowControlView.load(value.content)
|
||||||
|
loaderPane.center = slowControlView.root
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,11 +140,7 @@ class MainView : View() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val logFragment = LogFragment()
|
|
||||||
logFragment.addRootLogHandler()
|
|
||||||
//logFragment.hookStd();
|
|
||||||
FragmentWindow(logFragment).bindTo(consoleButton)
|
|
||||||
FragmentWindow(WorkManagerFragment(getWorkManager())).bindTo(processManagerButton)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadDirectory(path: String) {
|
private fun loadDirectory(path: String) {
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package inr.numass.viewer
|
||||||
|
|
||||||
|
import hep.dataforge.kodex.buildMeta
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
|
import hep.dataforge.plots.Plottable
|
||||||
|
import hep.dataforge.plots.data.PlottableData
|
||||||
|
import hep.dataforge.plots.fx.PlotContainer
|
||||||
|
import hep.dataforge.plots.jfreechart.JFreeChartFrame
|
||||||
|
import hep.dataforge.storage.api.PointLoader
|
||||||
|
import hep.dataforge.storage.api.ValueIndex
|
||||||
|
import hep.dataforge.tables.DataPoint
|
||||||
|
import hep.dataforge.tables.ListTable
|
||||||
|
import hep.dataforge.tables.Table
|
||||||
|
import hep.dataforge.tables.XYAdapter
|
||||||
|
import tornadofx.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by darksnake on 18.06.2017.
|
||||||
|
*/
|
||||||
|
class SlowControlView : View("My View") {
|
||||||
|
private val plotMeta = buildMeta("plot") {
|
||||||
|
}
|
||||||
|
|
||||||
|
val plot = JFreeChartFrame(plotMeta)
|
||||||
|
|
||||||
|
override val root = borderpane {
|
||||||
|
PlotContainer.centerIn(this).plot = plot
|
||||||
|
}
|
||||||
|
|
||||||
|
fun load(loader: PointLoader) {
|
||||||
|
runAsync {
|
||||||
|
val data = getData(loader)
|
||||||
|
ArrayList<Plottable>().apply {
|
||||||
|
loader.format.columns.filter { it.name != "timestamp" }.forEach {
|
||||||
|
val adapter = XYAdapter("timestamp", it.name);
|
||||||
|
this += PlottableData.plot("data", adapter, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ui {
|
||||||
|
plot.setAll(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getData(loader: PointLoader, query: Meta = Meta.empty()): Table {
|
||||||
|
val index: ValueIndex<DataPoint>
|
||||||
|
|
||||||
|
//use custom index if needed
|
||||||
|
if (query.hasValue("index")) {
|
||||||
|
index = loader.getIndex(query.getString("index", ""))
|
||||||
|
} else {
|
||||||
|
//use loader default one otherwise
|
||||||
|
index = loader.index
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return ListTable(loader.format, index.query(query))
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw RuntimeException(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user