diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-02-12 10:50:42 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-02-12 10:50:42 +0100 |
commit | bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c (patch) | |
tree | 39288bdcb59ec48cb70f1c5820fc1854949744da /src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt | |
parent | 2feea5e7cf8d492663e826ebcfb0a58e61820352 (diff) | |
download | kvision-bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c.tar.gz kvision-bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c.tar.bz2 kvision-bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c.zip |
Type safe DSL builders
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt index 823ab66f..a0eccb50 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt @@ -21,6 +21,8 @@ */ package pl.treksoft.kvision.panel +import pl.treksoft.kvision.core.Container + /** * The container with vertical layout. * @@ -44,5 +46,19 @@ open class VPanel( @Suppress("LeakingThis") init?.invoke(this) } + + companion object { + /** + * DSL builder extension function + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.vPanel( + justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null, spacing: Int? = null, + classes: Set<String> = setOf(), init: (VPanel.() -> Unit)? = null + ) { + this.add(VPanel(justify, alignItems, spacing, classes, init)) + } + } } |