From 77bf290155cbfa6d389c4937bf2a5a34dd5b33bd Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Fri, 15 Nov 2019 09:07:05 +0100 Subject: Fix an issue with high CPU utilization in IntelliJ by introducing new onEvent extension function and changing the names of some style methods --- .../src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt | 2 ++ .../src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt | 2 ++ .../src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt | 2 ++ .../src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt | 2 ++ .../src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt | 2 ++ .../src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt | 4 ++-- .../src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt | 6 +++--- .../src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt | 2 +- .../src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt | 2 +- .../src/main/kotlin/pl/treksoft/kvision/window/Window.kt | 6 +++--- 10 files changed, 20 insertions(+), 10 deletions(-) (limited to 'kvision-modules') 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.() -> 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( return this } + @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) override fun setEventListener(block: SnOn.() -> 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.() -> 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.() -> 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.() -> 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