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 | |
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')
10 files changed, 20 insertions, 10 deletions
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt index 3170e462..fdf9f95a 100644 --- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt +++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt @@ -222,7 +222,9 @@ open class DateTime( return this } + @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) override fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget { + @Suppress("DEPRECATION") input.setEventListener(block) return this } diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt index 4d90d18b..0c1df008 100644 --- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt +++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt @@ -192,7 +192,9 @@ open class SelectRemote<T : Any>( return this } + @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) override fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget { + @Suppress("DEPRECATION") input.setEventListener(block) return this } diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt index 8373dee7..af9e8c86 100644 --- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt +++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt @@ -209,7 +209,9 @@ open class Select( return this } + @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) override fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget { + @Suppress("DEPRECATION") input.setEventListener(block) return this } diff --git a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt index ac0e9836..b841b16c 100644 --- a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt +++ b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt @@ -206,7 +206,9 @@ open class Spinner( return this } + @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) override fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget { + @Suppress("DEPRECATION") input.setEventListener(block) return this } diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt index 67c660ea..20d836f0 100644 --- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt +++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt @@ -233,7 +233,9 @@ open class Upload( return this } + @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) override fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget { + @Suppress("DEPRECATION") input.setEventListener(block) return this } 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) { |