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/03/26 19:44:03 UTC

[causeway] branch ISIS-3171 updated (e9e2907cae -> 121c9e3ad9)

This is an automated email from the ASF dual-hosted git repository.

joergrade pushed a change to branch ISIS-3171
in repository https://gitbox.apache.org/repos/asf/causeway.git


    from e9e2907cae ISIS-3171 fieldset title set for collections
     new 687bfa47c3 ISIS-3171 cleanup CollectionDM
     new 9c6695af21 ISIS-3171 cleanup CollectionAggregator
     new 121c9e3ad9 ISIS-3171 table row menu shown (again)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../kroviz/core/aggregator/CollectionAggregator.kt |  9 +++--
 .../client/kroviz/core/model/CollectionDM.kt       | 10 +++---
 .../causeway/client/kroviz/core/model/ObjectDM.kt  |  8 +++--
 .../apache/causeway/client/kroviz/to/TypeMapper.kt | 41 +++++++++++++---------
 .../client/kroviz/ui/builder/ColBuilder.kt         |  9 +++--
 .../causeway/client/kroviz/ui/builder/RoDisplay.kt |  2 +-
 .../client/kroviz/ui/core/ColumnFactory.kt         |  7 ++--
 .../client/kroviz/ui/core/FormPanelFactory.kt      | 14 +++++---
 .../causeway/client/kroviz/ui/core/ViewManager.kt  |  2 --
 9 files changed, 60 insertions(+), 42 deletions(-)


[causeway] 02/03: ISIS-3171 cleanup CollectionAggregator

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joergrade pushed a commit to branch ISIS-3171
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 9c6695af218c660e9f2259b9949ed32c3fd4ce3e
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Wed Mar 1 08:46:34 2023 +0100

    ISIS-3171 cleanup CollectionAggregator
---
 .../client/kroviz/core/aggregator/CollectionAggregator.kt        | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt
index 7a8a89cfb6..d9476a52ca 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt
@@ -167,11 +167,10 @@ class CollectionAggregator(actionTitle: String, private val parent: ObjectAggreg
     }
 
     private fun handleCollection(collection: Collection) {
-        if (isParentedCollection()) {
-            getDisplayModel().id = collection.id
-            // add displayModel to parent.displayModel
-            val objectDM = parent!!.getDisplayModel()
-            objectDM.addCollectionModel(getDisplayModel())
+        if (parent != null) {
+            val cdm = getDisplayModel()
+            cdm.id = collection.id
+            parent.getDisplayModel().addCollectionModel(cdm)
         }
         collection.links.forEach {
             if (it.relation() == Relation.DESCRIBED_BY) {


[causeway] 01/03: ISIS-3171 cleanup CollectionDM

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joergrade pushed a commit to branch ISIS-3171
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 687bfa47c3af4c60f1caf82a86fb7bbf6c187780
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Wed Mar 1 08:38:32 2023 +0100

    ISIS-3171 cleanup CollectionDM
---
 .../apache/causeway/client/kroviz/core/model/CollectionDM.kt   | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionDM.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionDM.kt
index c6681327d1..1f1f47c6c5 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionDM.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionDM.kt
@@ -71,12 +71,10 @@ class CollectionDM(override var title: String) : DisplayModelWithLayout() {
     }
 
     override fun addData(obj: TransferObject) {
-        //TODO is checking rawdata really needed?
-        if (!rawData.contains(obj)) {
-            rawData.add(obj)
-            val exo = Exposer(obj as TObject)
-            data.add(exo.dynamise())  //if exposer is not dynamised, data access in Tabulator tables won't work
-        }
+        rawData.add(obj)
+        val exo = Exposer(obj as TObject)
+        //if exposer is not dynamised, data access in Tabulator tables won't work
+        data.add(exo.dynamise() as Exposer)
     }
 
     override fun reset() {


[causeway] 03/03: ISIS-3171 table row menu shown (again)

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joergrade pushed a commit to branch ISIS-3171
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 121c9e3ad914cb6d3cfa7854952997d41f065090
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Sun Mar 26 21:43:47 2023 +0200

    ISIS-3171 table row menu shown (again)
---
 .../causeway/client/kroviz/core/model/ObjectDM.kt  |  8 +++--
 .../apache/causeway/client/kroviz/to/TypeMapper.kt | 41 +++++++++++++---------
 .../client/kroviz/ui/builder/ColBuilder.kt         |  9 +++--
 .../causeway/client/kroviz/ui/builder/RoDisplay.kt |  2 +-
 .../client/kroviz/ui/core/ColumnFactory.kt         |  7 ++--
 .../client/kroviz/ui/core/FormPanelFactory.kt      | 14 +++++---
 .../causeway/client/kroviz/ui/core/ViewManager.kt  |  2 --
 7 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/ObjectDM.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/ObjectDM.kt
index d1a3349861..9edca84dff 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/ObjectDM.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/ObjectDM.kt
@@ -44,12 +44,16 @@ class ObjectDM(override val title: String) : DisplayModelWithLayout() {
         }
     }
 
+    fun hasCollectionModels(): Boolean {
+        return collectionModelList.isNotEmpty()
+    }
+
     fun addLayout(grid: GridBs, aggregator: ObjectAggregator, referrer: String?) {
         layout = ObjectLayout(grid, aggregator, referrer!!)
     }
 
-    fun getCollectionDisplayModelFor(id: String): CollectionDM {
-        return collectionModelList.firstOrNull { it.id == id }!!
+    fun getCollectionDisplayModelFor(id: String): CollectionDM? {
+        return collectionModelList.firstOrNull { it.id == id }
     }
 
     override fun readyToRender(): Boolean {
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/TypeMapper.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/TypeMapper.kt
index a00b6367b1..12d02bd0ee 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/TypeMapper.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/TypeMapper.kt
@@ -25,6 +25,7 @@ enum class ValueType(val type: String) {
     BOOLEAN("Boolean"),
     DATE("Date"),
     HTML("Html"),
+    IFRAME("IFrame"),
     IMAGE("Image"),
     NUMERIC("Numeric"),
     PASSWORD("Password"),
@@ -36,7 +37,7 @@ enum class ValueType(val type: String) {
     SHELL("Shell"),
     SVG_MAPPED("Map"),
     SVG_INLINE("Inline"),
-    IFRAME("IFrame")
+    VEGA("Vega"),
 }
 
 class TypeMapper {
@@ -68,23 +69,31 @@ class TypeMapper {
             else -> ValueType.TEXT.type
         }
     }
+    fun forString(content: String): ValueType {
+        return when {
+            content.startsWith(":Notice:") -> ValueType.TEXT_AREA
+            else -> ValueType.TEXT
+        }
+    }
 
     fun forType(type: String): ValueType {
-        when {
-            type == ValueType.BOOLEAN.type -> return ValueType.BOOLEAN
-            type == ValueType.DATE.type -> return ValueType.DATE
-            type == ValueType.HTML.type -> return ValueType.HTML
-            type == ValueType.IMAGE.type -> return ValueType.IMAGE
-            type == ValueType.NUMERIC.type -> return ValueType.NUMERIC
-            type == ValueType.PASSWORD.type -> return ValueType.PASSWORD
-            type == ValueType.TEXT.type -> return ValueType.TEXT
-            type == ValueType.TEXT_AREA.type -> return ValueType.TEXT_AREA
-            type == ValueType.TIME.type -> return ValueType.TIME
-            type == ValueType.SIMPLE_SELECT.type -> return ValueType.SIMPLE_SELECT
-            type == ValueType.SLIDER.type -> return ValueType.SLIDER
-            type == ValueType.SVG_MAPPED.type -> return ValueType.SVG_MAPPED
-            type == ValueType.SVG_INLINE.type -> return ValueType.SVG_INLINE
-            type == ValueType.IFRAME.type -> return ValueType.IFRAME
+        console.log("[TM_forType] $type")
+        when (type) {
+            ValueType.BOOLEAN.type -> return ValueType.BOOLEAN
+            ValueType.DATE.type -> return ValueType.DATE
+            ValueType.HTML.type -> return ValueType.HTML
+            ValueType.IFRAME.type -> return ValueType.IFRAME
+            ValueType.IMAGE.type -> return ValueType.IMAGE
+            ValueType.NUMERIC.type -> return ValueType.NUMERIC
+            ValueType.PASSWORD.type -> return ValueType.PASSWORD
+            ValueType.TEXT.type -> return ValueType.TEXT
+            ValueType.TEXT_AREA.type -> return ValueType.TEXT_AREA
+            ValueType.TIME.type -> return ValueType.TIME
+            ValueType.SIMPLE_SELECT.type -> return ValueType.SIMPLE_SELECT
+            ValueType.SLIDER.type -> return ValueType.SLIDER
+            ValueType.SVG_MAPPED.type -> return ValueType.SVG_MAPPED
+            ValueType.SVG_INLINE.type -> return ValueType.SVG_INLINE
+            ValueType.VEGA.type -> return ValueType.VEGA
             else -> {
                 return ValueType.TEXT
             }
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/ColBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/ColBuilder.kt
index 4824dafbd8..ac254fef31 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/ColBuilder.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/ColBuilder.kt
@@ -68,13 +68,16 @@ class ColBuilder : UiBuilder() {
         col.collectionList.forEach {
             val id = it.id
             val objectDM = dsp.displayModel
-            // static analysis says objectDM is never null, but runtime disagrees
-            if (objectDM != null) {
-                val cdm = objectDM.getCollectionDisplayModelFor(id)
+            try {
+                // objectDM is sometimes null
+                val cdm = objectDM.getCollectionDisplayModelFor(id)!!
                 val fsPanel = FieldsetPanel(legend = cdm.getTitle())
                 fsPanel.add(RoTable(cdm))
                 panel.add(fsPanel)
                 cdm.isRendered = true
+            } catch (npe: NullPointerException) {
+                console.log("[CB_create] failed with NPE")
+                throw npe
             }
         }
         return panel
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/RoDisplay.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/RoDisplay.kt
index ac71944687..9da11b0c75 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/RoDisplay.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/builder/RoDisplay.kt
@@ -35,7 +35,7 @@ class RoDisplay(val displayModel: ObjectDM) : Displayable, VPanel() {
     init {
         val model = displayModel.data!!
         val tObject: TObject = model.delegate
-        val grid = (displayModel.layout as ObjectLayout).grid!!
+        val grid = (displayModel.layout as ObjectLayout).grid
         objectPanel = LayoutBuilder().create(grid, tObject, this)
         objectPanel.overflow = Overflow.AUTO
         objectPanel.width = CssSize(100, UNIT.perc)
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 e21d79f37f..2b4907d48b 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
@@ -57,14 +57,15 @@ class ColumnFactory {
             hozAlign = Align.CENTER,
             width = "40",
             headerSort = false,
-            clickMenu = { component: dynamic, _: dynamic ->
-                buildObjectMenu(component)
+            clickMenu = { _: dynamic, cellComponent: dynamic ->
+                buildObjectMenu(cellComponent.unsafeCast<Tabulator.CellComponent>())
             }
         )
     }
 
     private fun buildObjectMenu(cell: Tabulator.CellComponent): dynamic {
-        val exposer = cell.getData() as Exposer
+        val row = cell.getRow()
+        val exposer = row.getData() as Exposer
         val tObject = exposer.delegate
         return DynamicMenuBuilder.buildObjectMenu(tObject)
     }
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/FormPanelFactory.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/FormPanelFactory.kt
index df4b72fb14..26f9db4443 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/FormPanelFactory.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/FormPanelFactory.kt
@@ -74,13 +74,17 @@ class FormPanelFactory(items: List<FormItem>) : VPanel() {
                     ValueType.SVG_INLINE -> add(createInline(fi))
                     ValueType.SVG_MAPPED -> add(createSvgMap(fi))
                     ValueType.BUTTON -> add(createButton(fi))
+                    ValueType.VEGA -> {
+                        TODO("implement VEGA")
+                    }
                 }
             }
         }
     }
 
     private fun createButton(fi: FormItem): Button {
-        val item = Button(text = fi.label, icon = IconManager.find(fi.label))
+        val icon = IconManager.find(fi.label)
+        val item = Button(text = fi.label, icon = icon)
         val obj = fi.callBack!! as Controller
         val action = fi.callBackAction
         item.onClick {
@@ -92,8 +96,8 @@ class FormPanelFactory(items: List<FormItem>) : VPanel() {
     private fun createBoolean(fi: FormItem): Component {
         val value = fi.content
         val bools = arrayOf("true", "false")
-        return when {
-            value in bools -> CheckBox(label = fi.label, value = (value == "true"))
+        return when (value) {
+            in bools -> CheckBox(label = fi.label, value = (value == "true"))
             else -> createText(fi)
         }
     }
@@ -137,6 +141,8 @@ class FormPanelFactory(items: List<FormItem>) : VPanel() {
     }
 
     private fun createTextArea(fi: FormItem): TextArea {
+        console.log("[FPF_createTextArea]")
+        console.log(fi)
         val rows = fi.size
         val item: TextArea = if (rows != null) {
             val rowCnt = maxOf(3, rows)
@@ -181,10 +187,10 @@ class FormPanelFactory(items: List<FormItem>) : VPanel() {
                     //image(require("img/kroviz-logo.svg"))
                 }
                 else -> {
+                    TODO("implement")
                 }
             }
         }
-        //TODO
         panel.add(fi.content as Image)
         panel.addCssClass("form-panel")
         return panel
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ViewManager.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ViewManager.kt
index 37e219cf29..7da325bc72 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ViewManager.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/ui/core/ViewManager.kt
@@ -176,8 +176,6 @@ object ViewManager {
     fun openObjectView(aggregator: SystemAggregator) {
         console.log("[VM_openObjectView]")
         val dm = aggregator.displayModel
-/*        val panel = RoDisplay(dm)
-        add(aggregator.getTitle(), panel, aggregator)*/
         dm.isRendered = true
         setNormalCursor()
     }