aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/data/DataComponent.kt8
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataComponent.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataComponent.kt
index 605e1e2e..6eef6f98 100644
--- a/src/main/kotlin/pl/treksoft/kvision/data/DataComponent.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/data/DataComponent.kt
@@ -4,8 +4,8 @@ import kotlin.properties.ObservableProperty
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
-open class DataComponent {
- var container: DataUpdatable? = null
+interface DataComponent {
+ var container: DataUpdatable?
fun <T> obs(initialValue: T): ReadWriteProperty<Any?, T> = object : ObservableProperty<T>(initialValue) {
override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) {
@@ -13,3 +13,7 @@ open class DataComponent {
}
}
}
+
+open class BaseDataComponent : DataComponent {
+ override var container: DataUpdatable? = null
+}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt
index b4b1122f..e2fd7a0d 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt
@@ -3,7 +3,7 @@ package test.pl.treksoft.kvision.data
import com.lightningkite.kotlin.observable.list.observableListOf
import pl.treksoft.kvision.basic.Label
import pl.treksoft.kvision.core.Root
-import pl.treksoft.kvision.data.DataComponent
+import pl.treksoft.kvision.data.BaseDataComponent
import pl.treksoft.kvision.data.DataContainer
import test.pl.treksoft.kvision.DomSpec
import kotlin.browser.document
@@ -17,7 +17,7 @@ class DataContainerSpec : DomSpec {
run {
val root = Root("test")
- class Model(value: String) : DataComponent() {
+ class Model(value: String) : BaseDataComponent() {
var value: String by obs(value)
}