]> uap-core.de Git - rssreader.git/commitdiff
remove invisible tabview from window layout and replace it with a visibility state
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 3 Dec 2025 17:51:58 +0000 (18:51 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 3 Dec 2025 17:51:58 +0000 (18:51 +0100)
rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt
rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt

index 1943dd1d4a284f7369fbe2114cc992a7548b5782..145bb10c20de9eeca4c22419329db2c7d2030bf6 100644 (file)
@@ -17,7 +17,6 @@ class FeedList(window: MainWindow) : Document() {
     val link = UiLinkData(linkstr)
     val category = string("category")
     val webview = webview("webview")
-    val tabview = integer("tabview")
     val starred = integer("starred")
     val browser = integer("browser")
 
@@ -148,7 +147,7 @@ class FeedList(window: MainWindow) : Document() {
             starred.setIntValue(0)
         }
 
-        tabview.setIntValue(1) // select item page
+        window.window.ui.setState(MainWindow.ITEM_SELETED)
 
         val browserSetting = browserSetting.intValue()
         if(browserSetting == 0) {
index 7d090f7f7fe7614c09346c8e4f9bb1462dcc9415..7ef0f34b4935b7ae2d740ff1f19e12572fe550b4 100644 (file)
@@ -29,6 +29,7 @@ import java.time.format.DateTimeFormatter
 
 class MainWindow() {
     companion object {
+        const val ITEM_SELETED = 900
         const val ITEM_HAS_AUTHOR = 1000
         const val ITEM_HAS_CATEGORY = 1001
         const val ITEM_INTERNAL_BROWSER = 1002
@@ -288,49 +289,40 @@ class MainWindow() {
             }
 
             rightPanel {
-                tabview(fill = true, varname = "tabview", type = TabViewType.INVISIBLE) {
-                    tab {
-                        // Completely empty tab, we don't want any visible UI elements
-                        // when no feed item is selected.
-                        // As an alternative to using a tabview, we could use a
-                        // visibility state for the grid container
+                val g = grid(fill = true, columnspacing = 8, rowspacing = 8, margin = 8, defvfill = true) {
+                    row {
+                        rlabel("Feed:", hfill = true)
+                        llabel(varname = "feedname", hexpand = true)
+                    }
+                    row {
+                        val w1 = rlabel("Author:", hfill = true)
+                        val w2 = llabel(varname = "author")
+                        w1.setVisibilityStates(ITEM_HAS_AUTHOR)
+                        w2.setVisibilityStates(ITEM_HAS_AUTHOR)
+                    }
+                    row {
+                        val w1 = rlabel("Category: ", hfill = true)
+                        val w2 = llabel(varname = "category")
+                        w1.setVisibilityStates(ITEM_HAS_CATEGORY)
+                        w2.setVisibilityStates(ITEM_HAS_CATEGORY)
+                    }
+                    row {
+                        rlabel("Link:", hfill = true)
+                        linkbutton(varname = "link", styleClass = "ui-nopadding");
                     }
-                    tab {
-                        grid(fill = true, columnspacing = 8, rowspacing = 8, margin = 8, defvfill = true) {
-                            row {
-                                rlabel("Feed:", hfill = true)
-                                llabel(varname = "feedname", hexpand = true)
-                            }
-                            row {
-                                val w1 = rlabel("Author:", hfill = true)
-                                val w2 = llabel(varname = "author")
-                                w1.setVisibilityStates(ITEM_HAS_AUTHOR)
-                                w2.setVisibilityStates(ITEM_HAS_AUTHOR)
-                            }
-                            row {
-                                val w1 = rlabel("Category: ", hfill = true)
-                                val w2 = llabel(varname = "category")
-                                w1.setVisibilityStates(ITEM_HAS_CATEGORY)
-                                w2.setVisibilityStates(ITEM_HAS_CATEGORY)
-                            }
-                            row {
-                                rlabel("Link:", hfill = true)
-                                linkbutton(varname = "link", styleClass = "ui-nopadding");
-                            }
 
-                            row {
-                                vbox(hfill = true, vfill = true, hexpand = true, vexpand = true, colspan = 2) {
-                                    hbox(spacing = 4, visibilityStates = intArrayOf(ITEM_INTERNAL_BROWSER)) {
-                                        button(icon = "go-previous")
-                                        button(icon = "go-next")
-                                        textfield(varname = "web-uri", fill = true)
-                                    }
-                                    webview(varname = "webview", fill = true, colspan = 2)
-                                }
+                    row {
+                        vbox(hfill = true, vfill = true, hexpand = true, vexpand = true, colspan = 2) {
+                            hbox(spacing = 4, visibilityStates = intArrayOf(ITEM_INTERNAL_BROWSER)) {
+                                button(icon = "go-previous")
+                                button(icon = "go-next")
+                                textfield(varname = "web-uri", fill = true)
                             }
+                            webview(varname = "webview", fill = true, colspan = 2)
                         }
                     }
                 }
+                g.setVisibilityStates(ITEM_SELETED)
             }
         }