The example is an implemenation of TreeItem wrapping the file system. The initial leaf-ness of directories is inconsistent for getter vs. property, failing test snippet:
TreeView<File> tree = buildFileSystemBrowser();
for (TreeItem child : tree.getRoot().getChildren()) {
assertEquals(child.isLeaf(), child.leafProperty().get());
}
The reason is that sub-classes can't access leafProperty (already reported in RT-37386 and others), so I see no way to initialize the property correctly (short of going dirty and expand the node temporarily or reflective access).
This is meant as a reminder to update the example once the reason is fixed.
TreeView<File> tree = buildFileSystemBrowser();
for (TreeItem child : tree.getRoot().getChildren()) {
assertEquals(child.isLeaf(), child.leafProperty().get());
}
The reason is that sub-classes can't access leafProperty (already reported in RT-37386 and others), so I see no way to initialize the property correctly (short of going dirty and expand the node temporarily or reflective access).
This is meant as a reminder to update the example once the reason is fixed.
- relates to
-
JDK-8184912 TreeItem.leafProperty() out of sync with isLeaf()
- Open
-
JDK-8257873 Bad variable name in demo code in JavaDoc for TreeItem
- Open