From 816c3b8f36a04748fdc6f3bbe837e50b57a1deac Mon Sep 17 00:00:00 2001 From: Alan McLachlan Date: Fri, 11 Sep 2020 16:26:56 +0200 Subject: [PATCH] fixing empty table case --- .../brewday/ui/jfx/V2DataObjectPane.java | 17 +++++++---------- .../brewday/ui/jfx/V2DataObjectTableModel.java | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectPane.java b/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectPane.java index 1561f3d..68977f7 100644 --- a/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectPane.java +++ b/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectPane.java @@ -446,19 +446,16 @@ public void refresh(Database database) Map ref = getMap(database); - if (ref.size() > 0) - { - tableModel.refresh(ref); - tableInitialSort(table); + tableModel.refresh(ref); + tableInitialSort(table); - filterTable(); + filterTable(); - for (T t : ref.values()) + for (T t : ref.values()) + { + if (JfxUi.getInstance().isDirty(t)) { - if (JfxUi.getInstance().isDirty(t)) - { - rowFactory.setDirty(t); - } + rowFactory.setDirty(t); } } diff --git a/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectTableModel.java b/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectTableModel.java index a5df6b4..9e8b8e8 100644 --- a/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectTableModel.java +++ b/src/main/java/mclachlan/brewday/ui/jfx/V2DataObjectTableModel.java @@ -52,6 +52,7 @@ public void refresh(Map map) unfilteredList.clear(); this.map = map; + System.out.println("map.size() = [" + map.size() + "]"); unfilteredList.addAll(map.values()); tableView.sort();