From 89ab2d0564a992a83f6e36512c8df16bbb1ddc46 Mon Sep 17 00:00:00 2001 From: sebai-dhia Date: Fri, 1 Nov 2024 14:54:58 +0100 Subject: [PATCH 1/2] Fix: Correct abnormal behavior of the list button and menu query in the ProductForm [APPS-02GS] --- .../ui/vaadin/base/BackgroundThreadHandler.kt | 1 + .../kopi/galite/demo/product/ProductForm.kt | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/galite-core/src/main/kotlin/org/kopi/galite/visual/ui/vaadin/base/BackgroundThreadHandler.kt b/galite-core/src/main/kotlin/org/kopi/galite/visual/ui/vaadin/base/BackgroundThreadHandler.kt index 8781a3b73..fafb862bc 100644 --- a/galite-core/src/main/kotlin/org/kopi/galite/visual/ui/vaadin/base/BackgroundThreadHandler.kt +++ b/galite-core/src/main/kotlin/org/kopi/galite/visual/ui/vaadin/base/BackgroundThreadHandler.kt @@ -139,6 +139,7 @@ object BackgroundThreadHandler { * @param command The command which accesses the UI. */ fun startAndWaitAndPush(lock: Object, currentUI: UI? = null, command: () -> Unit) { + Thread.sleep(50) accessAndPush(currentUI = currentUI, command = command) synchronized(lock) { diff --git a/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt b/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt index 386d52220..11139b3cc 100644 --- a/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt +++ b/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt @@ -41,7 +41,7 @@ class ProductForm : DictionaryForm(title = "Products", locale = Locale.UK) { val block = page.insertBlock(BlockProduct()) - inner class BlockProduct : Block("Products", 1, 1) { + inner class BlockProduct : Block("Products", 1, 100) { val u = table(Product, sequence = Sequence("PRODUCTS_SEQ")) val idPdt = hidden(domain = INT(20)) { @@ -52,22 +52,30 @@ class ProductForm : DictionaryForm(title = "Products", locale = Locale.UK) { val description = mustFill(domain = STRING(50), position = at(1, 1)) { label = "Description" help = "The product description" - columns(u.description) + columns(u.description){ + priority = 4 + } } val price = mustFill(domain = DECIMAL(20, 10), follow(description)) { label = "Price" help = "The product unit price excluding VAT" - columns(u.price) + columns(u.price){ + priority = 3 + } } val category = mustFill(domain = Category, position = at(2, 1)) { label = "Category" help = "The product category" - columns(u.category) + columns(u.category){ + priority = 2 + } } val taxName = mustFill(domain = Tax, position = at(3, 1)) { label = "Tax" help = "The product tax name" - columns(u.taxName) + columns(u.taxName){ + priority = 1 + } } val photo = visit(domain = IMAGE(width = 100, height = 100), position = at(5, 1)) { label = "Image" From 9f34d81298613351aea5d6f0927200e7c42f8d8c Mon Sep 17 00:00:00 2001 From: sebai-dhia Date: Mon, 4 Nov 2024 18:08:42 +0100 Subject: [PATCH 2/2] Clean: Improve code structure[APPS-02GS] --- .../kotlin/org/kopi/galite/demo/product/ProductForm.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt b/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt index 11139b3cc..d6829118d 100644 --- a/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt +++ b/galite-demo/galite-vaadin/src/main/kotlin/org/kopi/galite/demo/product/ProductForm.kt @@ -52,28 +52,28 @@ class ProductForm : DictionaryForm(title = "Products", locale = Locale.UK) { val description = mustFill(domain = STRING(50), position = at(1, 1)) { label = "Description" help = "The product description" - columns(u.description){ + columns(u.description) { priority = 4 } } val price = mustFill(domain = DECIMAL(20, 10), follow(description)) { label = "Price" help = "The product unit price excluding VAT" - columns(u.price){ + columns(u.price) { priority = 3 } } val category = mustFill(domain = Category, position = at(2, 1)) { label = "Category" help = "The product category" - columns(u.category){ + columns(u.category) { priority = 2 } } val taxName = mustFill(domain = Tax, position = at(3, 1)) { label = "Tax" help = "The product tax name" - columns(u.taxName){ + columns(u.taxName) { priority = 1 } }