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.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt18
3 files changed, 13 insertions, 13 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
index a7820b30..c04449c2 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt
@@ -26,7 +26,7 @@ open class Alert(caption: String? = null, text: String? = null, rich: Boolean =
content.align = value
}
- val content = Tag(TAG.SPAN, text, rich, align)
+ private val content = Tag(TAG.SPAN, text, rich, align)
init {
body.add(content)
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt
index 366eec52..aa4e8b88 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt
@@ -26,14 +26,14 @@ open class Confirm(caption: String? = null, text: String? = null, rich: Boolean
set(value) {
content.align = value
}
- var cancelVisible = cancelVisible
+ private var cancelVisible = cancelVisible
set(value) {
field = value
refreshCancelButton()
}
- val content = Tag(TAG.SPAN, text, rich, align)
- val cancelButton = Button("Cancel", "remove")
+ private val content = Tag(TAG.SPAN, text, rich, align)
+ private val cancelButton = Button("Cancel", "remove")
init {
body.add(content)
diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
index c587e977..564a9f6f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
@@ -1,7 +1,6 @@
package pl.treksoft.kvision.modal
import com.github.snabbdom.VNode
-import org.w3c.dom.CustomEvent
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.core.Widget
@@ -20,15 +19,15 @@ enum class MODALSIZE(val className: String) {
@Suppress("TooManyFunctions")
open class Modal(caption: String? = null, closeButton: Boolean = true,
- size: MODALSIZE? = null, animation: Boolean = true, val escape: Boolean = true,
+ size: MODALSIZE? = null, animation: Boolean = true, private val escape: Boolean = true,
classes: Set<String> = setOf()) : Container(classes) {
- var caption
+ private var caption
get() = captionTag.text
set(value) {
captionTag.text = value
checkHeaderVisibility()
}
- var closeButton
+ private var closeButton
get() = closeIcon.visible
set(value) {
closeIcon.visible = value
@@ -39,18 +38,18 @@ open class Modal(caption: String? = null, closeButton: Boolean = true,
set(value) {
dialog.size = value
}
- var animation = animation
+ private var animation = animation
set(value) {
field = value
refresh()
}
- protected val dialog = ModalDialog(size)
- protected val header = Container(setOf("modal-header"))
+ private val dialog = ModalDialog(size)
+ private val header = Container(setOf("modal-header"))
protected val closeIcon = CloseIcon()
- protected val captionTag = Tag(TAG.H4, caption, classes = setOf("modal-title"))
+ private val captionTag = Tag(TAG.H4, caption, classes = setOf("modal-title"))
protected val body = Container(setOf("modal-body"))
- protected val footer = Container(setOf("modal-footer"))
+ private val footer = Container(setOf("modal-footer"))
init {
this.hide()
@@ -73,6 +72,7 @@ open class Modal(caption: String? = null, closeButton: Boolean = true,
content.add(footer)
val root = Root.getLastRoot()
if (root != null) {
+ @Suppress("LeakingThis")
root.addModal(this)
} else {
println("At least one Root object is required to create a modal!")