Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin 2.0.20 update #196

Merged
merged 3 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
java = "21"
kotlin = "1.9.24"
coroutines = "1.8.1"
kotlin = "2.0.21"
coroutines = "1.9.0"
flatlaf = "3.5.1"
kotest = "5.9.1"
ignition = "8.1.20"
Expand All @@ -18,7 +18,7 @@ dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
# core functionality
coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "coroutines" }
serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.6.3" }
serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.7.2" }
xerial-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version = "3.46.1.0" }
logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.8" }
hsql = { group = "org.hsqldb", name = "hsqldb", version = "2.7.3" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.inductiveautomation.kindling.idb

import com.formdev.flatlaf.extras.FlatSVGIcon
import com.github.weisj.jsvg.parser.LoaderContext
import com.github.weisj.jsvg.parser.SVGLoader
import com.inductiveautomation.ignition.gateway.images.ImageFormat
import io.github.inductiveautomation.kindling.core.ToolPanel
Expand Down Expand Up @@ -209,7 +210,7 @@ private class ImageRow(

val image: BufferedImage? by lazy {
if (type == ImageFormat.SVG) {
return@lazy SVGLoader().load(data.inputStream())?.let { svg ->
return@lazy SVGLoader().load(data.inputStream(), null, LoaderContext.createDefault())?.let { svg ->
val size = svg.size()
svg.render(size.width.toInt().coerceAtLeast(20), size.height.toInt().coerceAtLeast(20))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import java.io.InputStream
import java.lang.Thread.State as ThreadState

@Serializable
@ConsistentCopyVisibility
data class ThreadDump internal constructor(
val version: String,
val threads: List<Thread>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import org.jdesktop.swingx.decorator.HighlightPredicate
import org.jdesktop.swingx.sort.SortController
import org.jdesktop.swingx.table.ColumnControlButton
import java.awt.Color
import java.text.SimpleDateFormat
import java.util.Date
import javax.swing.JComponent
import javax.swing.SortOrder
import javax.swing.UIManager
Expand Down Expand Up @@ -40,11 +42,6 @@ class ReifiedJXTable<T : TableModel>(
}
isColumnControlVisible = true

setDefaultRenderer<String>(
getText = { it },
getTooltip = { it },
)

setSortOrderCycle(SortOrder.ASCENDING, SortOrder.DESCENDING, SortOrder.UNSORTED)

// TODO header name as tooltip without breaking sorting
Expand All @@ -63,6 +60,19 @@ class ReifiedJXTable<T : TableModel>(
return ColumnControlButton(this, FlatSVGIcon("icons/bx-column.svg").derive(0.8F))
}

override fun createDefaultRenderers() {
super.createDefaultRenderers()

setDefaultRenderer<String>(
getText = { it },
getTooltip = { it },
)
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
setDefaultRenderer<Date>(
getText = { it?.let(format::format) },
)
}

@Suppress("UNCHECKED_CAST")
override fun getModel(): T = super.getModel() as T

Expand Down