1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
package com.example
import pl.treksoft.kvision.html.ALIGN
import pl.treksoft.kvision.html.BUTTONSTYLE
import pl.treksoft.kvision.html.Button
import pl.treksoft.kvision.html.Image
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
import pl.treksoft.kvision.modal.Alert
import pl.treksoft.kvision.modal.Confirm
import pl.treksoft.kvision.modal.Modal
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.panel.VPanel
import pl.treksoft.kvision.utils.px
class ModalsTab : SimplePanel() {
init {
this.marginTop = 10.px()
this.minHeight = 400.px()
val panel = VPanel(spacing = 30)
val alertButton = Button("Alert dialog", style = BUTTONSTYLE.DANGER).onClick {
Alert.show(
"Alert dialog",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor."
)
}
panel.add(alertButton)
val confirmButton = Button("Confirm dialog", style = BUTTONSTYLE.WARNING).onClick {
Confirm.show(
"Confirm dialog",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor.",
noCallback = {
Alert.show("Result", "You pressed NO button.")
}) {
Alert.show("Result", "You pressed YES button.")
}
}
panel.add(confirmButton)
val confirmButtonC = Button("Cancelable confirm dialog", style = BUTTONSTYLE.INFO).onClick {
Confirm.show(
"Cancelable confirm dialog",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor.",
align = ALIGN.CENTER,
cancelVisible = true,
noCallback = {
Alert.show("Result", "You pressed NO button.")
}) {
Alert.show("Result", "You pressed YES button.")
}
}
panel.add(confirmButtonC)
val modal = Modal("Custom modal dialog")
modal.add(
Tag(
TAG.H4,
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor."
)
)
modal.add(Image(require("./img/dog.jpg")))
modal.addButton(Button("Close").onClick {
modal.hide()
})
val modalButton = Button("Custom modal dialog", style = BUTTONSTYLE.SUCCESS).onClick {
modal.show()
}
panel.add(modalButton)
val fastAlertButton = Button("Alert dialog without animation", style = BUTTONSTYLE.PRIMARY).onClick {
Alert.show(
"Alert dialog without animation",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor.",
animation = false
)
}
panel.add(fastAlertButton)
this.add(panel)
}
}
|