aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-29 20:55:02 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-29 20:55:02 +0100
commit9a70dcb74707dac6d7e88d9b75ddf36b17fd5632 (patch)
treedbe004b29cfb765bb73afe4ab6e48734d30de4af /src/main/kotlin/pl
parentdb611775f3fbf14c3860973795768a722d501d48 (diff)
downloadkvision-9a70dcb74707dac6d7e88d9b75ddf36b17fd5632.tar.gz
kvision-9a70dcb74707dac6d7e88d9b75ddf36b17fd5632.tar.bz2
kvision-9a70dcb74707dac6d7e88d9b75ddf36b17fd5632.zip
Simplified data container
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
index 4dbceaea..32546bd5 100644
--- a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
@@ -9,7 +9,7 @@ import pl.treksoft.kvision.panel.VPanel
class DataContainer<M : DataComponent, C : Widget>(
val model: ObservableList<M>,
- private val binding: (M, Int) -> C,
+ private val binding: (Int) -> C,
private val child: Container = VPanel()
) :
Widget(setOf()), Container, DataUpdatable {
@@ -56,11 +56,13 @@ class DataContainer<M : DataComponent, C : Widget>(
return this.child.renderVNode()
}
+ open fun get(index: Int) = model[index]
+
override fun update() {
model.forEach { it.container = this }
singleRender {
child.removeAll()
- child.addAll(model.mapIndexed { index, m -> binding(m, index) })
+ child.addAll(model.mapIndexed { index, _ -> binding(index) })
}
}