changeset 4137:f0c5b8c75c94

RT-31404: TreeTableView doesn't update properly when showRoot is toggled
author jgiles
date Wed, 03 Jul 2013 08:58:37 +1200
parents bd9e99eb8735
children 4ae1706251da
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java
diffstat 3 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Wed Jul 03 08:10:55 2013 +1200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Wed Jul 03 08:58:37 2013 +1200
@@ -145,7 +145,7 @@
                  getRoot().setExpanded(true);
             }
             // update the item count in the flow and behavior instances
-            rowCountDirty = true;
+            updateRowCount();
         } else if ("ROW_FACTORY".equals(p)) {
             flow.recreateCells();
         } else if ("TREE_ITEM_COUNT".equals(p)) {
--- a/modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java	Wed Jul 03 08:10:55 2013 +1200
+++ b/modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java	Wed Jul 03 08:58:37 2013 +1200
@@ -2094,4 +2094,23 @@
         assertEquals(child1, treeTableView.getEditingItem());
         assertTrue(cell.isEditing());
     }
+
+    @Test public void test_rt31404() {
+        installChildren();
+
+        TreeTableColumn<String,String> firstNameCol = new TreeTableColumn<>("First Name");
+        firstNameCol.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<String, String>, ObservableValue<String>>() {
+            @Override public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<String, String> param) {
+                return new ReadOnlyStringWrapper(param.getValue().getValue());
+            }
+        });
+
+        treeTableView.getColumns().add(firstNameCol);
+
+        IndexedCell cell = VirtualFlowTestUtils.getCell(treeTableView, 0, 0);
+        assertEquals("Root", cell.getText());
+
+        treeTableView.setShowRoot(false);
+        assertEquals("Child 1", cell.getText());
+    }
 }
--- a/modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java	Wed Jul 03 08:10:55 2013 +1200
+++ b/modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java	Wed Jul 03 08:58:37 2013 +1200
@@ -1047,4 +1047,14 @@
         assertEquals(child1, treeView.getEditingItem());
         assertTrue(cell.isEditing());
     }
+
+    @Test public void test_rt31404() {
+        installChildren();
+
+        IndexedCell cell = VirtualFlowTestUtils.getCell(treeView, 0);
+        assertEquals("Root", cell.getText());
+
+        treeView.setShowRoot(false);
+        assertEquals("Child 1", cell.getText());
+    }
 }