diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-04-22 21:58:19 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-04-22 21:58:19 +0200 |
commit | 821883e06af48d5557a12475d9f08ff1d5c39f1c (patch) | |
tree | da3fd2ccc656ecebf7b93b655ad8af956fe814d7 /src/main | |
parent | 6f7736b85e0889aff26860e2960f52b301f460c5 (diff) | |
download | kvision-821883e06af48d5557a12475d9f08ff1d5c39f1c.tar.gz kvision-821883e06af48d5557a12475d9f08ff1d5c39f1c.tar.bz2 kvision-821883e06af48d5557a12475d9f08ff1d5c39f1c.zip |
Code style fixes.
Diffstat (limited to 'src/main')
7 files changed, 21 insertions, 19 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt index 1207ba5e..aa3f26bb 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt @@ -489,10 +489,9 @@ abstract class StyledComponent : Component { } protected open fun getCacheKey(): String { - val SEP = "###KvSep###" return propertyValues.map { it.toString() - }.joinToString(SEP) + }.joinToString("###KvSep###") } private fun <T> refreshOnUpdate(refreshFunction: ((T) -> Unit) = { this.refresh() }) = diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt index f0be38cb..7bbbcca3 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt @@ -637,6 +637,7 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent() { /** * Internal method called after destroying Snabbdom vnode. */ + @Suppress("UnsafeCastFromDynamic") internal open fun afterDestroyInternal() { this.tooltipOptions?.let { getElementJQueryD().tooltip("destroy") diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt index 2b51c62e..21281556 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt @@ -402,7 +402,7 @@ open class FormPanel<K : Any>( type: FormType? = null, classes: Set<String> = setOf(), noinline init: (FormPanel<K>.() -> Unit)? = null ): FormPanel<K> { - val formPanel = FormPanel.create<K>(method, action, enctype, type, classes) + val formPanel = create<K>(method, action, enctype, type, classes) init?.invoke(formPanel) this.add(formPanel) return formPanel diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt index f3625e97..d3211d7a 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt @@ -52,7 +52,7 @@ enum class Direction(internal val dir: String) { */ open class SplitPanel( private val direction: Direction = Direction.VERTICAL, - classes: Set<String> = setOf(), init: (SplitPanel.() -> kotlin.Unit)? = null + classes: Set<String> = setOf(), init: (SplitPanel.() -> Unit)? = null ) : SimplePanel(classes + ("splitpanel-" + direction.dir)) { @Suppress("LeakingThis") @@ -107,7 +107,7 @@ open class SplitPanel( */ fun Container.splitPanel( direction: Direction = Direction.VERTICAL, - classes: Set<String> = setOf(), init: (SplitPanel.() -> kotlin.Unit)? = null + classes: Set<String> = setOf(), init: (SplitPanel.() -> Unit)? = null ): SplitPanel { val splitPanel = SplitPanel(direction, classes, init) this.add(splitPanel) diff --git a/src/main/kotlin/pl/treksoft/kvision/table/Table.kt b/src/main/kotlin/pl/treksoft/kvision/table/Table.kt index 68db05d3..967d8b1d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/table/Table.kt +++ b/src/main/kotlin/pl/treksoft/kvision/table/Table.kt @@ -82,7 +82,9 @@ open class Table( private val tbody = Tag(TAG.TBODY) init { + @Suppress("LeakingThis") thead.parent = this + @Suppress("LeakingThis") tbody.parent = this refreshHeaders() @Suppress("LeakingThis") diff --git a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index dc8ea5f4..022eb6a0 100644 --- a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -31,7 +31,7 @@ import kotlin.js.Date const val KV_DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" -actual typealias Date = kotlin.js.Date +actual typealias Date = Date /** * Extension function to convert String to Date with a given date format. diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Cache.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Cache.kt index 6a473661..5b4306df 100644 --- a/src/main/kotlin/pl/treksoft/kvision/utils/Cache.kt +++ b/src/main/kotlin/pl/treksoft/kvision/utils/Cache.kt @@ -95,27 +95,27 @@ class LinkedList<T> { fun last(): Node<T>? { var node = head - if (node != null) { + return if (node != null) { while (node?.next != null) { node = node.next } - return node + node } else { - return null + null } } fun count(): Int { var node = head - if (node != null) { + return if (node != null) { var counter = 1 while (node?.next != null) { node = node.next counter += 1 } - return counter + counter } else { - return 0 + 0 } } @@ -167,19 +167,19 @@ class LinkedList<T> { fun removeLast(): T? { val last = this.last() - if (last != null) { - return removeNode(last) + return if (last != null) { + removeNode(last) } else { - return null + null } } fun removeAtIndex(index: Int): T? { val node = nodeAtIndex(index) - if (node != null) { - return removeNode(node) + return if (node != null) { + removeNode(node) } else { - return null + null } } @@ -193,6 +193,6 @@ class LinkedList<T> { s += ", " } } - return s + "]" + return "$s]" } } |