diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-11-15 09:07:05 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-11-15 09:07:05 +0100 |
commit | 77bf290155cbfa6d389c4937bf2a5a34dd5b33bd (patch) | |
tree | e558ab18360da4d1685dc204ae661c4357842e41 /kvision-modules/kvision-bootstrap | |
parent | 822ee9a8d0efd5bcacacd7dc5c1c35b549ed9c34 (diff) | |
download | kvision-77bf290155cbfa6d389c4937bf2a5a34dd5b33bd.tar.gz kvision-77bf290155cbfa6d389c4937bf2a5a34dd5b33bd.tar.bz2 kvision-77bf290155cbfa6d389c4937bf2a5a34dd5b33bd.zip |
Fix an issue with high CPU utilization in IntelliJ by introducing new onEvent extension function and changing the names of some style methods
Diffstat (limited to 'kvision-modules/kvision-bootstrap')
5 files changed, 10 insertions, 10 deletions
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt index 4c5b222e..852820af 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt @@ -77,13 +77,13 @@ open class Alert( init { body.add(contentTag) val okButton = Button("OK", "fas fa-check", ButtonStyle.PRIMARY) - okButton.setEventListener { + okButton.setEventListener<Button> { click = { hide() } } this.addButton(okButton) - this.setEventListener { + this.setEventListener<Button> { keydown = { e -> if (e.keyCode == ENTER_KEY) { hide() diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt index 058ca7bc..c464ea11 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt @@ -114,20 +114,20 @@ open class Confirm( init { body.add(contentTag) - cancelButton.setEventListener { + cancelButton.setEventListener<Button> { click = { hide() } } this.addButton(cancelButton) - noButton.setEventListener { + noButton.setEventListener<Button> { click = { hide() noCallback?.invoke() } } this.addButton(noButton) - yesButton.setEventListener { + yesButton.setEventListener<Button> { click = { hide() yesCallback?.invoke() diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt index b064e30c..63035e76 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt @@ -120,7 +120,7 @@ open class Modal( dialog.role = "document" dialog.add(content) closeIcon.visible = closeButton - closeIcon.setEventListener { + closeIcon.setEventListener<CloseIcon> { click = { hide() } diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt index de8d60e8..d75d10df 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt @@ -175,7 +175,7 @@ open class TabPanel( } } } - setEventListener { + setEventListener<Tag> { click = { e -> activeIndex = this@TabPanel.content.getChildren().indexOf(childrenMap[currentIndex]) e.preventDefault() diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt index 861127fa..b34de18d 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt @@ -189,7 +189,7 @@ open class Window( captionTag.add(windowIcon) header.add(iconsContainer) minimizeIcon.visible = minimizeButton - minimizeIcon.setEventListener { + minimizeIcon.setEventListener<MinimizeIcon> { click = { _ -> @Suppress("UnsafeCastFromDynamic") if (this@Window.dispatchEvent("minimizeWindow", obj {}) != false) { @@ -202,7 +202,7 @@ open class Window( } iconsContainer.add(minimizeIcon) maximizeIcon.visible = maximizeButton - maximizeIcon.setEventListener { + maximizeIcon.setEventListener<MaximizeIcon> { click = { _ -> @Suppress("UnsafeCastFromDynamic") if (this@Window.dispatchEvent("maximizeWindow", obj {}) != false) { @@ -215,7 +215,7 @@ open class Window( } iconsContainer.add(maximizeIcon) closeIcon.visible = closeButton - closeIcon.setEventListener { + closeIcon.setEventListener<CloseIcon> { click = { _ -> @Suppress("UnsafeCastFromDynamic") if (this@Window.dispatchEvent("closeWindow", obj {}) != false) { |