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

TreeTableView - No indentation when no items with children visible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 8, 10.0.2, openjfx11
    • Fix Version/s: tbd
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      OS is Windows 10. Issue has been encountered with Java 8 Updates 121 and 181. No other OS or Java Version tested.

      A DESCRIPTION OF THE PROBLEM :
      When a TreeTableView is displayed and any items with children are outside of the visible range, the other items are displayed without any indentation. Only after scrolling to the first item with children, all texts are moved to the correct position.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the example code below. Notice the position of the texts. Scroll down to the item with children. As soon as it becomes visible the other items will jump to the correct position.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Items should be indented right after initialization.
      ACTUAL -
      Items are not indented, until item with children becomes visible.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.beans.property.ReadOnlyObjectWrapper;
      import javafx.scene.Scene;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeTableColumn;
      import javafx.scene.control.TreeTableView;
      import javafx.stage.Stage;

      public class TreeTableIndentExperiment extends Application {

        @Override
        public void start(Stage primaryStage) throws Exception {
          TreeTableView<String> tableView = new TreeTableView<>();
          tableView.setShowRoot(false);

          TreeTableColumn<String, String> column = new TreeTableColumn<>("col1");
          column.setCellValueFactory(param -> new ReadOnlyObjectWrapper<String>(param.getValue().getValue()));
          tableView.getColumns().add(column);

          TreeItem<String> root = new TreeItem<>("root");
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          root.getChildren().add(new TreeItem<>("a"));
          TreeItem<String> itemWithChildren = new TreeItem<>("b");
          itemWithChildren.getChildren().add(new TreeItem<>("b"));
          itemWithChildren.getChildren().add(new TreeItem<>("b"));
          itemWithChildren.getChildren().add(new TreeItem<>("b"));
          itemWithChildren.getChildren().add(new TreeItem<>("b"));
          root.getChildren().add(itemWithChildren);

          tableView.setRoot(root);

          Scene scene = new Scene(tableView);
          primaryStage.setScene(scene);
          primaryStage.show();

        }

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

      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: