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) }