aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/modal
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-23 19:41:48 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-23 19:41:48 +0200
commit659b87f5c1c297c68b125f67bc0b29b547debfd0 (patch)
treeaacbd72815cb23568ebed0f0bf7cde60af9a79b8 /src/main/kotlin/pl/treksoft/kvision/modal
parent1d96f6e5b45a7eb7b91bcb79bcb9684980317821 (diff)
downloadkvision-659b87f5c1c297c68b125f67bc0b29b547debfd0.tar.gz
kvision-659b87f5c1c297c68b125f67bc0b29b547debfd0.tar.bz2
kvision-659b87f5c1c297c68b125f67bc0b29b547debfd0.zip
Composable components methods
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/modal')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt22
2 files changed, 17 insertions, 9 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
index 5e0e910a..a7820b30 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
@@ -1,5 +1,6 @@
package pl.treksoft.kvision.modal
+import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.html.ALIGN
import pl.treksoft.kvision.html.BUTTONSTYLE
import pl.treksoft.kvision.html.Button
@@ -38,9 +39,10 @@ open class Alert(caption: String? = null, text: String? = null, rich: Boolean =
this.addButton(okButton)
}
- override fun hide() {
+ override fun hide(): Widget {
super.hide()
this.callback?.invoke()
+ return this
}
companion object {
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
index 1a0bce1a..d9a0466f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
@@ -87,28 +87,34 @@ open class Modal(caption: String? = null, closeButton: Boolean = true,
}
}
- override fun add(child: Widget) {
+ override fun add(child: Widget): Container {
body.add(child)
+ return this
}
- override fun addAll(children: List<Widget>) {
+ override fun addAll(children: List<Widget>): Container {
body.addAll(children)
+ return this
}
- open fun addButton(button: Button) {
+ open fun addButton(button: Button): Modal {
footer.add(button)
+ return this
}
- open fun removeButton(button: Button) {
+ open fun removeButton(button: Button): Modal {
footer.remove(button)
+ return this
}
- open fun removeButtonAt(index: Int) {
+ open fun removeButtonAt(index: Int): Modal {
footer.removeAt(index)
+ return this
}
- open fun removeAllButtons() {
+ open fun removeAllButtons(): Modal {
footer.removeAll()
+ return this
}
override fun getSnAttrs(): List<StringPair> {
@@ -151,9 +157,9 @@ open class Modal(caption: String? = null, closeButton: Boolean = true,
})
}
- override fun hide() {
+ override fun hide(): Widget {
if (visible) hideInternal()
- super.hide()
+ return super.hide()
}
open fun toggle() {