You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by jo...@apache.org on 2021/07/11 18:39:38 UTC

[isis] branch ISIS-2505_Catch_Up_With_Demo_Examples updated: ISIS-2505 Column width fixed

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

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


The following commit(s) were added to refs/heads/ISIS-2505_Catch_Up_With_Demo_Examples by this push:
     new 0dfa456  ISIS-2505 Column width fixed
0dfa456 is described below

commit 0dfa456b4e534222ed612dcea0155bcd1fb4555f
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Sun Jul 11 20:39:15 2021 +0200

    ISIS-2505 Column width fixed
---
 .../apache/isis/client/kroviz/ui/builder/ColBuilder.kt | 18 ++++++++++++++++++
 .../apache/isis/client/kroviz/ui/builder/RowBuilder.kt |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt
index 89e1166..978bbfb 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt
@@ -22,21 +22,27 @@ import io.kvision.core.*
 import io.kvision.panel.FieldsetPanel
 import io.kvision.panel.FlexPanel
 import io.kvision.panel.HPanel
+import io.kvision.panel.SimplePanel
 import org.apache.isis.client.kroviz.to.TObject
 import org.apache.isis.client.kroviz.to.bs3.Col
 import org.apache.isis.client.kroviz.ui.core.MenuFactory
 import org.apache.isis.client.kroviz.ui.core.RoDisplay
 import org.apache.isis.client.kroviz.ui.core.RoTable
 import org.apache.isis.client.kroviz.utils.Utils
+import kotlin.math.round
 
 class ColBuilder : UiBuilder() {
 
     fun create(col: Col, tObject: TObject, dsp: RoDisplay): FlexPanel {
         val panel = buildPanel()
 
+        console.log("[CB.create]")
+        console.log(col)
+
         if (col.actionList.size > 0) {
             if (col.domainObject != null) {
                 val menu = createMenu(tObject, dsp)
+                assignWidth(menu, col)
                 panel.add(menu)
             }
         }
@@ -56,6 +62,7 @@ class ColBuilder : UiBuilder() {
                 val fsPanel = FieldsetPanel(legend = legend).add(fsCpt)
                 val tto = TooltipOptions(title = fs.id)
                 fsPanel.enableTooltip(tto)
+                assignWidth(fsPanel, col)
                 panel.add(fsPanel)
             }
         }
@@ -101,4 +108,15 @@ class ColBuilder : UiBuilder() {
         return panel
     }
 
+    private fun assignWidth(panel: SimplePanel, col: Col) {
+        console.log("[CB.assignWidth] ${col.span}")
+        val proportion = col.span.toDouble().div(12)
+        val percent= proportion * 100
+        val rounded = round(percent)
+        val cssWidth = CssSize(rounded, UNIT.perc)
+        console.log(cssWidth.toString())
+        panel.flexBasis = cssWidth
+        panel.flexGrow = 1
+    }
+
 }
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt
index 64b77d8..2f8afea 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt
@@ -29,6 +29,8 @@ class RowBuilder : UiBuilder() {
 
     fun create(row: Row, tObject: TObject, dsp: RoDisplay): SimplePanel {
         val panel = buildPanel()
+        panel.justifyContent = JustifyContent.SPACEBETWEEN
+
         for (c in row.colList) {
             val cpt = ColBuilder().create(c, tObject, dsp)
             panel.add(cpt)