aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/modal
diff options
context:
space:
mode:
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() {