You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by jo...@apache.org on 2023/11/07 22:23:38 UTC
(causeway) branch spring6-kroviz updated: CAUSEWAY-3264 Upgrade to kvision 7.1 / kotlin 1.9.20
This is an automated email from the ASF dual-hosted git repository.
joergrade pushed a commit to branch spring6-kroviz
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/spring6-kroviz by this push:
new 311e4a0100 CAUSEWAY-3264 Upgrade to kvision 7.1 / kotlin 1.9.20
311e4a0100 is described below
commit 311e4a010000c71a61bd9dbe6db865b0adc3c2a6
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Tue Nov 7 23:22:07 2023 +0100
CAUSEWAY-3264 Upgrade to kvision 7.1 / kotlin 1.9.20
---
incubator/clients/kroviz/gradle.properties | 4 ++--
.../causeway/client/kroviz/ui/core/ColumnFactory.kt | 17 +++++++----------
.../causeway/client/kroviz/ui/dialog/VegaPanel.kt | 2 ++
.../org/apache/causeway/client/kroviz/utils/DomUtil.kt | 15 +++++++++++++++
4 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/incubator/clients/kroviz/gradle.properties b/incubator/clients/kroviz/gradle.properties
index a8aa07de18..5fc92777cf 100644
--- a/incubator/clients/kroviz/gradle.properties
+++ b/incubator/clients/kroviz/gradle.properties
@@ -18,10 +18,10 @@
#
javaVersion=17
#Plugins
-systemProp.kotlinVersion=1.8.21
+systemProp.kotlinVersion=1.9.20
serializationVersion=1.5.0
#Dependencies
-systemProp.kvisionVersion=6.6.0
+systemProp.kvisionVersion=7.1.0
coroutinesVersion=1.7.2
kotlin.mpp.stability.nowarn=true
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ColumnFactory.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ColumnFactory.kt
index c5963b689e..4268d572ae 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ColumnFactory.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ColumnFactory.kt
@@ -143,12 +143,10 @@ class ColumnFactory {
title = it.name,
field = it.id,
width = (it.typicalLength * 8).toString(),
- headerFilter = Editor.INPUT,
- formatterComponentFunction = { cellComponent: dynamic, _, _: dynamic ->
- console.log("[CF_buildVega]")
- console.log(cellComponent)
- this.buildDiagramPanel(cellComponent.unsafeCast<Tabulator.CellComponent>())
- })
+ formatterComponentFunction = { cellComponent: Tabulator.CellComponent, _: (callback: () -> Unit) -> Unit, nothing: Nothing ->
+ buildDiagramPanel(cellComponent)
+ }
+ )
}
private fun buildDiagramPanel(cellComponent: Tabulator.CellComponent): Component {
@@ -156,13 +154,12 @@ class ColumnFactory {
console.log(cellComponent)
val panel = VPanel()
panel.addAfterInsertHook {
- val row = cellComponent.getRow()
- val dynamic = row.getData().asDynamic()
- val json = dynamic.get("readOnlyProperty") as String
+ val json = cellComponent.getValue().unsafeCast<String>()
+ console.log(json)
val spec = JSON.parse<Vega5>(json)
val view = Vega.View(Vega.parse(spec), obj {
this.renderer = "canvas"
- this.container = getElement()
+ //this.container = getElement()
this.hover = true
})
view.runAsync()
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/dialog/VegaPanel.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/dialog/VegaPanel.kt
index 361f03d521..1aed9ffda5 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/dialog/VegaPanel.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/dialog/VegaPanel.kt
@@ -32,12 +32,14 @@ class VegaPanel : SimplePanel() {
this.addAfterInsertHook {
val json = VEGA_SAMPLE.str
val specFromClass = JSON.parse<Vega5>(json)
+ console.log("[VP#init]")
console.log(specFromClass)
val view = Vega.View(Vega.parse(specFromClass), obj {
this.renderer = "canvas"
this.container = getElement()
this.hover = true
})
+ console.log(view)
view.runAsync()
}
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/utils/DomUtil.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/utils/DomUtil.kt
index 7108ea1066..9b8f268fe1 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/utils/DomUtil.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/utils/DomUtil.kt
@@ -19,6 +19,7 @@
package org.apache.causeway.client.kroviz.utils
import kotlinx.browser.document
+import org.apache.causeway.client.kroviz.to.Vega5
import org.w3c.dom.Document
import org.w3c.dom.Element
@@ -55,6 +56,20 @@ object DomUtil {
append(uuid, svgDoc, true)
}
+ fun replaceWith(uuid: UUID, vegaCode: Vega5) {
+ //val svgDoc = newImage.document
+ append(uuid, vegaCode, true)
+ }
+
+ private fun append(uuid: UUID, vegaCode: Vega5, replace: Boolean) {
+ val element = getById(uuid.value)
+ if (element != null) {
+ if (replace) {
+ element.firstChild?.let { element.removeChild(it) }
+ }
+ element.asDynamic().appendChild(vegaCode.toString())
+ }
+ }
private fun append(uuid: UUID, svgDoc: Document, replace: Boolean) {
val element = getById(uuid.value)
if (element != null) {