aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/data')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
index 13b5ce00..fa545dc8 100644
--- a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
@@ -123,4 +123,20 @@ class DataContainer<M : DataComponent, C : Component>(
onUpdateHandler = null
return this
}
+
+ companion object {
+ /**
+ * DSL builder extension function
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+ fun <M : DataComponent, C : Component> Container.dataContainer(
+ model: ObservableList<M>,
+ binding: (Int) -> C,
+ child: Container = VPanel(),
+ init: (DataContainer<M, C>.() -> Unit)? = null
+ ) {
+ this.add(DataContainer(model, binding, child, init))
+ }
+ }
}