diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-11-25 13:39:39 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-11-25 13:39:39 +0100 |
commit | 343390df5a0e01f45539939291c35d535a1b8af6 (patch) | |
tree | fcba5b87efa1b740bd5a011739af1e066cba28f0 /src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt | |
parent | 4a31ea44d479358658a614ad56a5675436260813 (diff) | |
download | kvision-343390df5a0e01f45539939291c35d535a1b8af6.tar.gz kvision-343390df5a0e01f45539939291c35d535a1b8af6.tar.bz2 kvision-343390df5a0e01f45539939291c35d535a1b8af6.zip |
Form validation
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt index e9cf503b..90362127 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt @@ -2,10 +2,11 @@ package pl.treksoft.kvision.panel import com.github.snabbdom.VNode import pl.treksoft.kvision.core.Container +import pl.treksoft.kvision.core.Component import pl.treksoft.kvision.core.Widget open class SimplePanel(classes: Set<String> = setOf()) : Widget(classes), Container { - internal val children: MutableList<Widget> = mutableListOf() + internal val children: MutableList<Component> = mutableListOf() override fun render(): VNode { return kvh("div", childrenVNodes()) @@ -15,25 +16,25 @@ open class SimplePanel(classes: Set<String> = setOf()) : Widget(classes), Contai return children.filter { it.visible }.map { it.renderVNode() }.toTypedArray() } - protected fun addInternal(child: Widget): SimplePanel { + protected fun addInternal(child: Component): SimplePanel { children.add(child) child.parent = this refresh() return this } - override fun add(child: Widget): SimplePanel { + override fun add(child: Component): SimplePanel { return addInternal(child) } - override fun addAll(children: List<Widget>): SimplePanel { + override fun addAll(children: List<Component>): SimplePanel { this.children.addAll(children) children.map { it.parent = this } refresh() return this } - override fun remove(child: Widget): SimplePanel { + override fun remove(child: Component): SimplePanel { if (children.remove(child)) { child.clearParent() refresh() @@ -48,7 +49,7 @@ open class SimplePanel(classes: Set<String> = setOf()) : Widget(classes), Contai return this } - override fun getChildren(): List<Widget> { + override fun getChildren(): List<Component> { return ArrayList(children) } |