From 593dc8ca798adceb1b69e458d92bb7a657b87a6e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 8 Mar 2019 11:29:14 +0300 Subject: [PATCH] Moved visualization to a separate project --- .../vis/DisplayObjectPropertyListener.kt | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 dataforge-vis/dataforge-vis-spatial-fx/src/main/kotlin/hep/dataforge/vis/DisplayObjectPropertyListener.kt diff --git a/dataforge-vis/dataforge-vis-spatial-fx/src/main/kotlin/hep/dataforge/vis/DisplayObjectPropertyListener.kt b/dataforge-vis/dataforge-vis-spatial-fx/src/main/kotlin/hep/dataforge/vis/DisplayObjectPropertyListener.kt deleted file mode 100644 index 63eb25c5..00000000 --- a/dataforge-vis/dataforge-vis-spatial-fx/src/main/kotlin/hep/dataforge/vis/DisplayObjectPropertyListener.kt +++ /dev/null @@ -1,38 +0,0 @@ -package hep.dataforge.vis - -import hep.dataforge.meta.* -import hep.dataforge.names.Name -import hep.dataforge.names.toName -import javafx.beans.binding.ObjectBinding -import tornadofx.* - -class DisplayObjectPropertyListener(val obj: DisplayObject) { - private val binndings = HashMap?>>() - - init { - obj.onChange(this) { name, _, _ -> - binndings[name]?.invalidate() - } - } - - operator fun get(key: Name): ObjectBinding?> { - return binndings.getOrPut(key) { - object : ObjectBinding?>() { - override fun computeValue(): MetaItem<*>? = obj.getProperty(key) - } - } - } - - operator fun get(key: String) = get(key.toName()) -} - -fun ObjectBinding?>.value() = this.objectBinding { it.value } -fun ObjectBinding?>.string() = this.stringBinding { it.string } -fun ObjectBinding?>.number() = this.objectBinding { it.number } -fun ObjectBinding?>.double() = this.objectBinding { it.double } -fun ObjectBinding?>.float() = this.objectBinding { it.number?.toFloat() } -fun ObjectBinding?>.int() = this.objectBinding { it.int } -fun ObjectBinding?>.long() = this.objectBinding { it.long } -fun ObjectBinding?>.node() = this.objectBinding { it.node } - -fun ObjectBinding?>.transform(transform: (MetaItem<*>) -> T) = this.objectBinding { it?.let(transform) }