CheckBoxTreeItem: must update check state on modifications to children list

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8u60
    • Component/s: javafx
    • Environment:

      8u60b5, win7

      title says it all ;-)

      Below is a test that exposes the misbehaviour for the case of removing a selected CheckBoxTreeItem, Too lazy to write the tests for other list modifications, but pretty sure that it's the same for adding/replacing items

          /**
           * CheckBoxTreeItem must update parent state when modifying the
           * children list.
           */
          @Test
          public void testCheckBoxTreeItemDataModification() {
              CheckBoxTreeItem checkBoxRoot = createCheckBoxSubTree("checked-root");
              checkBoxRoot.setExpanded(true);
              tree.setRoot(checkBoxRoot);
              CheckBoxTreeItem child = (CheckBoxTreeItem) checkBoxRoot.getChildren().get(2);
              child.setSelected(true);
              assertTrue(checkBoxRoot.isIndeterminate());
              root.getChildren().remove(child);
              assertFalse("root must update its check state on modifications to children list",
                      checkBoxRoot.isIndeterminate());
          }

          protected CheckBoxTreeItem createCheckBoxItem(Object item) {
              return new CheckBoxTreeItem(item);
          }

          protected ObservableList<CheckBoxTreeItem> createCheckBoxItems(ObservableList other) {
              ObservableList items = FXCollections.observableArrayList();
              other.stream().forEach(item -> items.add(createCheckBoxItem(item)));
              return items;
          }

          protected CheckBoxTreeItem createCheckBoxSubTree(Object item) {
              CheckBoxTreeItem child = createCheckBoxItem(item);
              child.getChildren().setAll(createCheckBoxItems(rawItems));
              return child;
          }



            Assignee:
            Ajit Ghaisas
            Reporter:
            Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: