From 5d5db76ff0d9d1505c4a41cd84e871793a7a7b8d Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 16 Sep 2017 22:42:23 +0200 Subject: Implemented getRoot method in widget class --- src/main/kotlin/pl/treksoft/kvision/core/Root.kt | 4 ++++ src/main/kotlin/pl/treksoft/kvision/core/Widget.kt | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src/main') 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 = setOf()) : KVObject { protected open fun afterDestroy() { } + + internal open fun getRoot(): Root? { + return this.parent?.getRoot() + } } -- cgit