Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8089811

TreeItem: invalid implementation of isLeaf in java doc example (FileTreeItem)

XMLWordPrintable

      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.

            Unassigned Unassigned
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: