From e4b5290e4898858612da882d9186b2aba548a9d9 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 27 Feb 2020 15:28:16 +0100 Subject: Remove deprecated methods. Style fixes. --- .../pl/treksoft/kvision/form/time/DateTime.kt | 6 - .../treksoft/kvision/form/select/SelectRemote.kt | 6 - .../kvision/form/select/SelectRemoteInput.kt | 4 +- .../pl/treksoft/kvision/form/select/Select.kt | 6 - .../pl/treksoft/kvision/form/spinner/Spinner.kt | 9 -- .../pl/treksoft/kvision/form/upload/Upload.kt | 6 - .../main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - .../main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - .../pl/treksoft/kvision/remote/KVServiceManager.kt | 14 +- .../main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - .../pl/treksoft/kvision/remote/KVServiceManager.kt | 14 +- .../main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - .../pl/treksoft/kvision/remote/KVServiceManager.kt | 14 +- .../main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - .../pl/treksoft/kvision/remote/KVServiceManager.kt | 15 +- .../main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - src/main/kotlin/pl/treksoft/kvision/core/Css.kt | 180 +-------------------- src/main/kotlin/pl/treksoft/kvision/core/Widget.kt | 24 +-- .../pl/treksoft/kvision/form/check/CheckBox.kt | 9 -- .../kotlin/pl/treksoft/kvision/form/check/Radio.kt | 9 -- .../kotlin/pl/treksoft/kvision/form/range/Range.kt | 9 -- .../treksoft/kvision/form/select/SimpleSelect.kt | 6 - .../pl/treksoft/kvision/form/text/AbstractText.kt | 6 - src/main/kotlin/pl/treksoft/kvision/types/Date.kt | 3 - 24 files changed, 33 insertions(+), 325 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 4f3f3f48..6d687bb9 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 @@ -221,12 +221,6 @@ open class DateTime( return input.setEventListener(block) } - @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) 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 e2f84fff..dbd0aa70 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 @@ -191,12 +191,6 @@ open class SelectRemote( return input.setEventListener(block) } - @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt index 96277728..6092fd93 100644 --- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt +++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt @@ -169,9 +169,9 @@ open class SelectRemoteInput( JSON.plain.stringify(JsonRpcRequest(0, url, listOf(null, it, state))), HttpMethod.POST ).await() - JSON.plain.parse(RemoteOption.serializer().list, initials.result as String).map { + JSON.plain.parse(RemoteOption.serializer().list, initials.result as String).mapNotNull { it.text - }.filterNotNull().joinToString(", ") + }.joinToString(", ") } val button = getElementJQuery()?.next() button?.removeClass("bs-placeholder") 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 9f66afd8..b3f5e1c1 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,12 +209,6 @@ open class Select( return input.setEventListener(block) } - @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) 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 c8b51372..a842a37f 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 @@ -205,15 +205,6 @@ open class Spinner( return input.setEventListener(block) } - @Deprecated( - "Use onEvent extension function instead.", - ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent") - ) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) 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 3ba635fd..ce885ff3 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 @@ -232,12 +232,6 @@ open class Upload( return input.setEventListener(block) } - @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 785dc789..3e7152a1 100644 --- a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -21,9 +21,6 @@ */ package pl.treksoft.kvision.types -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -expect class Date - expect class LocalDateTime expect class LocalDate diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index bb76914c..78370a70 100644 --- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -29,9 +29,6 @@ import kotlinx.serialization.internal.SerialClassDescImpl import kotlin.js.Date import kotlin.math.absoluteValue -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -actual typealias Date = Date - actual typealias LocalDateTime = Date actual typealias LocalDate = Date diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 5cbd3495..ffb2936b 100644 --- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -144,7 +144,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -184,7 +184,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -228,7 +228,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -274,7 +274,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -321,7 +321,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -370,7 +370,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -494,7 +494,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 09ba6d01..61f8ba58 100644 --- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -36,9 +36,6 @@ import java.time.OffsetTime import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -actual typealias Date = LocalDateTime - actual typealias LocalDateTime = LocalDateTime actual typealias LocalDate = LocalDate diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index dc1e0f65..4e44162f 100644 --- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -128,7 +128,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -164,7 +164,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -204,7 +204,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -246,7 +246,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -289,7 +289,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -334,7 +334,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName @@ -448,7 +448,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: result = mapper.writeValueAsString(result) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) JsonRpcResponse( id = jsonRpcRequest.id, error = e.message ?: "Error", exceptionType = e.javaClass.canonicalName diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 09ba6d01..61f8ba58 100644 --- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -36,9 +36,6 @@ import java.time.OffsetTime import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -actual typealias Date = LocalDateTime - actual typealias LocalDateTime = LocalDateTime actual typealias LocalDate = LocalDate diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index d3fde5c7..276ee9a6 100644 --- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -128,7 +128,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, @@ -168,7 +168,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, @@ -217,7 +217,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, @@ -268,7 +268,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, @@ -320,7 +320,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, @@ -374,7 +374,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, @@ -478,7 +478,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) call.respond( JsonRpcResponse( id = jsonRpcRequest.id, diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 09ba6d01..61f8ba58 100644 --- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -36,9 +36,6 @@ import java.time.OffsetTime import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -actual typealias Date = LocalDateTime - actual typealias LocalDateTime = LocalDateTime actual typealias LocalDate = LocalDate diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 34fb02db..2ee939ef 100644 --- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -35,7 +35,6 @@ import kotlinx.coroutines.reactive.awaitSingle import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext -import org.springframework.security.core.Authentication import org.springframework.web.reactive.function.server.ServerRequest import org.springframework.web.reactive.function.server.ServerResponse import org.springframework.web.reactive.function.server.awaitBody @@ -143,7 +142,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( @@ -188,7 +187,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( @@ -244,7 +243,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( @@ -302,7 +301,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( @@ -361,7 +360,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( @@ -422,7 +421,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( @@ -531,7 +530,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: ) ) } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) + if (e !is ServiceException) LOG.error(e.message, e) ServerResponse.ok().json().bodyValueAndAwait( mapper.writeValueAsString( JsonRpcResponse( diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 09ba6d01..61f8ba58 100644 --- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -36,9 +36,6 @@ import java.time.OffsetTime import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -actual typealias Date = LocalDateTime - actual typealias LocalDateTime = LocalDateTime actual typealias LocalDate = LocalDate diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt index 66a0db36..e2108136 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt @@ -566,31 +566,6 @@ class Border( private val width: CssSize? = null, private val style: BorderStyle? = null, private val color: Color? = null ) { - /** - * Creates CSS Border with given width, style and color given in hex format. - * @param width width of the border - * @param style style of the border - * @param color color in hex format - */ - @Deprecated( - "Use primary constructor Border(CssSize?, BorderStyle?, Color?) instead.", - level = DeprecationLevel.WARNING - ) - constructor(width: CssSize? = null, style: BorderStyle? = null, color: Int) : this( - width, style, Color.hex(color) - ) - - /** - * Creates CSS Border with given width, style and color given with named constant. - * @param width width of the border - * @param style style of the border - * @param color color named constant - */ - @Deprecated( - "Use primary constructor Border(CssSize?, BorderStyle?, Color?) instead.", - level = DeprecationLevel.WARNING - ) - constructor(width: CssSize? = null, style: BorderStyle? = null, color: Col) : this(width, style, Color.name(color)) internal fun asString(): String { val w = width?.asString() @@ -602,21 +577,9 @@ class Border( /** * Type-safe definition of CSS color. + * @param color CSS color string */ -class Color private constructor(internal val color: String? = null) { - /** - * Creates CSS Color with color given in hex format. - * @param color color in hex format - */ - @Deprecated("Use Color.hex() function instead.", level = DeprecationLevel.WARNING) - constructor(color: Int) : this("#" + color.toHexString()) - - /** - * Creates CSS Color with color given with named constant. - * @param color color named constant - */ - @Deprecated("Use Color.name() function instead.", level = DeprecationLevel.WARNING) - constructor(color: Col) : this(color.color) +class Color(val color: String? = null) { fun asString(): String { return color.orEmpty() @@ -665,89 +628,6 @@ class Background( private val origin: BgOrigin? = null, private val clip: BgClip? = null, private val attachment: BgAttach? = null ) { - /** - * Creates CSS Background with given parameters. - * @param image background image - * @param positionX horizontal position of the background image - * @param positionY vertical position of the background image - * @param sizeX horizontal size of the background image - * @param sizeY vertical size of the background image - * @param size resize of the background image - * @param repeat repeat option of the background image - * @param origin origin option of the background image - * @param clip clipping option of the background image - * @param attachment attachment option of the background image - */ - @Deprecated( - "Use primary constructor Background(Color?, ResString?, ...) instead.", - level = DeprecationLevel.WARNING - ) - constructor( - image: ResString? = null, positionX: CssSize? = null, positionY: CssSize? = null, - sizeX: CssSize? = null, sizeY: CssSize? = null, size: BgSize? = null, - repeat: BgRepeat? = null, origin: BgOrigin? = null, clip: BgClip? = null, - attachment: BgAttach? = null - ) : this( - null, - image, positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, attachment - ) - - /** - * Creates CSS Background with given parameters. - * @param color color of the background in hex format - * @param image background image - * @param positionX horizontal position of the background image - * @param positionY vertical position of the background image - * @param sizeX horizontal size of the background image - * @param sizeY vertical size of the background image - * @param size resize of the background image - * @param repeat repeat option of the background image - * @param origin origin option of the background image - * @param clip clipping option of the background image - * @param attachment attachment option of the background image - */ - @Deprecated( - "Use primary constructor Background(Color?, ResString?, ...) instead.", - level = DeprecationLevel.WARNING - ) - constructor( - color: Int, image: ResString? = null, positionX: CssSize? = null, - positionY: CssSize? = null, - sizeX: CssSize? = null, sizeY: CssSize? = null, size: BgSize? = null, - repeat: BgRepeat? = null, origin: BgOrigin? = null, clip: BgClip? = null, - attachment: BgAttach? = null - ) : this( - Color.hex(color), image, positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, - attachment - ) - - /** - * Creates CSS Background with given parameters. - * @param color color of the background with named constant - * @param image background image - * @param positionX horizontal position of the background image - * @param positionY vertical position of the background image - * @param sizeX horizontal size of the background image - * @param sizeY vertical size of the background image - * @param size resize of the background image - * @param repeat repeat option of the background image - * @param origin origin option of the background image - * @param clip clipping option of the background image - * @param attachment attachment option of the background image - */ - @Deprecated( - "Use primary constructor Background(Color?, ResString?, ...) instead.", - level = DeprecationLevel.WARNING - ) - constructor( - color: Col, image: ResString? = null, positionX: CssSize? = null, - positionY: CssSize? = null, sizeX: CssSize? = null, sizeY: CssSize? = null, - size: BgSize? = null, repeat: BgRepeat? = null, origin: BgOrigin? = null, clip: BgClip? = null, - attachment: BgAttach? = null - ) : this( - Color.name(color), image, - positionX, positionY, sizeX, sizeY, size, repeat, origin, clip, attachment - ) internal fun asString(): String { val img = image?.let { @@ -780,33 +660,6 @@ class TextDecoration( private val line: TextDecorationLine? = null, private val style: TextDecorationStyle? = null, private val color: Color? = null ) { - /** - * Creates CSS text decoration with given line, style and color given in hex format. - * @param line text decoration line - * @param style text decoration style - * @param color color in hex format - */ - @Deprecated( - "Use primary constructor TextDecoration(TextDecorationLine?, TextDecorationStyle?, Color?) instead.", - level = DeprecationLevel.WARNING - ) - constructor(line: TextDecorationLine? = null, style: TextDecorationStyle? = null, color: Int) : this( - line, style, Color.hex(color) - ) - - /** - * Creates CSS text decoration with given line, style and color given with named constant. - * @param line text decoration line - * @param style text decoration style - * @param color color named constant - */ - @Deprecated( - "Use primary constructor TextDecoration(TextDecorationLine?, TextDecorationStyle?, Color?) instead.", - level = DeprecationLevel.WARNING - ) - constructor(line: TextDecorationLine? = null, style: TextDecorationStyle? = null, color: Col) : this( - line, style, Color.name(color) - ) internal fun asString(): String { return (line?.textDecorationLine).orEmpty() + " " + @@ -828,35 +681,6 @@ class TextShadow private constructor( private val hShadow: CssSize? = null, private val vShadow: CssSize? = null, private val blurRadius: CssSize? = null, private val color: Color? = null ) { - /** - * Creates CSS text shadow with given position and radius and color given in hex format. - * @param hShadow the position of horizontal shadow - * @param vShadow the position of vertical shadow - * @param blurRadius the blur radius - * @param color color in hex format - */ - @Deprecated( - "Use primary constructor TextDecoration(TextDecorationLine?, TextDecorationStyle?, Color?) instead.", - level = DeprecationLevel.WARNING - ) - constructor(hShadow: CssSize? = null, vShadow: CssSize? = null, blurRadius: CssSize? = null, color: Int) : this( - hShadow, vShadow, blurRadius, Color.hex(color) - ) - - /** - * Creates CSS text shadow with given position and radius and color given with named constant. - * @param hShadow the position of horizontal shadow - * @param vShadow the position of vertical shadow - * @param blurRadius the blur radius - * @param color color named constant - */ - @Deprecated( - "Use primary constructor TextDecoration(TextDecorationLine?, TextDecorationStyle?, Color?) instead.", - level = DeprecationLevel.WARNING - ) - constructor(hShadow: CssSize? = null, vShadow: CssSize? = null, blurRadius: CssSize? = null, color: Col) : this( - hShadow, vShadow, blurRadius, Color.name(color) - ) internal fun asString(): String { return (hShadow?.asString()).orEmpty() + " " + diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt index 4dcb62e3..b74352d3 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt @@ -317,7 +317,7 @@ open class Widget(classes: Set = setOf()) : StyledComponent(), Component * @suppress * Internal function */ - @Suppress("UNCHECKED_CAST") + @Suppress("UNCHECKED_CAST", "UnsafeCastFromDynamic") protected fun setInternalEventListener(block: SnOn.() -> Unit): Int { val handlerCounter = listenerCounter++ val blockAsWidget = block as SnOn.() -> Unit @@ -372,28 +372,6 @@ open class Widget(classes: Set = setOf()) : StyledComponent(), Component return handlerCounter } - /** - * Sets an event listener for current widget. - * @param block event handler - * @return id of the handler - * - * Example: - * - * button.setEventListener { - * dblclick = { - * Alert.show("Button double clicked!") - * // self is of type Widget here - * } - * } - */ - @Deprecated( - "Use onEvent extension function instead.", - ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent") - ) - open fun setEventListener(block: SnOn.() -> Unit): Int { - return setEventListener(block) - } - /** * Removes event listener from current widget. * @param id the id of the handler returned by onEvent diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt index 7dae0f86..60147114 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt @@ -127,15 +127,6 @@ open class CheckBox( return input.setEventListener(block) } - @Deprecated( - "Use onEvent extension function instead.", - ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent") - ) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt index 4d8a1607..b8757da2 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt @@ -137,15 +137,6 @@ open class Radio( return input.setEventListener(block) } - @Deprecated( - "Use onEvent extension function instead.", - ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent") - ) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/src/main/kotlin/pl/treksoft/kvision/form/range/Range.kt b/src/main/kotlin/pl/treksoft/kvision/form/range/Range.kt index a03ce2c8..a54ccddb 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/range/Range.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/range/Range.kt @@ -165,15 +165,6 @@ open class Range( return input.setEventListener(block) } - @Deprecated( - "Use onEvent extension function instead.", - ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent") - ) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt index 97e61de3..4d47a239 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt @@ -141,12 +141,6 @@ open class SimpleSelect( return input.setEventListener(block) } - @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt index c7528cb1..d887e814 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractText.kt @@ -138,12 +138,6 @@ abstract class AbstractText(label: String? = null, rich: Boolean = false) : return input.setEventListener(block) } - @Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent")) - override fun setEventListener(block: SnOn.() -> Unit): Int { - @Suppress("DEPRECATION") - return input.setEventListener(block) - } - override fun removeEventListener(id: Int): Widget { input.removeEventListener(id) return this diff --git a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 9f601c25..889d26fc 100644 --- a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -31,9 +31,6 @@ import kotlin.js.Date const val KV_DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" -@Deprecated("Not supported in KVision 2+. Use LocalDateTime or OffsetDateTime instead.", level = DeprecationLevel.ERROR) -actual typealias Date = Date - actual typealias LocalDateTime = Date actual typealias LocalDate = Date -- cgit