commonMain.jetbrains.datalore.vis.svg.SvgTextNode.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vis-svg-portable Show documentation
Show all versions of vis-svg-portable Show documentation
The Let-Plot Kotlin API depends on this artifact.
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package jetbrains.datalore.vis.svg
import jetbrains.datalore.base.observable.collections.list.ObservableArrayList
import jetbrains.datalore.base.observable.collections.list.ObservableList
import jetbrains.datalore.base.observable.property.Property
import jetbrains.datalore.base.observable.property.ValueProperty
class SvgTextNode(text: String) : SvgNode() {
private val myContent: Property
init {
myContent = ValueProperty(text)
}
fun textContent(): Property {
return myContent
}
override fun children(): ObservableList {
return NO_CHILDREN_LIST
}
override fun toString(): String {
return textContent().get()
}
companion object {
private val NO_CHILDREN_LIST: ObservableArrayList = object : ObservableArrayList() {
override fun checkAdd(index: Int, item: SvgNode) {
throw UnsupportedOperationException("Cannot add children to SvgTextNode")
}
override fun checkRemove(index: Int, item: SvgNode) {
throw UnsupportedOperationException("Cannot remove children from SvgTextNode")
}
}
}
}