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

Mess with graphic property of child treeItems

XMLWordPrintable

    • b96
    • 9
    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 7 x64
      java 10.0.2


      A DESCRIPTION OF THE PROBLEM :
      When you expand the root treeItem and scroll down then up you will see that root treeItem graphic will be replaced with child treeItem graphic and one of child treeItem graphics will be replace with root TreeItem graphic.

      REGRESSION : Last worked in version 8u181

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      To reproduce just launch class below, expand root tree, scroll down and then scroll up - you will see the mess with treeItem graphics

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      After scrolling root tree each treeItem will have its original graphic
      ACTUAL -
      After scrolling root tree some treeItems have not there original graphic

      ---------- BEGIN SOURCE ----------
      package com.idc.shellexplorer;

      import javafx.application.Application;
      import javafx.beans.property.ReadOnlyStringWrapper;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.TreeTableColumn;
      import javafx.scene.control.TreeTableColumn.CellDataFeatures;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeTableView;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;
      import javafx.scene.image.ImageView;

      public class TestTreeTableView extends Application {


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

          @Override
          public void start(Stage stage) {
              stage.setTitle("Tree Table View Samples");
              final Scene scene = new Scene(new Group(), 200, 400);
              Group sceneRoot = (Group)scene.getRoot();


              //Creating the root element
              final TreeItem<String> root = new TreeItem<>("Root node", createIcon(Color.GREEN));

              for (int i = 1; i <= 30; i++) {
                  //Creating tree items
                  final TreeItem<String> childNode1 = new TreeItem<>("Child Node " + i);
                  childNode1.setGraphic(createIcon(Color.BLUE));

                  for (int j = 1; j <= 5; j++) {
                      final TreeItem<String> childChildNode1 = new TreeItem<>("Child child Node " + j);
                      childChildNode1.setGraphic(createIcon(Color.BLACK));
                      childNode1.getChildren().add(childChildNode1);
                  }
                  root.getChildren().add(childNode1);
              }

              //Creating a column
              TreeTableColumn<String,String> column = new TreeTableColumn<>("Column");
              column.setPrefWidth(200);

              //Defining cell content
              column.setCellValueFactory((CellDataFeatures<String, String> p) ->
                      new ReadOnlyStringWrapper(p.getValue().getValue()));

              //Creating a tree table view
              final TreeTableView<String> treeTableView = new TreeTableView<>(root);
              treeTableView.getColumns().add(column);
              treeTableView.setPrefWidth(200);
              treeTableView.setShowRoot(true);
              sceneRoot.getChildren().add(treeTableView);
              stage.setScene(scene);
              stage.show();
          }

          private ImageView createIcon(Color color) {
              return new ImageView(new Rectangle(12, 12, color).snapshot(null, null));
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: