aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-16 22:42:23 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-16 22:42:23 +0200
commit5d5db76ff0d9d1505c4a41cd84e871793a7a7b8d (patch)
treea8499b191e4e4f13f51b23a0cf6afb8778eb214e /src/main/kotlin/pl
parent6f7435b41e8994821649a50978aeb5b5b65951bd (diff)
downloadkvision-5d5db76ff0d9d1505c4a41cd84e871793a7a7b8d.tar.gz
kvision-5d5db76ff0d9d1505c4a41cd84e871793a7a7b8d.tar.bz2
kvision-5d5db76ff0d9d1505c4a41cd84e871793a7a7b8d.zip
Implemented getRoot method in widget class
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Root.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Widget.kt4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Root.kt b/src/main/kotlin/pl/treksoft/kvision/core/Root.kt
index c5f4a2d6..ef2e7616 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Root.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Root.kt
@@ -24,4 +24,8 @@ class Root(id: String, private val fluid: Boolean = false) : Container() {
rootVnode = KVManager.patch(rootVnode, render())
}
+ override fun getRoot(): Root? {
+ return this
+ }
+
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
index aaddbe39..438370cf 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
@@ -182,4 +182,8 @@ open class Widget(classes: Set<String> = setOf()) : KVObject {
protected open fun afterDestroy() {
}
+
+ internal open fun getRoot(): Root? {
+ return this.parent?.getRoot()
+ }
}