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

[TreeTableView] Disclosure nodes sometimes dissapear when quickly and repeatadly expanding/collapsing tree items

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u40
    • javafx

      A simple TreeTableView containing CheckBoxTreeItems, a few non-leaf nodes, each containing a few
      leafs. When quickly and repeatadly expanding and collapsing a disclosure node of last non-leaf node,
      after a while (usually 40-50 clicks), the other disclosure nodes start dissapearing and reappearing
      again. It seems to be a rendering bug.

      I haven't managed to pinpoint a specific behaviour that causes the issue, it seems a bit random. Selecting
      other checkboxes between the clicks sometimes triggers the rendering bug a bit faster.

      The simple code causing the issue is below. I am running JDK 1.8.0_40 (64-bit, Linux, KDE 4.14.6).

      import javafx.application.Application;
      import javafx.beans.property.BooleanProperty;
      import javafx.beans.property.SimpleBooleanProperty;
      import javafx.scene.Scene;
      import javafx.scene.control.CheckBoxTreeItem;
      import javafx.scene.control.TreeTableColumn;
      import javafx.scene.control.TreeTableView;
      import javafx.scene.control.cell.CheckBoxTreeTableCell;
      import javafx.stage.Stage;

      public final class DisclosureNodeTest extends Application {

      public static void main(final String[] args) {
      launch(args);
      }

      @Override
      public final void start(final Stage stage) throws Exception {
      final Model rootModel = new Model();
      final CheckBoxTreeItem<Model> root = new CheckBoxTreeItem<>(rootModel);
      root.selectedProperty().bindBidirectional(rootModel.selectedProperty());

      for(int i = 0; i < 10; ++i) {
      final Model parentModel = new Model();
      final CheckBoxTreeItem<Model> parentCheckBox = new CheckBoxTreeItem<>(parentModel);
      parentCheckBox.selectedProperty().bindBidirectional(parentModel.selectedProperty());

      for(int j = 0; j < 5; ++j) {
      final Model childModel = new Model();
      final CheckBoxTreeItem<Model> childCheckBox = new CheckBoxTreeItem<>(childModel);
      childCheckBox.selectedProperty().bindBidirectional(childModel.selectedProperty());
      parentCheckBox.getChildren().add(childCheckBox);
      }
      root.getChildren().add(parentCheckBox);
      }

      final TreeTableColumn<Model, Boolean> selectedColumn =
      new TreeTableColumn<>("Selected");
      selectedColumn.setPrefWidth(200);
      selectedColumn.setEditable(true);
      selectedColumn.setCellValueFactory(p -> p.getValue().getValue().selectedProperty());
      selectedColumn.setCellFactory(tc -> new CheckBoxTreeTableCell<>());

      final TreeTableView<Model> table = new TreeTableView<>(root);
      table.setShowRoot(false);
      table.setEditable(true);
      table.getColumns().add(selectedColumn);

      final Scene scene = new Scene(table, 500, 350);
      stage.setScene(scene);
              stage.show();
      }

      private final class Model {
      private final BooleanProperty selected;

      public Model() {
      this.selected = new SimpleBooleanProperty(false);
      }

      public final BooleanProperty selectedProperty() {
      return selected;
      }
      }
      }

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: