aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-02-12 10:50:42 +0100
committerRobert Jaros <rjaros@finn.pl>2018-02-12 10:50:42 +0100
commitbafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c (patch)
tree39288bdcb59ec48cb70f1c5820fc1854949744da /src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
parent2feea5e7cf8d492663e826ebcfb0a58e61820352 (diff)
downloadkvision-bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c.tar.gz
kvision-bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c.tar.bz2
kvision-bafcdb6fc3f1d4ec4f1a0f4fcce776ba10d8136c.zip
Type safe DSL builders
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
index 8831e905..9ac66d20 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
@@ -22,6 +22,7 @@
package pl.treksoft.kvision.panel
import pl.treksoft.kvision.core.Component
+import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.WidgetWrapper
import pl.treksoft.kvision.html.ALIGN
import pl.treksoft.kvision.html.TAG
@@ -176,4 +177,19 @@ open class ResponsiveGridPanel(
children.forEach { it.dispose() }
removeAll()
}
+
+ companion object {
+ /**
+ * DSL builder extension function
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+ fun Container.responsiveGridPanel(
+ gridsize: GRIDSIZE = GRIDSIZE.MD,
+ rows: Int = 0, cols: Int = 0, align: ALIGN? = null,
+ classes: Set<String> = setOf(), init: (ResponsiveGridPanel.() -> Unit)? = null
+ ) {
+ this.add(ResponsiveGridPanel(gridsize, rows, cols, align, classes, init))
+ }
+ }
}