From 343390df5a0e01f45539939291c35d535a1b8af6 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 25 Nov 2017 13:39:39 +0100 Subject: Form validation --- src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt') 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 = setOf()) : Widget(classes), Container { - internal val children: MutableList = mutableListOf() + internal val children: MutableList = mutableListOf() override fun render(): VNode { return kvh("div", childrenVNodes()) @@ -15,25 +16,25 @@ open class SimplePanel(classes: Set = 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): SimplePanel { + override fun addAll(children: List): 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 = setOf()) : Widget(classes), Contai return this } - override fun getChildren(): List { + override fun getChildren(): List { return ArrayList(children) } -- cgit