aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/form/spinner
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-02-12 12:00:15 +0100
committerRobert Jaros <rjaros@finn.pl>2018-02-12 12:00:15 +0100
commiteea44b35add0d036119888f41e4ed38e75190934 (patch)
tree01ff2b73042ab08941df082d74241dc5e229a37d /src/main/kotlin/pl/treksoft/kvision/form/spinner
parent4191287261b46b95908469c2ec3fa9d886681861 (diff)
downloadkvision-eea44b35add0d036119888f41e4ed38e75190934.tar.gz
kvision-eea44b35add0d036119888f41e4ed38e75190934.tar.bz2
kvision-eea44b35add0d036119888f41e4ed38e75190934.zip
DSL builders returning built components.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form/spinner')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt10
2 files changed, 12 insertions, 8 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
index 2a5d2cbe..3cd50473 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
@@ -240,7 +240,7 @@ open class Spinner(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -249,12 +249,14 @@ open class Spinner(
decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
forceType: FORCETYPE = FORCETYPE.NONE, label: String? = null,
rich: Boolean = false, init: (Spinner.() -> Unit)? = null
- ) {
- this.add(Spinner(value, min, max, step, decimals, buttonsType, forceType, label, rich).apply {
+ ): Spinner {
+ val spinner = Spinner(value, min, max, step, decimals, buttonsType, forceType, label, rich).apply {
init?.invoke(
this
)
- })
+ }
+ this.add(spinner)
+ return spinner
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index 6dcb2b4a..a3f72b75 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -342,7 +342,7 @@ open class SpinnerInput(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -351,12 +351,14 @@ open class SpinnerInput(
decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
forceType: FORCETYPE = FORCETYPE.NONE, classes: Set<String> = setOf(),
init: (SpinnerInput.() -> Unit)? = null
- ) {
- this.add(SpinnerInput(value, min, max, step, decimals, buttonsType, forceType, classes).apply {
+ ): SpinnerInput {
+ val spinnerInput = SpinnerInput(value, min, max, step, decimals, buttonsType, forceType, classes).apply {
init?.invoke(
this
)
- })
+ }
+ this.add(spinnerInput)
+ return spinnerInput
}
}
}